--- a/Float.st Mon Jun 16 20:48:51 2003 +0200
+++ b/Float.st Tue Jun 17 10:42:42 2003 +0200
@@ -145,10 +145,19 @@
documentation
"
- Floats represent rational numbers with limited precision. In ST/X, Float uses
- the underlying C-compilers double implementation, therefore instances of Float
- are usually represented by the 8-byte IEEE double precision float format.
- (but there is no guaranty).
+ ShortFloats represent rational numbers with limited precision.
+ They use the C-compilers 'double' format, which is usually the 8byte IEE double float format.
+
+ Floats give you 64 bit floats.
+ In contrast to ShortFloats and LongFloats.
+
+ WARNING:
+ The layout of Float instances is known by the runtime system and the compiler;
+ you may not add instance variables here.
+ Also, subclassing is complicated by the fact, that the VM creates floats/shortFloats,
+ and does some float-checks by an identity compare with the Float-class.
+ (i.e. your subclasses instances may not be recognized as float-like objects,
+ thus mixed mode arithmetic will always coerce them, effectively slowing things down).
Notice, that Floats are defined as Byte-array to prevent the garbage collector
from going into the value ... otherwise I needed a special case in many places.
@@ -160,36 +169,30 @@
implementations
(ParcPlace uses a 4-byte Float and an 8-byte Double class, in contrast to
Digitalk, which has an 8-byte Float class).
- Thus, by providing an 8-byte Float class, code would not loose precicion (although some memory
- is wasten when porting from VW).
+ Thus, by providing an 8-byte Float class, code would not loose precicion
+ (although some memory is wasted when porting from VW).
As Digitalk is dead now, things could (should) now be made to be compatible with VW.
Notice that ST/X provides an alias called Double, and an extra ShortFloat class, which has 4-byte
instances.
- WARNING:
- The layout of float instances is known by the runtime system and the compiler;
- you may not add instance variables here.
-
- Also, subclassing is complicated by the fact, that the VM creates floats as results
- of arithmetic operations (even if the operands are subclass-instances).
- However, the VM does the float-check by probing a bit in the classes flag instVar; therefore,
- even subclass instances can be handled by the VMs float handling code.
-
Mixed mode arithmetic:
float op float -> float
float op fix -> float
+ float op fraction -> float
float op integer -> float
- float op float -> float
+ float op shortFloat -> float
+ float op longFloat -> longFloat
+ float op complex -> complex
[Class Variables:]
+ [author:]
+ Claus Gittinger
+
[see also:]
Number
- ShortFloat Fraction FixedPoint Integer
+ ShortFloat LongFloat Fraction FixedPoint Integer Complex
FloatArray DoubleArray
-
- [author:]
- Claus Gittinger
"
!
@@ -2270,7 +2273,7 @@
!Float class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Float.st,v 1.134 2003-06-16 15:06:11 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Float.st,v 1.135 2003-06-17 08:41:28 cg Exp $'
! !
Float initialize!