Complex arg-trig functions

Steve Kargl sgk at troutmask.apl.washington.edu
Mon Aug 13 20:16:32 UTC 2012


On Mon, Aug 13, 2012 at 02:41:59PM -0500, Stephen Montgomery-Smith wrote:
> 
> Also, you made the comment that in the float version, all the 0.5 should 
> become 0.5F.  Two questions:
> 1.  Doesn't the compiler do this conversion for me?

float x, y;
y = 0.5 * x;

The conversion is effectively 'y = 0.5 * (double)x' where
now the rhs is evaluated in double (53-bit precision).  If
you have 'y = 0.5f * x', then the rhs side is evaluate
in float (24-bit precision).  For a more complicated,
expression whether one computes in 53 rather than 24 bits
can have an effect on the outcome.

-- 
Steve


More information about the freebsd-numerics mailing list