Changes to Trunk (
http://source.squeak.org/trunk.html) in the last 24 hours:
http://lists.squeakfoundation.org/pipermail/packages/2010-October/003866.htmlName: KernelTests-nice.167
Ancestors: KernelTests-nice.166
Assert that #degreeCos and #degreeSin are exact for any multiple of 90.
This is a nice property to have that radianCos and radianSin cannot afford due to approximate floating point representation of pi.
=============================================
http://lists.squeakfoundation.org/pipermail/packages/2010-October/003867.htmlName: Kernel-nice.510
Ancestors: Kernel-ul.509
Provide an implementation of #degreeCos and #degreeSin such that results are exact for any multiple of 90.
Care is also taken to evaluate the sine between -90° and 90°, this will avoid #degreesToRadians and i386 FPU sine fonction to accumulate round off errors due to approximate representation of pi.
We can thus evaluate 240 degreeCos with at most 1 ulp error. It's not perfect, but better than previous implementation.
For cosine, we know that:
cosd(x)=cosd(abs(x))
cosd(x)=sind(90-x)
thus the trick is to evaluate:
cosd(x)=sind(90-abs(x)) after appropriate modulo in [-180,180[
This way, we are sure to evaluate the sine between -90° and 90°
The #degreesToRadians and #sin are used rather than #degreeSin to avoid cycles.
For sine, it would be necessary to evaluate either
sind(x) if abs(x) <=90
or sind(180-x) if abs(x) >= 90
A possible implementation would be:
| x |
x := 90 + self \\ 360 - 90.
x >= 180 ifTrue: [x := 180 - x].
^x degreesToRadians sin
We prefer evaluating cosd(90-x) thus providing a branch free implementation.
=============================================
http://lists.squeakfoundation.org/pipermail/packages/2010-October/003868.htmlName: Collections-ul.398
Ancestors: Collections-ar.397
- restore the behavior of the old finalization scheme
=============================================
http://lists.squeakfoundation.org/pipermail/packages/2010-October/003869.htmlName: Collections-ul.399
Ancestors: Collections-ul.398
- added a postscript to apply the changes
=============================================