[futurebasic] Re: [FB] re: USING bug with -0.000 input

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : June 2011 : Group Archive : Group : All Groups

From: Walter Lenk <Walter_Lenk@...>
Date: Tue, 7 Jun 2011 12:25:32 -0400
Robert P wrote:
>  In the IEEE754 standard -0.0 is required to compare equal to 0.0.
>  Thus your workaround for the FB5 formatter bug could be written in 
>the strange-looking but effective form:
>      if ( result2 == 0.0 ) then result2 = 0.0 // change -0.0 to 0.0

Yes

>  The correct fix for build_goodies/General.c: PSusing() is
>      if ( copysign( 1.0, n ) < 0.0 )
>        {  ...  }
>  and this will be in the next release.

Thanks.

>  Can I ask how your program comes to encounter -0.0? AFAIK, signed zero
>  is useful only in the context of complex arithmetic, where it allows
>  branch cuts to be handled.

One of my projects uses a twin infrared camera device to record a 
subject's motion. The X and Y data outputs from the two cameras, 
along with some calibration constants, are used to calculate the Z 
data. The -0.00 figure arrived from the manufacturer in a sample 
sheet of calibration constants. I have to store this data in the data 
file for later processing, and the -0.00 figure caused a hiccup in my 
data storage routine.

Best,

  Walter

-- 

===========================================
Walter Lenk    Cambridge Ma    617-547-7781
===========================================