< Previous by Date Date Index Next by Date >
< Previous in Thread Thread Index  

Re: [reSIProcate] test cases failing?



Actually, all of the below is a red herring

The bottom line is that if we need precise decimal comparisons, double
is the wrong data type.

I've revised the test case to be tolerant of double values that are very
similar.  There are more elaborate ways to implement this comparison
too, see AlmostEquals:

http://code.google.com/p/googletest/source/browse/trunk/include/gtest/internal/gtest-internal.h

and others like AlmostEqual2sComplement exist

For me, that is enough to verify that the function Data::convertDouble()
does a reasonable job, however, this does not imply that every use of
this function is a correct use of the double datatype.

On 28/02/13 20:43, Scott Godin wrote:
> I don't recall the compilers that had issues with it.  I did find this old
> note from an IM session with Daniel a while back:
> 
> me: for the double issue - if you place a L after the float constant (ie.
> 12.12L) then it passed the assert on my Ubuntu system (g++ 4.6.1) and on
> windows
> 1:45 PM but apparently it had issues on Mac, and maybe on other OS's - if
> we could craft an appropriate #ifdef then that might be a good solution
>   I don't understand what factor triggers the problem in order to craft the
> #ifdef
> 1:46 PM We could start with something reasonable and ask people to add
> cases to it appropriately
>   Byron thought it was related to the -ffast-math opt flag
>   with some platforms - but we didn't have success trying to change it
> Scott
> 
> On Thu, Feb 28, 2013 at 10:21 AM, Alan Partis <alpartis@xxxxxxxxxxxxxx>wrote:
> 
>> On Thu, 28 Feb 2013, Scott Godin wrote:
>>
>>> I remember this being a compiler specific issue with float rounding.
>>>  The stacks main use of floats is for q-value headers, so
>>> high precision is not an issue.
>>
>> Do you know what compiler?  I would be running gcc 4.6.3 (at the moment
>> anyway).
>>
>>
>> _______________________________________________________
>> Alan Partis
>> thundernet development group
>>
>