The Trunk: Kernel-nice.283.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Kernel-nice.283.mcz

commits-2
Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-nice.283.mcz

==================== Summary ====================

Name: Kernel-nice.283
Author: nice
Time: 30 October 2009, 10:32:03 am
UUID: 5180827b-8f52-4516-af31-271e133a385a
Ancestors: Kernel-nice.282

Make #arcTan: behave as libm atan2 near zero and negativeZero

=============== Diff against Kernel-nice.282 ===============

Item was changed:
  ----- Method: Float>>arcTan: (in category 'mathematical functions') -----
  arcTan: denominator
  "Answer the angle in radians.
+ Optional. See Object documentation whatIsAPrimitive.
+ Implementation note: use sign in order to catch cases of negativeZero"
- Optional. See Object documentation whatIsAPrimitive."
-
- | result |
 
+ ^self = 0.0
+ ifTrue: [denominator sign >= 0
+ ifTrue: [ 0 ]
+ ifFalse: [ self sign >= 0
+ ifTrue: [ Pi ]
+ ifFalse: [ Pi negated ]]]
+ ifFalse: [denominator = 0.0
+ ifTrue: [self > 0.0
+ ifTrue: [ Halfpi ]
+ ifFalse: [ Halfpi negated ]]
+ ifFalse: [denominator > 0
+ ifTrue: [ (self / denominator) arcTan ]
+ ifFalse: [self > 0
+ ifTrue: [ ((self / denominator) arcTan) + Pi ]
+ ifFalse: [ ((self / denominator) arcTan) - Pi ]]]]!
- (self = 0.0) ifTrue: [ (denominator > 0.0) ifTrue: [ result := 0 ]
-    ifFalse: [ result := Pi ]
- ]
-    ifFalse: [(denominator = 0.0)
- ifTrue: [ (self > 0.0) ifTrue: [ result := Halfpi ]
- ifFalse: [ result := Halfpi negated ]
- ]
- ifFalse: [ (denominator > 0) ifTrue: [ result := (self / denominator) arcTan ]
- ifFalse: [ (self > 0) ifTrue: [result := ((self / denominator) arcTan) + Pi ]
- ifFalse: [result := ((self / denominator) arcTan) - Pi]
- ]
- ].
- ].
-
- ^ result.!