On Feb 17 2014 8:51 AM, Michael Haberler wrote:
> Am 17.02.2014 um 14:48 schrieb Jeff Epler <[email protected]>:
>
>>>  N..... SET_G92_OFFSET(-0.1000, -0.2000, -10.3000, 0.0000, 0.0000, 
>>> 0.0000)
>> ..
>>> - N..... MESSAGE(" X0.000000 Y0.000000 Z-10.000000")
>>> + N..... MESSAGE(" X-0.000000 Y0.000000 Z-10.000000")
>>
>> Is the value really 0.0 or is it -0.0?  These are distinct values in
>> IEEE floating-point arithmetic.  If either of them is printed wrong,
>> then that's a libc bug.  Otherwise, my second guess would be that 
>> damned
>> -ffast-math compiler flag, which enables 
>> -funsafe-math-optimizations,
>> which enables -fassociative-math, which "may change the sign of 
>> zero".
>> Third guess, they're distinct nonzero numbers with the significant
>> figures past the printed decimal digits.
>>
>> I didn't look closely at the test, but maybe it could be papered 
>> over by
>> ensuring that all the coordinates are expected to be nonzero in that
>> message.  If it's the third case, then choosing numbers that are 
>> exact
>> floating-point values might help (e.g., not -0.1, but -0.125 which 
>> is a
>> binary fraction)
>
> Proposal:
>
> The interpreter considers values closer than TOLERANCE_EQUAL to be
> identical anyway, see interp_internal.hh:
>
>> #define TOLERANCE_EQUAL 0.0001 /* two numbers compare EQ if the
>>                                   difference is less than this */
>>
>
> therefore I would think treating values from
> -TOLERANCE_EQUAL..TOLERANCE_EQUAL as 0.0 would be ok, and that would
> take care of the issue for good

I was thinking the same thing, but I typically use "abs(val - target) < 
eps".  This might be a couple of extra assembly instructions, but is 
predictable.  Also, there have been a few times I had to write an abs 
macro as I did not want to include libmath...

   EBo --

------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to