Hi,
Whenever I'm trying to enter 271.64 or 2**.65 where (** can be any number) it's getting converted to 2**.64
I'm using below expression for this:
a!floatingPointField( label: "Test Decimal Value", value: todecimal(fixed(trunc(ri!value, 2))), saveInto: ri!value)
Not sure, if this is an issue from Appian. Can anyone confirm this.
Thanks in advance.
Discussion posts and replies are publicly visible
There is nothing "converted". This is just the way how the values is displayed in both places.
Hi Stefan, Thanks for your reply. But, issue is it's only happening with this specific number 2**.65 which is converting into 2**.64.
It's working with three decimal values, but business requirement is to keep up to two decimal values. And this is happening only in this scenario not with any other numbers. Like:
There is a general problem with how computers store decimal values. Check this:
https://www.baeldung.com/cs/floating-point-numbers-inaccuracy
You will see this with a lot of numbers. Depending in the internal representation it works most of the time and sometimes not. And there is no real fool proof way of managing this. Mathematical rounding should get you covered most of the time. This conversion to a string and back to a decimal will probably not.