[Glass] Float asString question

James Foster james.foster at gemtalksystems.com
Sat Dec 28 21:21:49 PST 2013


Hi Sebastian,

This is an interesting subtle issue. It turns out that Jade evaluates the expression on the server (sending #’asFloat’ to an instance of String) and gets back an OOP. As a second step it decides what to do with the OOP. The Inspect (or Print It) command require a string representation. Since it is a special (an instance of SmallDouble is encoded entirely in the OOP) we don’t bother to go back to the server to send the #’printString’ method but instead send the message on the client. So, a SmallDouble gets unpacked as a Float in Dolphin and the #’printString’ message is evaluated by Dolphin to give the display format without the exponent. So, we aren’t using any GemStone code to convert the SmallDouble to a String! That is what leads to your confusion.

James

On Dec 27, 2013, at 4:17 PM, Sebastian Heidbrink <sebastian_heidbrink at yahoo.de> wrote:

> Hi,
> 
> I encounter some problems using NeoCSV on Gemstone.
> I importet float via CSV into Gemstone and now I want to export them again, but "asString" presents the float value in scientific format.
> 
> How come that '3.651666667' asFloat inspects with the same printString but asString wich calls asString returns: '3.6516666670000002E+00' this is just a small difference, but in my case it is too big since I need to do reprocessing in the client and that adds addtional issues...
> 
> '3.651666667' asFloat asStringUsingFormat: #(1 7 false)
> seems to work, but this makes me wonder which printString method the Inspector in Jade uses?
> 
> Thanks
> Sebastian
> _______________________________________________
> Glass mailing list
> Glass at lists.gemtalksystems.com
> http://lists.gemtalksystems.com/mailman/listinfo/glass



More information about the Glass mailing list