Float values are converted to another value while parsing or mapping in TIBCO BusinessWorks.

Float values are converted to another value while parsing or mapping in TIBCO BusinessWorks.

book

Article ID: KB0090342

calendar_today

Updated On:

Products Versions
TIBCO ActiveMatrix BusinessWorks -
Not Applicable -

Description

Resolution:
Environment:
===========
ALL

Symptoms:
========
If, for example, we specify “890013.09” in an input field, defined as float, the value is interpreted as “890013.06”    

Other results:

890013.01 = 890013

890013.02 = 890013

890013.03 = 890013

890013.04 = 890013.06

890013.05 = 890013.06

890013.09 = 890013.06

Cause:
=====
This issue is not specific to BW. We can observe the change in value even if using standalone Java code. According to the W3C Recommendations (link supplied below under "References"), float data is represented by IEEE single-precision 32-bit floating point type. The value of a IEEE-754 number is computed as:

sign * (2^exponent) * mantissa

The sign is stored in bit 32. The exponent can be computed from bits 24-31 by subtracting 127. The mantissa (also known as the significand or fraction) is stored in bits 1-23. An invisible leading bit (i.e. it is not actually stored) with the value 1.0 is placed in front, then bit 23 has a value of 1/2, bit 22 has value 1/4, etc. As a result, the mantissa has a value between 1.0 and 2. If the exponent reaches -127 (binary 00000000), the leading 1 is no longer used to enable gradual underflow.

Resolution:
==========
Use  “double” instead of "float".


References:
==========
http://www.w3.org/TR/xmlschema-2/#float

Issue/Introduction

Float values are converted to another value while parsing or mapping in TIBCO BusinessWorks.

Additional Information

http://www.w3.org/TR/xmlschema-2/#float