book
Article ID: KB0085890
calendar_today
Updated On:
Description
Resolution:
Description:
===========
Float returns value without the decimals.
Environment:
===========
AS 2.1.*
All operating systems
Symptoms:
=========
BW program doing PUT then GET to a space. when we use value greater than
100000.01.
100000.01 -> this value was correctly retrieved from AS.
Whereas all the other values are round off without decimal points.
0001000000.01
0010000000.01
0100000000.01
1000000000.01
For example: 10000000.67 were round off to 10000001
Cause:
======
It is the number used in float type (like “10000000.67”) exceeding the range of float that causes this issue.
According to schema spec: http://www.w3.org/TR/xmlschema-2/#float
****************************
.2.4 float
[Definition:] float is patterned after the IEEE single-precision 32-bit floating point type [IEEE 754-1985]. The basic •value space• of float consists of the values m × 2^e, where m is an integer whose absolute value is less than 2^24, and e is an integer between -149 and 104, inclusive. In addition to the basic •value space• described above, the •value space• of float also contains the following three special values: positive and negative infinity and not-a-number (NaN). The •order-relation• on float is: x < y iff y - x is positive for x and y in the value space. Positive infinity is greater than all other non-NaN values. NaN equals itself but is •incomparable• with (neither greater than nor less than) any other value in the •value space•.
**********************
BW has 32 bits to store a float. 24 of them will be used for significant, the other 8 for integer exponent.
Take 99999999 as an example.
* Since 99999999 exceed 2^24 (actually 2^26+), to store it as a float, BW has to divide it by 8, which becomes 12499999.875.
* Since there is no memory to store .875, BW has to store the integer closest to it: 12500000
* Therefore the float will be significant: 12500000, integer exponent: 3. which is 100000000.
Resolution:
===========
It is float specification tha the number exceeds. If it is required to use huge numbers in the field, use another proper type for the field in the schema or space (for example: double).
Issue/Introduction
In ActiveSpaces and BWAS plugin, Float returns value without the decimals.