Level 1

0% to

Level 2

Tip /

to gain points, level up, and earn exciting badges like the new
Mission!

View all

## Currency Decimal Places

Gene--O
Level 2

Likes

3 likes

Total Posts

76 posts

0 solutions
View profile

Gene--O
Level 2

Likes

3 likes

Total Posts

76 posts

0 solutions
View profile
Gene--O
Level 2

07-01-2013

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

#### Accepted Solutions (1)

Francis_Manly-E
Level 1

Like

1 like

Total Posts

26 posts

2 solutions
View profile

Francis_Manly-E
Level 1

Like

1 like

Total Posts

26 posts

2 solutions
View profile
Francis_Manly-E
Level 1

08-01-2013

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:

Kosta_Prokopiu
Level 2

Likes

13 likes

Total Posts

51 posts

8 solutions
View profile

Kosta_Prokopiu
Level 2

Likes

13 likes

Total Posts

51 posts

8 solutions
View profile
Kosta_Prokopiu
Level 2

24-07-2020

🙂 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

Anilr1717
Level 1

Likes

0 likes

Total Posts

2 posts

0 solutions
View profile

Anilr1717
Level 1

Likes

0 likes

Total Posts

2 posts

0 solutions
View profile
Anilr1717
Level 1

24-07-2020

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

Gene--O
Level 2

Likes

3 likes

Total Posts

76 posts

0 solutions
View profile

Gene--O
Level 2

Likes

3 likes

Total Posts

76 posts

0 solutions
View profile
Gene--O
Level 2

08-01-2013

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

Gene--O
Level 2

Likes

3 likes

Total Posts

76 posts

0 solutions
View profile

Gene--O
Level 2

Likes

3 likes

Total Posts

76 posts

0 solutions
View profile
Gene--O
Level 2

08-01-2013

Any other suggestions??

Gene-O

MVP

Likes

394 likes

Total Posts

2,686 posts

489 solutions
View profile

MVP

Likes

394 likes

Total Posts

2,686 posts

489 solutions
View profile
MVP

07-01-2013

Hi,

the decimal places are rounded by IEEE 754 standard.

See example 25.4 under the following link.

`NumericField * .555 + 0.001`