Complex arg-trig functions

Stephen Montgomery-Smith stephen at missouri.edu
Mon Aug 13 20:59:45 UTC 2012


On 08/13/2012 03:39 PM, Stephen Montgomery-Smith wrote:
> On 08/13/2012 03:16 PM, Steve Kargl wrote:
>> 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.
>>
>
>
> Thanks for the clarification.
>
> I made the changes in catrigf.c adding "F"s as needed.

It shaved 5% of the computation time on my system (which means that the 
float versions are still slower than the double versions.

To do hundred million casinh's

double: about 18s.
float (new): about 19s.
float (old): about 20s.



More information about the freebsd-numerics mailing list