what is the relationship between Float and its subclasses?
Hi I'm updating Pharo by example and the relationship between Float and its subclasses is unclear to me. Do we only get instances of the subclasses now? I got that Boxed is only for 64 bits. But SmallFloat? The class comment is not really self describing. Stef
SmallFloat is like SmallInteger: immediate value encoded in oop, and it is only for 64 bits Spur VM. Boxed is the classical VM Float, two 4-bytes word allocated per Float, and is both for 32 bits VM and Float values not fitting in immediate format (3 bits have been stolen from exponent...). 2016-02-01 20:49 GMT+01:00 stepharo <stepharo@free.fr>:
Hi
I'm updating Pharo by example and the relationship between Float and its subclasses is unclear to me. Do we only get instances of the subclasses now?
I got that Boxed is only for 64 bits. But SmallFloat? The class comment is not really self describing.
Stef
Tx nicolas I read SmallFloat64: My instances represent 64-bit Floats whose exponent fits in 8 bits as immediate objects. This representation is only available on 64-bit systems, not 32-bit systems. BoxedFloat64: My instances hold 64-bit Floats in heap objects. This is the only representation on 32-bit systems. But on 64-bit systems SmallFloat64 holds a subset of the full 64-bit double-precision range in immediate objects. I think that we can improve such comments but I do not have the knowledge. So do I get that we will have instances of Float and BoxedFloat64? Le 1/2/16 21:27, Nicolas Cellier a écrit :
SmallFloat is like SmallInteger: immediate value encoded in oop, and it is only for 64 bits Spur VM. Boxed is the classical VM Float, two 4-bytes word allocated per Float, and is both for 32 bits VM and Float values not fitting in immediate format (3 bits have been stolen from exponent...).
2016-02-01 20:49 GMT+01:00 stepharo <stepharo@free.fr <mailto:stepharo@free.fr>>:
Hi
I'm updating Pharo by example and the relationship between Float and its subclasses is unclear to me. Do we only get instances of the subclasses now?
I got that Boxed is only for 64 bits. But SmallFloat? The class comment is not really self describing.
Stef
Stef, in 32-bit Spur there are only BoxedFloat64 instances. In 64-bit Spur there are (already) both BoxedFloat64 instances and SmallFloat64 immediates. In 64-but Spur, if a float's exponent is in the middle 8 bit range of the 11-bit double precision exponent range it is represented as a SmallFloat64 immediate and occupies no space except the slot referencing it, just as with SmallInteger. There is good documentation of the scheme in VMMaker.oscog. When time allows I'll write more informative class comments, but look at the SmallInteger comment, that's not detailed either. _,,,^..^,,,_ (phone)
On Feb 1, 2016, at 11:00 PM, stepharo <stepharo@free.fr> wrote:
Tx nicolas
I read
SmallFloat64: My instances represent 64-bit Floats whose exponent fits in 8 bits as immediate objects. This representation is only available on 64-bit systems, not 32-bit systems.
BoxedFloat64: My instances hold 64-bit Floats in heap objects. This is the only representation on 32-bit systems. But on 64-bit systems SmallFloat64 holds a subset of the full 64-bit double-precision range in immediate objects.
I think that we can improve such comments but I do not have the knowledge.
So do I get that we will have instances of Float and BoxedFloat64?
Le 1/2/16 21:27, Nicolas Cellier a écrit :
SmallFloat is like SmallInteger: immediate value encoded in oop, and it is only for 64 bits Spur VM. Boxed is the classical VM Float, two 4-bytes word allocated per Float, and is both for 32 bits VM and Float values not fitting in immediate format (3 bits have been stolen from exponent...).
2016-02-01 20:49 GMT+01:00 stepharo <stepharo@free.fr>:
Hi
I'm updating Pharo by example and the relationship between Float and its subclasses is unclear to me. Do we only get instances of the subclasses now?
I got that Boxed is only for 64 bits. But SmallFloat? The class comment is not really self describing.
Stef
What about something like that My instances hold 64-bit Floats in heap objects. This is the only representation on 32-bit systems. But on 64-bit systems SmallFloat64 holds a subset of the full 64-bit double-precision range in immediate objects. BoxedFloat64 is the classical VM Float, two 4-bytes word allocated per Float, and is both for 32 bits VM and Float values not fitting in immediate format. This is because 3 bits have been removed from the exponent due to the object internal representation needed for the Spur new garbage collector. So on a 32 bits VM Floats are represented either by BoxedFloat64 or Float.
Hi Stef,
On Feb 1, 2016, at 11:03 PM, stepharo <stepharo@free.fr> wrote:
What about something like that
My instances hold 64-bit Floats in heap objects. This is the only representation on 32-bit systems. But on 64-bit systems SmallFloat64 holds a subset of the full 64-bit double-precision range in immediate objects.
BoxedFloat64 is the classical VM Float, two 4-bytes word allocated per Float, and is both for 32 bits VM and Float values not fitting in immediate format. This is because 3 bits have been removed from the exponent due to the object internal representation needed for the Spur new garbage collector.
So on a 32 bits VM Floats are represented either by BoxedFloat64 or Float.
No. Float is now an abstract class. There are only instances of BoxedFloat64 or SmallFloat64. And in 32-bits there are only BoxedFloat64 instances. So on a 32 bits VM Floats are represented only by BoxedFloat64. On a 64 bits VM Floats are represented either by BoxedFloat64 or SmallFloat64.
participants (3)
-
Eliot Miranda -
Nicolas Cellier -
stepharo