cancel
Showing results for 
Search instead for 
Did you mean: 

SAP PI Conversion of floating point to numeric

pi_consultant1
Participant
0 Kudos

Hello Experts,

Ive a requirement to convert floating point values eg: 4.7799999999999997E+01 to a numeric value.

The result should be: 47.79 (two digits after the dot and not rounded)

Or 9.400000000000000E+00 to 9.40

Ive checked several posts but didnt get the result I wanted.

Can you please advice how to achieve this?

Thank you in advance,

Kind regards,

Accepted Solutions (1)

Accepted Solutions (1)

fprokopiuk
Active Participant
0 Kudos

Did you try FormatNum from Arithmetic functions? You should use #.00 format for your requirement.

However the 4.7799999999999997E+01 will be 47.80 and not 47.79 because of rouding.

pi_consultant1
Participant
0 Kudos

This seems to work, thank you 🙂

However when the value is 0.000000000000000E+00 the result is .00 but thats ok, I will append a 0, for it to become 0.00.

fprokopiuk
Active Participant
0 Kudos

To get 0.00 for above just change format in FormatNum to '0.00' instead of '#.00'.

Answers (0)