<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><br></div><div>On Apr 12, 2017, at 8:42 AM, Bert Freudenberg <<a href="mailto:bert@freudenbergs.de">bert@freudenbergs.de</a>> wrote:<br><br></div><blockquote type="cite"><div><span></span></div></blockquote><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Apr 12, 2017 at 5:25 PM, Denis Kudriashov <span dir="ltr"><<a href="mailto:dionisiydk@gmail.com" target="_blank">dionisiydk@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <br><div dir="ltr"><div>I tested my serialization library on 64bits image and tests for floats are failed. </div><div>For boxed floats I use #basicNew. And SmallFloat signal error 'SmallFloat64s can only be created by performing arithmetic'</div><div><br></div><div>So question how implement smallfloat serialization/materialization ?</div><div></div></div></blockquote></div><br></div><div class="gmail_extra">SmallFloats still support word access via basicAt:</div><div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_extra">| a x y |</div><div class="gmail_extra">x := 0.5.</div><div class="gmail_extra">a := {x at: 1. x at: 2}.</div><div class="gmail_extra">y := BoxedFloat64 new.</div><div class="gmail_extra">y at: 1 put: (a at: 1).</div><div class="gmail_extra">y at: 2 put: (a at: 2).</div><div class="gmail_extra">y := y * 1.0.</div><div class="gmail_extra">{x. x class. a. y. y class} {0.5 . SmallFloat64 . #(1071644672 0) . 0.5 . SmallFloat64}</div><div class="gmail_extra"><br></div><div class="gmail_extra">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.</div></div></div></div></blockquote><div><br></div>and time ;-)<div><br><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><div class="gmail_extra">- Bert -</div></div></div>
</blockquote></div></body></html>