PSA: Decimals are now being handled as floats

Here’s how to verify: Make a new BAQ. You don’t need to add any tables. Add one calculated decimal field, adding 0.1 + 0.2 and edit the format to show 20 decimal places.

Then run it.

So what, I hear you say. You’ll never format decimals like that in a BAQ. Okay, format the decimal to one place and you’ll be shown “0.3”. Right click that result, copy all or selection or whatever, and paste somewhere. That’s not 0.3 on your clipboard. Decimal values are being passed around as floats regardless of the displayed value.

Why does this matter? When a value that should end with 5 is incorrectly reported as /499999… and rounded to the nearest relevant unit, the rounding is wrong. Best case scenario is that exported work will lose accuracy due to rounding error exposure. Worst case is that the software itself is consuming float math. Currency is a decimal. Exposing the GL to float-caused rounding errors is not something any of us wants to experience.

7 Likes

Is it the same in classic or only in kinetic?

2 Likes

Just ran a test in classic. This seems to be Kinetic related behaviour.

image

1 Like

That’s a great question, thank you! Didn’t even think of that.

That appears to narrow down the affected scope away from :poop: randomly around the GL, which is nice.

Ah too slow, I’ve been ninja’d…

Yeah so report it as a parity issue. There was an issue with dates between kinetic and classic too.

2 Likes

Epicor likes to sit on Kinetic data loss issues due to type conversion errors for some reason, I opened this PRB re: data loss using Longs in functions when outputting to kinetic 3 months ago which is Accepted, Not yet planned:

PRB0306555

5 Likes

That’s just some of that “Kinetic innovation” they’re forcing us all to the cloud for. :winking_face_with_tongue: :rofl:

5 Likes

that is because browser does not support such huge numbers

1 Like

0.1 + 0.3 = not a huge number.

Huge numbers is not the problem.

2 Likes

true, this one looks like some formatting issue in grid :woman_shrugging:

You should report

In Gabe’s story huge number is problem, it is rounded.
Sorry, offtop.
If it is really necessary to send such numbers in function, string can be used now.
But if it was reported only because of functions SysRevID processing, that was fixed last release.

1 Like

It seems a really similar problem from my understanding, caused by javascript not having BigInt support in older versions..

0.1 decimal + 0.2 decimal should become 0.3 decimal, not converted to float at any point, but it is handled as a float because browser javascript doesn’t have a numeric object to hold a decmial.

Same issue for a min/max int64, browser/js doesn’t have BigInt, so it’s handled as a float and rounded.

SysRevID is handled properly by the browser in BOs (it is a long, maybe they handle it as a string intermediate as you mention), so it just seems that logic needs to be applied a few more places.

Re: Formatting issue in grid, what do you see in the F12/Dev Tools call? is it being sent with the rounding or formatted with the rounding?

1 Like

I don’t know about format, but I know about SysRevID, it was represented differently in function tablesets compared to BO. (Little vs Big Endian conversion of byte array).

Decimals here in the BAQ are no integers at all big or normal.

1 Like

Makes sense! Tyvm

(Side note, does that mean it’s only SysRevID within a dataset that is fixed within function? If I have a dataset with a long that isn’t SysRevID, still broken? What about a long as a function output parameter?)

1 Like

yes, still the same. I am not aware of BigInt support in UX library.
So if you really need that huge integer as parameter, use string

4 Likes

Support seem to believe one of our customers is alone in seeing this behaviour.

If anybody else is suffering the same, please raise a case and reference our case CS0005262894.

The bug seems to have been introduced in a UI patch for Cloud systems sometime during December.

2 Likes

I have not seen this issue personally (because I haven’t looked), but having worked on JS apps plenty before, you need an external library (i.e. decimal.js) to handle precision issues due to floating point arithmetic client side. I suspect this is maybe because calculated fields are being evaluated client-side to try to help performance?

3 Likes

It affects all decimal fields, not just calculated fields.

2 Likes

It actually works for me too. Maybe it was already fixed recently


1 Like

No, it does not, I forgot to set decimal type.

Data is returned correctly from the server

3 Likes