Inconsistent output from numericFormat service

Product/components used and version/fix level:

Using webMethods version 9.12

Detailed explanation of the problem:

Hi Guys,
I am observing inconsistent behaviour of output coming from the built-in service pub.string:numericFormat.
Output varies for different sets of inputs.

Error messages / full error message screenshot / log file:



Question related to a free trial, or to a production (customer) instance?

Production instance.

Thanks in advance!

Hi,

are there any Fixes applied to your wM 9.12 IS?

Preferrably, you should consider an upgrade to wM 10.15, which will be a 2-step upgrade with a wM 10.5 or 10.7 in between.

Regards,
Holger

I see there are some fixes applied, say, IS 9.12 core fix31, TN 9.12 fix15, etc.

btw, is it a known issue for the older versions (say less than version 10)?

The issue with the service is its use of Double within the implementation. It is not a bug. It is not an artifact of older versions. It is the nature of floating point, which is precise but not always accurate.

The IS docs indicate the service uses the HALF_EVEN rounding mode (the default of the DecimalFormat class being used), but because of the use of Double (with native double underneath that) the accuracy is lost.

You’ll want to look elsewhere for numeric formatting that does not use float/double to do the work. Indeed, if at all possible, you may want to avoid formatting numbers within wM IS altogether unless you have no other choice. Let the endpoints that care about it do whatever manipulation they may need.

2 Likes

If I had a penny for every time I’ve seen Rob explain issues related to binary floating-point arithmetic, I’d have several pennies now. :slight_smile: The first time was probably in the early to mid 2000’s on wmusers.com. Thanks for the consistency throughout the years, @reamon !

1 Like

It is interesting how long wM IS has been around and how long we’ve been working with it. :slight_smile:

And a little disappointing that floating point is still so broadly misunderstood (though not necessarily in this case – not easy to know how this service is implemented).

2 Likes