tech-userlevel archive

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

Re: signed overflow in atan2



    Date:        Wed, 7 Mar 2018 14:00:44 +0100
    From:        Joerg Sonnenberger <joerg%bec.de@localhost>
    Message-ID:  <20180307130044.GB24985%britannica.bec.de@localhost>

  | This is a transformation typically done already.

I thought it might be with modern compilers - but it probably was not when 
atan2() was originally written,   But demonstrating that cannot hurt.

And if we want to be more sure then perhaps:

	if(((hx^0x3ff00000)|lx)==0) return atan(y);   /* x=1.0 */

would be a suitable replacement (probably formatted in a more KNF compat 
way...)

kre



Home | Main Index | Thread Index | Old Index