# [Pkg] The Trunk: Kernel-nice.572.mcz

commits at source.squeak.org commits at source.squeak.org
Sat Apr 23 02:12:40 UTC 2011

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

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

Name: Kernel-nice.572
Author: nice
Time: 23 April 2011, 4:11:47.274 am
UUID: 83be5282-f6ca-43d4-a8c9-6618feeb883e
Ancestors: Kernel-nice.571

Correct Complex arcSin and arcCos
Let (1 arTanh) return inf

=============== Diff against Kernel-nice.571 ===============

Item was changed:
----- Method: Complex>>arcCos (in category 'mathematical functions') -----
arcCos
This is the inverse function of cos."

| x y tmp sh2y shy delta ch2y chy |
imaginary = 0 ifTrue: [real abs > 1
ifTrue:
[x := real < 0
ifTrue: [Float pi]
ifFalse: [0].
y := real abs arCosh.
^self class real: x imaginary: y]
ifFalse: [^self class real: real arcCos imaginary: 0]].
tmp := self squaredNorm - 1 / 2.
delta := tmp squared + imaginary squared.
sh2y := tmp + delta sqrt.
shy := sh2y sqrt.
ch2y := 1 + sh2y.
chy := ch2y sqrt.
y := imaginary copySignTo: shy arSinh.
x := (real / chy) arcCos.
+ 	^self class real: x imaginary: y negated!
- 	^self class real: x imaginary: y!

Item was changed:
----- Method: Complex>>arcSin (in category 'mathematical functions') -----
arcSin
This is the inverse function of sin."

| x y tmp delta sh2y shy ch2y chy |
imaginary = 0
ifTrue:
[real abs > 1
ifTrue:
[x := Float pi / 2 * real sign.
y := real abs arCosh * real sign.
^self class real: x imaginary: y]
+ 				ifFalse: [^self class real: real arcSin imaginary: 0]].
- 				ifFalse: [^self class real arcSin imaginary: 0]].
tmp := (self squaredNorm - 1) / 2.
delta := tmp squared + imaginary squared.
sh2y := tmp + delta sqrt.
shy := sh2y sqrt.
ch2y := 1 + sh2y.
chy := ch2y sqrt.
y := imaginary copySignTo: shy arSinh.
x := (real / chy) arcSin.
^self class real: x imaginary: y!

Item was changed:
----- Method: Float>>arTanh (in category 'mathematical functions') -----
arTanh
That is the inverse function of tanh."

self = 0.0 ifTrue: [^self].	"Handle negativeZero"
+ 	self abs = 1 ifTrue: [^self copySignTo: Float infinity].
+ 	self abs > 1
- 	self abs >= 1
ifTrue:
+ 			[^DomainError signal: 'Receiver must be between 1.0 and -1.0'].
- 			[^DomainError signal: 'Receiver must be strictly between 1.0 and -1.0'].
^((1 + self) / (1 - self)) ln / 2!

```