Terrible WTF or I am too tired? note the +02 and the +00 ...
_______________________________________________ Glass mailing list [hidden email] http://lists.gemtalksystems.com/mailman/listinfo/glass |
On 05/02/2014 03:18 PM, Mariano Martinez Peck wrote:
> Terrible WTF or I am too tired? note the +02 and the +00 ... > It's best to avoid putting a $+ in front of a float's exponent. The ANSI Smalltalk standard says that this is supposed to be illegal. Various Smalltalks do different things with it. The results I get: GemStone/S 64-bit 3.2 7.3470570000000009E02 VW 7.10 7.34706 Pharo 3.0 (pre-release) 7.347057 VA Smalltalk 8.6 7 (asNumber is defined to answer a SmallInteger in VA) If I omit the $+, and make the E to be lowercase e instead (ANSI also only recognizes e, d, and q, not the uppercase varieties), I get: '7.3470570000000004e02' asNumber GemStone 7.3470570000000009E02 VW 734.706 Pharo 734.7057000000001 Regards, -Martin _______________________________________________ Glass mailing list [hidden email] http://lists.gemtalksystems.com/mailman/listinfo/glass |
In reply to this post by Mariano Martinez Peck
[stupid gmail] ... in addition to the response below, I've submitted a bug report[1] on this issue. Dale[1] https://github.com/glassdb/glass/issues/20 ---------- Forwarded message ---------- From: Dale Henrichs <[hidden email]> Date: Fri, May 2, 2014 at 3:42 PM Subject: Re: [Glass] '7.3470570000000004E+02' asNumber -> 7.3470570000000004E+00 To: Mariano Martinez Peck <[hidden email]> Not that this is a solution, but in pharo, you get the same answer as GemStone (i.e., the exponent is ignored).... #asNumber is based on a port of SqNumberParser, so that "makes sense." This form of the printString produces the expected answer:'7.3470570000000004e02' asNumber. SqNumberParser>>exponentLetters controls the list of exponents expected and could be modified to include capital letters ... Dale On Fri, May 2, 2014 at 3:18 PM, Mariano Martinez Peck <[hidden email]> wrote:
_______________________________________________ Glass mailing list [hidden email] http://lists.gemtalksystems.com/mailman/listinfo/glass |
Thank you very much guys. Tomorrow I send a detailed thanks but just to confirm that implementing: SqNumberParser class >> on: aStringOrStream ^ExtendedNumberParser new on: aStringOrStream
SqNumberParser >> exponentLetters "answer the list of possible exponents for Numbers. Note: this parser will not honour precision attached to the exponent.
different exponent do not lead to different precisions. only IEEE 754 floating point numbers will be created"
^'edqEDQ' Does solve the problem. I could now import my sixx data. Thanks!!!
On Fri, May 2, 2014 at 7:48 PM, Dale Henrichs <[hidden email]> wrote:
Mariano http://marianopeck.wordpress.com _______________________________________________ Glass mailing list [hidden email] http://lists.gemtalksystems.com/mailman/listinfo/glass |
I confirmed that it does fix the asNumber problem: '7.3470570000000004E+02' asNumber -> 7.3470569999999998E+02 .... within roundoff error...presumably you would need to touch the other `instance creation` methods in SqNumberParser to cover "all" of the bases On Fri, May 2, 2014 at 4:54 PM, Mariano Martinez Peck <[hidden email]> wrote:
_______________________________________________ Glass mailing list [hidden email] http://lists.gemtalksystems.com/mailman/listinfo/glass |
Free forum by Nabble | Edit this page |