Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Aug 2012 13:16:26 -0700
From:      Steve Kargl <sgk@troutmask.apl.washington.edu>
To:        Stephen Montgomery-Smith <stephen@missouri.edu>
Cc:        freebsd-numerics@freebsd.org, Bruce Evans <brde@optusnet.com.au>
Subject:   Re: Complex arg-trig functions
Message-ID:  <20120813201626.GA54144@troutmask.apl.washington.edu>
In-Reply-To: <50295887.2010608@missouri.edu>
References:  <20120805030609.R3101@besplex.bde.org> <501D9C36.2040207@missouri.edu> <20120805175106.X3574@besplex.bde.org> <501EC015.3000808@missouri.edu> <20120805191954.GA50379@troutmask.apl.washington.edu> <20120807205725.GA10572@server.rulingia.com> <20120809025220.N4114@besplex.bde.org> <5027F07E.9060409@missouri.edu> <20120814003614.H3692@besplex.bde.org> <50295887.2010608@missouri.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120813201626.GA54144>