#FEATURE by cg
authorClaus Gittinger <cg@exept.de>
Sat, 05 May 2018 22:55:31 +0200
changeset 22727 c5c0850734f3
parent 22726 5e76d6588adc
child 22728 971b3721fa66
#FEATURE by cg class: Number added: #arcTan:
Number.st
--- a/Number.st	Sat May 05 22:50:07 2018 +0200
+++ b/Number.st	Sat May 05 22:55:31 2018 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1988 by Claus Gittinger
 	      All Rights Reserved
@@ -932,6 +934,8 @@
 ! !
 
 
+
+
 !Number methodsFor:'Compatibility-Squeak'!
 
 asSmallAngleDegrees
@@ -3151,6 +3155,30 @@
     "Modified: / 05-07-2017 / 17:26:16 / cg"
 !
 
+arcTan:denominator
+    "Evaluate the four quadrant arc tangent of the argument denominator (x) and the receiver (y)."
+
+    |t|
+    
+    (self isZero) ifTrue: [
+        (denominator strictlyPositive)
+            ifTrue: [ ^ 0 ]
+            ifFalse: [ ^ self class pi ]
+    ].
+    (denominator isZero) ifTrue: [
+        (self strictlyPositive)
+            ifTrue: [ ^ self class halfpi ]
+            ifFalse: [ ^ self class halfpiNegative ]
+    ].
+    t := (self / denominator) arcTan.
+    (denominator strictlyPositive)
+        ifTrue: [ ^ t ]
+        ifFalse: [ ^ t + self class pi ]
+
+    "Created: / 07-06-2007 / 21:10:32 / cg"
+    "Modified: / 11-06-2007 / 12:58:34 / cg"
+!
+
 arcTanh
     "return the inverse hyperbolic tangent of the receiver."
     "caveat: misnomer; should be called aTanh or arTanh"