cancel
Showing results for 
Search instead for 
Did you mean: 

MII number calculation gives -0

glendescheerder
Discoverer
0 Kudos

SAP MII Version: 15.2 SP3 Patch 8 (Mar 20, 2019)

Scenario: I'm retrieving 2 values do a calculation and if the calculation is negative throw an error.

Issue: for certain values the calculation returns '-0' and handles it as a negative number. As I'm retrieving my values from a custom SQL action block the values are text.

Expected behaviour: the first expression should return '0'. The second expression should return '0' or 'false'

Did somebody else experience this behaviour? Does someone know if this is fixed in later patched?

Accepted Solutions (0)

Answers (1)

Answers (1)

agentry_src
Active Contributor

In SQL Server and many databases, the float or double numbers are actually expressed as functions of binary. So if you have values to the right of the decimal point, it does not exactly equal the number displayed. It extends much further to the right. If you want to see the desired results, then use the format function with 3 decimal places (or 4 or 5 or whatever makes sense in your scenario). One can do that to the individual numbers or to the full equation.

If you have access to the database, you can also do a select on a float field and see what the number is in response. It may be a little different than you expect. -0 simply means the value does not fit within the specific number of decimal places for the value returned.