[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
- Re: Apple atan2f, Rik, 2010/11/10
- Re: Apple atan2f, Michael D Godfrey, 2010/11/11
- Re: Apple atan2f, Ben Abbott, 2010/11/11
- Re: Apple atan2f, Michael D Godfrey, 2010/11/11
- Re: Apple atan2f, Jarno Rajahalme, 2010/11/11
- Re: Apple atan2f, Michael D. Godfrey, 2010/11/11
- Re: Apple atan2f, Rik, 2010/11/16
- Re: Apple atan2f,
Ben Abbott <=
- Re: Apple atan2f, Jordi GutiƩrrez Hermoso, 2010/11/16
- Re: Apple atan2f, Ben Abbott, 2010/11/16
- Re: Apple atan2f, Jarno Rajahalme, 2010/11/17