What is the best variable to calculation to minimize rounded numbers?

Using PostgreSQL

What is the best variable to calculation to minimize rounded numbers?

Using PostgreSQL

I’m not sure what you are asking, can you state the question in a different form?

to get a closer results when making divisions and the results have cents

Examples

11.99*6.0 %= 0.65945

i like to be =0.66

x=11.99*0.06
x=ceil(x*100)/100

thanks

What about using the `Currency`

type? You can use DatabaseField.CurrencyValue and DatabaseRecord.CurrencyColumn

11.99*6.56=78.6544

Do you want 78.65 or 78.66 ?

If the first, change Ceil by Round in Dave’s solution.

Are you talking about calculation on which side? SQL or Xojo? For PostgreSQL there is the direct Round(n, 2)

Jeremy, Currency data type holds 4 decimals. Great for many aspects, but if the intention is rounding on 2 digits, he needs extra steps.

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