• ×
    Information
    Windows update impacting certain printer icons and names. Microsoft is working on a solution.
    Click here to learn more
    Information
    Need Windows 11 help?
    Check documents on compatibility, FAQs, upgrade information and available fixes.
    Windows 11 Support Center.
  • post a message
  • ×
    Information
    Windows update impacting certain printer icons and names. Microsoft is working on a solution.
    Click here to learn more
    Information
    Need Windows 11 help?
    Check documents on compatibility, FAQs, upgrade information and available fixes.
    Windows 11 Support Center.
  • post a message
Guidelines
The HP Community is where owners of HP products, like you, volunteer to help each other find solutions.
Archived This topic has been archived. Information and links in this thread may no longer be available or relevant. If you have a question create a new topic by clicking here and select the appropriate board.
HP Recommended

I am trying to ROUND a number to 2 decimal places in the HP Prime using  RPN and  it does not work.   I have tried putting the arguments in the stack, such as:

 

19.127456

2

ROUND()

ENTER

 

And the stack is unchanged.

 

Thanks.

 

4 REPLIES 4
HP Recommended

When a function can have optional arguments, such as the ROUND function which can have an optional second argument, then in RPN you are required to specify how many arguments it should take from the stack, by putting that number in parentheses right after the function.  It looks funny but it works.  So always type ROUND(2) no matter how many digits you're rounding to.  The "(2)" in "ROUND(2)" tells Prime to take 2 numbers off the stack as the arguments for the ROUND function.

 

Example: To round pi to 4 places in RPN mode, do this:

 

PI

4

ROUND(2)

 

An alternative method is to put your Prime in Fixed 4 mode.  Then the ROUND function by itself (with no explicit number of arguments specified) will only take one argument from the stack, and round it to the current display setting.  So, in Fixed 4 mode, the following:

 

PI

ROUND

 

returns 3.1416 exactly.

 

Hope that helps!  Disclaimer: I don't work for HP, but I enjoy playing with their calculators.

-Joe-
HP Recommended

Hi!, FeliO:

 

Welcome, to HP Forum !. :generic:

 

Syntax:

ROUND(value, [places])

Description:

Rounds value to system display settings. If optional places is given, rounds value to places decimal places. If places is negative, rounds to significant digits instead.

Examples:

ROUND(7.8676,2) returns 7.87
ROUND(19.127456,2) returns 19.13
 
In RPN ...
1: 19.127456
2: ROUND (2) + ENTER
1: 19.13
Kind Regards !.
Have a nice day !.
@Maké (Technical Advisor Premium - HP Program Top Contributor).
Provost in HP Spanish Public Forum ... https://h30467.www3.hp.com/
HP Recommended

Joe,  thanks it worked fine.

 

Make, see Joe's post to see how ROUND works in RPN.  What you typed does not work in RPN and returns a Bad argument error. 

 

Thanks.

HP Recommended

Hi!, @FelixO:

 

Excuse, me by the omission !.

 

You needed write, as ...

In RPN ...
2: 19.127456
1: 2
ROUND (2) + ENTER
1: 19.13
Kind Regards !.
Have a nice day !.
@Maké (Technical Advisor Premium - HP Program Top Contributor).
Provost in HP Spanish Public Forum ... https://h30467.www3.hp.com/
Archived This topic has been archived. Information and links in this thread may no longer be available or relevant. If you have a question create a new topic by clicking here and select the appropriate board.
† The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the <a href="https://www8.hp.com/us/en/terms-of-use.html" class="udrlinesmall">Terms of Use</a> and <a href="/t5/custom/page/page-id/hp.rulespage" class="udrlinesmall"> Rules of Participation</a>.