Floating point literals in debugger
Hello. When I have the following expression {1-1e-6. 1e-6. 0} in the code and then I debug it I get {(1 - '<an unprintable nonliteral value>'). '<an unprintable nonliteral value>'. 0}. Is it a known problem or should I report an issue on debug tracker? Best regards, Natalia
Yes, I see also the same problem. I didn't realize until now that : 1-1e-6 is printed as a fraction (try print-it): (999999/1000000) A little bit strange, no ? On Fri, Aug 1, 2014 at 3:05 PM, Natalia Tymchuk <natalia.tymchuk@unikernel.net> wrote:
Hello. When I have the following expression {1-1e-6. 1e-6. 0} in the code and then I debug it I get {(1 - '<an unprintable nonliteral value>'). '<an unprintable nonliteral value>'. 0}.
Is it a known problem or should I report an issue on debug tracker?
Best regards, Natalia
-- Serge Stinckwich UCBN & UMI UMMISCO 209 (IRD/UPMC) Every DSL ends up being Smalltalk http://www.doesnotunderstand.org/
Note that inspecting her expression does work, it is the debugging that fails (I am not sure why you would want to that). Pharo does answer whole numbers from scientific notation if it can (try 1e6 for example), I think that is cool (maintaining maximum precision). You can always do #asFloat if you want. So the calculation is correct 1 - 1e-6 or 1 - 1/1000000 which equals 999999/1000000 On 01 Aug 2014, at 15:40, Serge Stinckwich <serge.stinckwich@gmail.com> wrote:
Yes, I see also the same problem.
I didn't realize until now that : 1-1e-6 is printed as a fraction (try print-it): (999999/1000000)
A little bit strange, no ?
On Fri, Aug 1, 2014 at 3:05 PM, Natalia Tymchuk <natalia.tymchuk@unikernel.net> wrote:
Hello. When I have the following expression {1-1e-6. 1e-6. 0} in the code and then I debug it I get {(1 - '<an unprintable nonliteral value>'). '<an unprintable nonliteral value>'. 0}.
Is it a known problem or should I report an issue on debug tracker?
Best regards, Natalia
-- Serge Stinckwich UCBN & UMI UMMISCO 209 (IRD/UPMC) Every DSL ends up being Smalltalk http://www.doesnotunderstand.org/
Hello, Natalia I don't think this is a known bug (few people use Float and Fraction in Pharo). The RBParser parse your floating pointers as Fraction and not as Float (I don't know why). In the debugger the bytecode pc to source code pointer is mapped by printing the AST. In this case, the AST node (RBLiteralNode) for your float holds a Fraction. The code to print a literal node is as follow: visitLiteralNode: aLiteralNode aLiteralNode value isLiteral ifFalse: [ self writeString: '''<an unprintable nonliteral value>''' ] ifTrue: [ self writeString: aLiteralNode token storeString ] and isLiteral answers always false for a Fraction. A temporary patch consists in adding the method Fraction>>isLiteral ^ true Then you can debug your code. However, I think a real patch would consists in adding the method isLiteral in Fraction but with correct code to answer true only if the fraction can be a literal. Something similar to Float>>#isLiteral. 2014-08-01 15:40 GMT+02:00 Serge Stinckwich <serge.stinckwich@gmail.com>:
Yes, I see also the same problem.
I didn't realize until now that : 1-1e-6 is printed as a fraction (try print-it): (999999/1000000)
A little bit strange, no ?
On Fri, Aug 1, 2014 at 3:05 PM, Natalia Tymchuk <natalia.tymchuk@unikernel.net> wrote:
Hello. When I have the following expression {1-1e-6. 1e-6. 0} in the code and then I debug it I get {(1 - '<an unprintable nonliteral value>'). '<an unprintable nonliteral value>'. 0}.
Is it a known problem or should I report an issue on debug tracker?
Best regards, Natalia
-- Serge Stinckwich UCBN & UMI UMMISCO 209 (IRD/UPMC) Every DSL ends up being Smalltalk http://www.doesnotunderstand.org/
Thank you. I donât need it, because I know what is written in my code, but it can be the problem for users and I think that it will good to fix it. Best regards, Natalia On Aug 1, 2014, at 5:07 PM, Clément Bera <bera.clement@gmail.com> wrote:
Hello,
Natalia I don't think this is a known bug (few people use Float and Fraction in Pharo).
The RBParser parse your floating pointers as Fraction and not as Float (I don't know why).
In the debugger the bytecode pc to source code pointer is mapped by printing the AST. In this case, the AST node (RBLiteralNode) for your float holds a Fraction. The code to print a literal node is as follow:
visitLiteralNode: aLiteralNode aLiteralNode value isLiteral ifFalse: [ self writeString: '''<an unprintable nonliteral value>''' ] ifTrue: [ self writeString: aLiteralNode token storeString ]
and isLiteral answers always false for a Fraction.
A temporary patch consists in adding the method
Fraction>>isLiteral ^ true
Then you can debug your code.
However, I think a real patch would consists in adding the method isLiteral in Fraction but with correct code to answer true only if the fraction can be a literal. Something similar to Float>>#isLiteral.
2014-08-01 15:40 GMT+02:00 Serge Stinckwich <serge.stinckwich@gmail.com>: Yes, I see also the same problem.
I didn't realize until now that : 1-1e-6 is printed as a fraction (try print-it): (999999/1000000)
A little bit strange, no ?
On Fri, Aug 1, 2014 at 3:05 PM, Natalia Tymchuk <natalia.tymchuk@unikernel.net> wrote:
Hello. When I have the following expression {1-1e-6. 1e-6. 0} in the code and then I debug it I get {(1 - '<an unprintable nonliteral value>'). '<an unprintable nonliteral value>'. 0}.
Is it a known problem or should I report an issue on debug tracker?
Best regards, Natalia
-- Serge Stinckwich UCBN & UMI UMMISCO 209 (IRD/UPMC) Every DSL ends up being Smalltalk http://www.doesnotunderstand.org/
could you add a bug entry with the discussion because else this will be lost. Stef On 1/8/14 17:58, Natalia Tymchuk wrote:
Thank you. I donât need it, because I know what is written in my code, but it can be the problem for users and I think that it will good to fix it. Best regards, Natalia
On Aug 1, 2014, at 5:07 PM, Clément Bera <bera.clement@gmail.com <mailto:bera.clement@gmail.com>> wrote:
Hello,
Natalia I don't think this is a known bug (few people use Float and Fraction in Pharo).
The RBParser parse your floating pointers as Fraction and not as Float (I don't know why).
In the debugger the bytecode pc to source code pointer is mapped by printing the AST. In this case, the AST node (RBLiteralNode) for your float holds a Fraction. The code to print a literal node is as follow:
visitLiteralNode: aLiteralNode aLiteralNode value isLiteral ifFalse: [ self writeString: '''<an unprintable nonliteral value>''' ] ifTrue: [ self writeString: aLiteralNode token storeString ]
and isLiteral answers always false for a Fraction.
A temporary patch consists in adding the method
Fraction>>isLiteral ^ true
Then you can debug your code.
However, I think a real patch would consists in adding the method isLiteral in Fraction but with correct code to answer true only if the fraction can be a literal. Something similar to Float>>#isLiteral.
2014-08-01 15:40 GMT+02:00 Serge Stinckwich <serge.stinckwich@gmail.com <mailto:serge.stinckwich@gmail.com>>:
Yes, I see also the same problem.
I didn't realize until now that : 1-1e-6 is printed as a fraction (try print-it): (999999/1000000)
A little bit strange, no ?
On Fri, Aug 1, 2014 at 3:05 PM, Natalia Tymchuk <natalia.tymchuk@unikernel.net <mailto:natalia.tymchuk@unikernel.net>> wrote: > Hello. > When I have the following expression > {1-1e-6. 1e-6. 0} > in the code and then I debug it I get > {(1 - '<an unprintable nonliteral value>'). > '<an unprintable nonliteral value>'. > 0}. > > Is it a known problem or should I report an issue on debug tracker? > > Best regards, > Natalia >
-- Serge Stinckwich UCBN & UMI UMMISCO 209 (IRD/UPMC) Every DSL ends up being Smalltalk http://www.doesnotunderstand.org/
I've just opened it here: https://pharo.fogbugz.com/f/cases/13761/Fraction-floating-pointer-cannot-be-... 13761 2014-08-01 22:42 GMT+02:00 stepharo <stepharo@free.fr>:
could you add a bug entry with the discussion because else this will be lost.
Stef
On 1/8/14 17:58, Natalia Tymchuk wrote:
Thank you. I donât need it, because I know what is written in my code, but it can be the problem for users and I think that it will good to fix it. Best regards, Natalia
On Aug 1, 2014, at 5:07 PM, Clément Bera <bera.clement@gmail.com> wrote:
Hello,
Natalia I don't think this is a known bug (few people use Float and Fraction in Pharo).
The RBParser parse your floating pointers as Fraction and not as Float (I don't know why).
In the debugger the bytecode pc to source code pointer is mapped by printing the AST. In this case, the AST node (RBLiteralNode) for your float holds a Fraction. The code to print a literal node is as follow:
visitLiteralNode: aLiteralNode aLiteralNode value isLiteral ifFalse: [ self writeString: '''<an unprintable nonliteral value>''' ] ifTrue: [ self writeString: aLiteralNode token storeString ]
and isLiteral answers always false for a Fraction.
A temporary patch consists in adding the method
Fraction>>isLiteral ^ true
Then you can debug your code.
However, I think a real patch would consists in adding the method isLiteral in Fraction but with correct code to answer true only if the fraction can be a literal. Something similar to Float>>#isLiteral.
2014-08-01 15:40 GMT+02:00 Serge Stinckwich <serge.stinckwich@gmail.com>:
Yes, I see also the same problem.
I didn't realize until now that : 1-1e-6 is printed as a fraction (try print-it): (999999/1000000)
A little bit strange, no ?
On Fri, Aug 1, 2014 at 3:05 PM, Natalia Tymchuk <natalia.tymchuk@unikernel.net> wrote:
Hello. When I have the following expression {1-1e-6. 1e-6. 0} in the code and then I debug it I get {(1 - '<an unprintable nonliteral value>'). '<an unprintable nonliteral value>'. 0}.
Is it a known problem or should I report an issue on debug tracker?
Best regards, Natalia
-- Serge Stinckwich UCBN & UMI UMMISCO 209 (IRD/UPMC) Every DSL ends up being Smalltalk http://www.doesnotunderstand.org/
Thank you. Best regards, Natalia On Aug 2, 2014, at 7:41 AM, Clément Bera <bera.clement@gmail.com> wrote:
I've just opened it here: https://pharo.fogbugz.com/f/cases/13761/Fraction-floating-pointer-cannot-be-... 13761
2014-08-01 22:42 GMT+02:00 stepharo <stepharo@free.fr>: could you add a bug entry with the discussion because else this will be lost.
Stef
On 1/8/14 17:58, Natalia Tymchuk wrote:
Thank you. I donât need it, because I know what is written in my code, but it can be the problem for users and I think that it will good to fix it. Best regards, Natalia
On Aug 1, 2014, at 5:07 PM, Clément Bera <bera.clement@gmail.com> wrote:
Hello,
Natalia I don't think this is a known bug (few people use Float and Fraction in Pharo).
The RBParser parse your floating pointers as Fraction and not as Float (I don't know why).
In the debugger the bytecode pc to source code pointer is mapped by printing the AST. In this case, the AST node (RBLiteralNode) for your float holds a Fraction. The code to print a literal node is as follow:
visitLiteralNode: aLiteralNode aLiteralNode value isLiteral ifFalse: [ self writeString: '''<an unprintable nonliteral value>''' ] ifTrue: [ self writeString: aLiteralNode token storeString ]
and isLiteral answers always false for a Fraction.
A temporary patch consists in adding the method
Fraction>>isLiteral ^ true
Then you can debug your code.
However, I think a real patch would consists in adding the method isLiteral in Fraction but with correct code to answer true only if the fraction can be a literal. Something similar to Float>>#isLiteral.
2014-08-01 15:40 GMT+02:00 Serge Stinckwich <serge.stinckwich@gmail.com>: Yes, I see also the same problem.
I didn't realize until now that : 1-1e-6 is printed as a fraction (try print-it): (999999/1000000)
A little bit strange, no ?
On Fri, Aug 1, 2014 at 3:05 PM, Natalia Tymchuk <natalia.tymchuk@unikernel.net> wrote:
Hello. When I have the following expression {1-1e-6. 1e-6. 0} in the code and then I debug it I get {(1 - '<an unprintable nonliteral value>'). '<an unprintable nonliteral value>'. 0}.
Is it a known problem or should I report an issue on debug tracker?
Best regards, Natalia
-- Serge Stinckwich UCBN & UMI UMMISCO 209 (IRD/UPMC) Every DSL ends up being Smalltalk http://www.doesnotunderstand.org/
Hi Clément, On Fri, Aug 1, 2014 at 8:07 AM, Clément Bera <bera.clement@gmail.com> wrote:
Hello,
Natalia I don't think this is a known bug (few people use Float and Fraction in Pharo).
The RBParser parse your floating pointers as Fraction and not as Float (I don't know why).
In the debugger the bytecode pc to source code pointer is mapped by printing the AST. In this case, the AST node (RBLiteralNode) for your float holds a Fraction. The code to print a literal node is as follow:
visitLiteralNode: aLiteralNode aLiteralNode value isLiteral ifFalse: [ self writeString: '''<an unprintable nonliteral value>''' ] ifTrue: [ self writeString: aLiteralNode token storeString ]
and isLiteral answers always false for a Fraction.
A temporary patch consists in adding the method
Fraction>>isLiteral ^ true
Then you can debug your code.
However, I think a real patch would consists in adding the method isLiteral in Fraction but with correct code to answer true only if the fraction can be a literal. Something similar to Float>>#isLiteral.
Find attached the changes I made to Squeak trunk which I think are correct. Basically SqNumberParser will answer Floats, whereas ExtendedNumberParser still answers Fractions. See also http://source.squeak.org/trunk/Kernel-eem.866.mcz cheers!
2014-08-01 15:40 GMT+02:00 Serge Stinckwich <serge.stinckwich@gmail.com>:
Yes, I see also the same problem.
I didn't realize until now that : 1-1e-6 is printed as a fraction (try print-it): (999999/1000000)
A little bit strange, no ?
On Fri, Aug 1, 2014 at 3:05 PM, Natalia Tymchuk <natalia.tymchuk@unikernel.net> wrote:
Hello. When I have the following expression {1-1e-6. 1e-6. 0} in the code and then I debug it I get {(1 - '<an unprintable nonliteral value>'). '<an unprintable nonliteral value>'. 0}.
Is it a known problem or should I report an issue on debug tracker?
Best regards, Natalia
-- Serge Stinckwich UCBN & UMI UMMISCO 209 (IRD/UPMC) Every DSL ends up being Smalltalk http://www.doesnotunderstand.org/
-- best, Eliot
participants (6)
-
Clément Bera -
Eliot Miranda -
Natalia Tymchuk -
Serge Stinckwich -
stepharo -
Sven Van Caekenberghe