Expand my Community achievements bar.

SOLVED

## Currency Decimal Places Former Community Member

HELP!

I have ready many posts on this subject, and can't figure out why mine won't work - it seems so simple:

I have NumericField1 and NumericField2. I want to multipy the user entered value from NumericField1 by a fixed value (in this case .555) to return a currency rounded up to the nearest cent (hundredths decimal point). I have tried using the field pattern options, but NONE of them will round up, they just return a dollar value with 2 decimal places.

For example:

I enter "307" into NumericField1. This value multiplied by .555 returns \$170.385. I want this to display as \$170.39, but all I can get is \$170.38.

Any help is appreciated!!!

Gene-O

1 Accepted Solution  Level 2

Hi Gene,

You could also use FormCalc's Round function:

\$.rawValue = Round(NumericField1.rawValue *.555, 2);

Additional information on the Round function can be found here:

6 Replies  Level 10

Hi,

the decimal places are rounded by IEEE 754 standard.

See example 25.4 under the following link.

Such as

`NumericField * .555 + 0.001` Former Community Member

Any other suggestions??

Gene-O  Level 2

Hi Gene,

You could also use FormCalc's Round function:

\$.rawValue = Round(NumericField1.rawValue *.555, 2);

Additional information on the Round function can be found here: Former Community Member

thank you thank you thank you thank you Francis!

I tried (in vain) to get the round function to work before. You're answer was correct!

have a wonderful day!

Gene-O  Level 1

Hi,

Just posting here so anybody can use it. 12345/1000 = 12.34 not 12.35

Code: 12.34

Floor(ToDouble(@CONTENT4)/1000)+'.'
+Substring( Iif(Length(ToString(Mod(ToDouble(@CONTENT4), 1000)))<=1,LPad(ToString(Mod(ToDouble(@CONTENT4), 1000)),3 ,'00' ),
ToString(Mod(ToDouble(@CONTENT4), 1000)))),1,2 )

Code: 12.35

Round(ToDouble(12345)/1000,2)

Regards,

Anil  Level 4

I think there is an easier solution

12345/1000 on next lower cent: Math.floor(100*(12345/1000))/100   =>> 12.34

12345/1000 on next higher cent: Math.ceil(100*(12345/1000))/100 =>> 12.35 