c++ - Signed Char ATAN2 and ATAN approximations -
c++ - Signed Char ATAN2 and ATAN approximations - basically, i've been trying create 2 approximation functions. in both cases input "x" , "y" components (to deal nasty n/0 , 0/0 conditions), , need signed char output. in atan2's case, should provide range of +/-pi, , in atan's case, range should +/- pi/2. i spent entire of yesterday trying wrap head around it. after playing around in excel find overall algorithm based on approximation: x * (pi/4 + 0.273 * (1 - |x|)) * 128/pi // scale factor @ end switch char format i came next code: signed char nabssc(signed char x) { if(x > 0) homecoming -x; homecoming x; } signed char signsc(signed char input, signed char ifzero = 0, signed char scalefactor = 1) { if(input > 0) {return scalefactor;} else if(input < 0) {return -scalefactor;} else {return ifzero;} } signed char divisionsc(signed char numerator, signed char denominator) { if(...