A new version of Kernel was added to project The Inbox:
http://source.squeak.org/inbox/Kernel-ul.530.mcz ==================== Summary ==================== Name: Kernel-ul.530 Author: ul Time: 25 December 2010, 4:55:27.167 am UUID: aa46581d-c74f-7a48-b604-6371b5b21730 Ancestors: Kernel-ar.529 - fix: reverted Float >> #arcTan: and added the primitive to that version, because it contained a bugfix. See FloatTest >> #testArcTan. - use #isInfinite for infinity checking in Float >> #sin and Float >> #cos =============== Diff against Kernel-ar.529 =============== 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 | <primitive: 'primitiveArcTan2' module: 'FloatMathPlugin'> + self isNaN ifTrue:[ + SignalNaN ifTrue:[ NaNError signal ]. + ^self]. + denominator isNaN ifTrue:[ + SignalNaN ifTrue: [ NaNError signal ]. + ^denominator ]. + ^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 isNaN ifTrue:[SignalNaN ifTrue:[NaNError signal]. ^self]. - denominator isNaN ifTrue:[SignalNaN ifTrue:[NaNError signal]. ^denominator]. - (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: [ result := ((self / denominator) arcTan) + Pi ] - ]. - ]. - ^ result.! Item was changed: ----- Method: Float>>cos (in category 'mathematical functions') ----- cos "Answer the cosine of the receiver taken as an angle in radians." <primitive: 'primitiveCos' module: 'FloatMathPlugin'> self isNaN ifTrue:[SignalNaN ifTrue:[NaNError signal]. ^self]. + self isInfinite ifTrue:[^self error: 'cos is undefined for Infinity']. - self abs = Float infinity ifTrue:[^self error: 'cos is undefined for Infinity']. ^ (self + Halfpi) sin! Item was changed: ----- Method: Float>>sin (in category 'mathematical functions') ----- sin "Answer the sine of the receiver taken as an angle in radians. Optional. See Object documentation whatIsAPrimitive." <primitive: 'primitiveSin' module: 'FloatMathPlugin'> self isNaN ifTrue:[SignalNaN ifTrue:[NaNError signal]. ^self]. + self isInfinite ifTrue:[^self error: 'sin is undefined for Infinity']. - self abs = Float infinity ifTrue:[^self error: 'sin is undefined for Infinity']. ^self primitiveSin! |
Free forum by Nabble | Edit this page |