I’m looking for a Rounding Method or Routine that will

- Zero out any penny amounts
- zero out the 1’s dollar amount

ex: $194.32 desired result 190.00

or

ex: $196.33 desired result: 200.00

Please Advise.

I’m looking for a Rounding Method or Routine that will

- Zero out any penny amounts
- zero out the 1’s dollar amount

ex: $194.32 desired result 190.00

or

ex: $196.33 desired result: 200.00

Please Advise.

Check the docs on Round, Ceil, and Floor.

David,

the http://developer.xojo.com web site is question sensitive (related) feature

Type Math in the search field and you will get a list of found entries. At the top you will find: Math.

Type in it and you will get a list of entries related to Math.

In the left pane, you usually get a list f related (to your question / to where you are / what are reading) entries.

round(x/10)*10 rounds to next 10s.

what about sound to nearest 100 then???

Same basic idea:

Round(x/100)*100

you can add more zeros as needed.

never know it is this easy…

You can also go in the other direction. For example if you wish to round to the nearest 10 cents:

Round(x/0.1)*0.1

will round 2.34 to 2.30

ok great thank you

If you want to round to 0 or 5 (step by 5) you can do :

round(x / 5) * 5

I fact, if you want to round every step MyStep then :

round(x / MyStep) * MyStep

The first ask was a step by 10 then round(x / 10) * 10

Forum for Xojo Programming Language and IDE. Copyright © 2024 Xojo, Inc.