octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Apple atan2f


From: Ben Abbott
Subject: Re: Apple atan2f
Date: Tue, 16 Nov 2010 17:29:58 -0600

On Nov 16, 2010, at 1:29 PM, Rik wrote:

> 
> Companion Program and Testing:
> C99 allows the rounding rules for the IEEE-754 representation function to
> be queried and set by the programmer.  I used this to examine the behavior
> of glibc under different rounding rules.  Since Apple's atan2f function
> uses truncation rounding, it should be possible to set all of the math
> library functions to use truncation rounding in which case there will be
> only one representation of pi and their bug will disappear.  It is
> interesting to note that glibc does not get atan2f correct either.  They
> always use round-to-nearest which works only when the default rounding
> rules are in effect.
> 
> Optimizing compilers will interfere with this test since they can detect
> constant expressions and substitute return values at compile time.  I work
> around this by having the user enter the number "0.0" and then do all of my
> calculations as "number + user_input".  This forces the evaluation to be
> done at run-time by the math libraries.  For good measure I also compiled
> without optimizations and forced g++ not to use substitutions.  My
> compilation line was:
> 
> g++ -O0 -frounding-math -std=c++0x    rndtst.cpp   -o rndtst
> 

Using Apple's compiler (gcc 4.2.1 with their patches) I get the error below.

$ g++ -O0 -frounding-math -std=c++0x    rndtst.cpp   -o rndtst
cc1plus: error: unrecognized command line option "-std=c++0x"

Ben




reply via email to

[Prev in Thread] Current Thread [Next in Thread]