Chapter 5 - Floating-Point Support

You can access 64-bit double precision floating-point values from within Smalltalk. To get this ability you must:

Floating-point arithmetic support is only available on PalmOS 2.0 (and more recent) devices. PalmOS 1.0 devices (i.e., the Pilot 1000 and 5000) do not support double precision floating point.

The package 'double.st' adds methods to the built-in Double class to support floating-point operations. It also adds some methods to other number classes to implement Smalltalk's double dispatching arithmetic rules. You can therefore freely intermix Doubles with other numeric types in arithmetic expressions.

Note that you must have the MathLib shared library installed on your Pilot in order to use the floating-point math routines. If the library is not installed, you will get an error message when you try to start your Pilot program. If you distribute a program that requires floating-point support, you should therefore include MathLib.prc in your distribution.

To save space, special operations such as #cos (cosine) are implemented only in class Double and not in other Number classes. If you plan to use such functions, you should send #asDouble to the receiver first.


Andrew Brault (ajb@tiac.net)