[Vm-dev] [VM-dev] How serialize/materialize SmallFloat64?

Eliot Miranda eliot.miranda at gmail.com
Wed Apr 12 18:17:59 UTC 2017


> On Apr 12, 2017, at 8:42 AM, Bert Freudenberg <bert at freudenbergs.de> wrote:
> 
>> On Wed, Apr 12, 2017 at 5:25 PM, Denis Kudriashov <dionisiydk at gmail.com> wrote:
>>  
>> I tested my serialization library on 64bits image and tests for floats are failed. 
>> For boxed floats I use #basicNew. And SmallFloat signal error 'SmallFloat64s can only be created by performing arithmetic'
>> 
>> So question how implement smallfloat serialization/materialization ?
> 
> SmallFloats still support word access via basicAt:
> 
> | a x y |
> x := 0.5.
> a := {x at: 1. x at: 2}.
> y := BoxedFloat64 new.
> y at: 1 put: (a at: 1).
> y at: 2 put: (a at: 2).
> y := y * 1.0.
> {x. x class. a. y. y class} {0.5 . SmallFloat64 . #(1071644672 0) . 0.5 . SmallFloat64}
> 
> So to serialize you just use the words. And to deserialize you just create a BoxedFloat. If you want to normalize the boxed float you do some arithmetic operation on it. But boxed floats work fine for any value, it's just a space optimization.

and time ;-)

> - Bert -
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20170412/3ba741f6/attachment.html>


More information about the Vm-dev mailing list