bug-gawk
[Top][All Lists]
Advanced

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

pos-pi or neg-pi ??


From: Jason C. Kwan
Subject: pos-pi or neg-pi ??
Date: Tue, 26 Apr 2022 21:45:06 +0000 (UTC)

apparently gawk can't even provide a consistent answer for a code this short : 
   
   - atan2( -x , -++x )   


square-root-of-pi is frequently needed in any sort of scientific computing, and 
this sign inconsistency would indeed be rather problematic since there isn't 
any built-in auto-complex-plane-switchover that i'm aware of for non-GMP side 
of gawk . 
furthermore, e^+pi / e^-pi differs by 2-and-a-half orders of magnitude, 
while sin() and tan() (actual tangent, not atan2()) results in sign flipping. 
The only thing consistent about atan2() is its level of inconsistency.

 gawk -e ' BEGIN {     printf("gawk -v ___=%c%s%c -%-*s :: atan2(-_,-++_) = 
%+.*f%c",                    ____=(__+=__+=__=!+___)^--__-\                     
                 __^__+--__,                                    ___, ____, __,  
                               ___, __^(__*=+__),                           
atan2(-_,-++_), ++__+__) }' 
   gawk -v ___='e' -e  :: atan2(-_,-++_) = -3.1415926535897931
——————————— —————————————— —————————— —————————————— ————————— 
 gawk -Me ' BEGIN {     printf("gawk -v ___=%c%s%c -%-*s :: atan2(-_,-++_) = 
%+.*f%c",                    ____=(__+=__+=__=!+___)^--__-\                     
                 __^__+--__,                                    ___, ____, __,  
                               ___, __^(__*=+__),                           
atan2(-_,-++_), ++__+__) }' 
   gawk -v ___='Me' -Me :: atan2(-_,-++_) = +3.1415926535897931
———————————————

% gawk -Me 'BEGIN { print (atan2(-log(1),-1)), (atan2(log(1),-1)); _="";  print 
atan2(-_,-++_), atan2(-!_--,--_); _="";  print atan2(-_,-++_), atan2(-!_--,--_) 
;  _="";  print atan2(-_,--_), atan2(-!_,+_) 
,atan2(!_,--_),atan2(-!_,-_),atan2(-!_,+_) ,atan2(+"-0",+"-1")   }'
-3.14159 3.141593.14159 3.141593.14159 3.141593.14159 3.14159 3.14159 0 3.14159 
3.14159
% gawk -e 'BEGIN { print (atan2(-log(1),-1)), (atan2(log(1),-1)); _="";  print 
atan2(-_,-++_), atan2(-!_--,--_); _="";  print atan2(-_,-++_), atan2(-!_--,--_) 
;  _="";  print atan2(-_,--_), atan2(-!_,+_) 
,atan2(!_,--_),atan2(-!_,-_),atan2(-!_,+_) ,atan2(+"-0",+"-1")   }' 
-3.14159 3.14159-3.14159 -3.14159-3.14159 -3.14159-3.14159 -3.14159 3.14159 0 
-3.14159 -3.14159

reply via email to

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