Plan 9 from Bell Labs’s /usr/web/sources/contrib/fgb/root/sys/src/cmd/4th/examples/demo/atan2tst.4th

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


include lib/ansfloat.4th
include lib/fatan2.4th

fclear
10 set-precision

-1 s>f  1 s>f fatan2 f. cr             \ -0.785398163397448  ok
-1 s>f  0 s>f fatan2 f. cr             \ -1.5707963267949  ok
-1 s>f -1 s>f fatan2 f. cr             \ -2.35619449019234  ok 

\ If y is +/-0 and x is < 0, +/-pi shall be returned.
 0 s>f -1 s>f fatan2 f. cr
\ If y is +/-0 and x is > 0, +/-0 shall be returned.
 0 s>f  1 s>f fatan2 f. cr
\ If y is < 0 and x is +/-0, -pi/2 shall be returned.
-1 s>f  0 s>f fatan2 f. cr
\ If y is > 0 and x is +/-0, pi/2 shall be returned.
 1 s>f  0 s>f fatan2 f. cr

\ Optional specs:

\ If y is +/-0 and x is +0, +/-0 shall be returned.
0 s>f 0 s>f fatan2 f. cr



Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].