cannot store a value which equal to its range limit

Bug #953112 reported by vanh souvanlasy
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
libECBUFR
Fix Committed
Medium
vanh souvanlasy

Bug Description

the encoder is rejecting a value that is equal to its descriptor's valid range lower or upper limit value.
For example descriptor 13011, this should take any value between [-0.1, 1638.1]
But the value -0.1 cannot be stored and a default missing value is used instead.

Debug show that value of -0.1 was rejected because it is out of range.

Changed in libecbufr:
status: New → In Progress
importance: Undecided → Medium
assignee: nobody → vanh souvanlasy (vanh-souvanlasy)
Revision history for this message
vanh souvanlasy (vanh-souvanlasy) wrote :

Looks like the internal test of value range is done between a double and a float.
For a float -0.1 is stored as value=-0.100000001 and stored in a double as min=-0.10000000000000001
The double were used for the range and float was used for value to test.
Which fails the test: if ( (value>=min)&&(value<=max))
value is smaller than min

A simple solution would be to cast double to float before comparing the two values.

Changed in libecbufr:
status: In Progress → Fix Committed
Changed in libecbufr:
milestone: none → 0.8.5
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.