[bug] displayString on a FloatQ failed

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[bug] displayString on a FloatQ failed

MrGwen
Issue status update for
http://smalltalk.gnu.org/node/316
Post a follow up:
http://smalltalk.gnu.org/project/comments/add/316

 Project:      GNU Smalltalk
 Version:      <none>
 Component:    Base classes
 Category:     bug reports
 Priority:     normal
 Assigned to:  Unassigned
 Reported by:  MrGwen
 Updated by:   MrGwen
 Status:       active

Hi Paolo here the the stack trace when I've tried to send displayString
a Float (I am not sur if it was NaN)

Object: -inf error: Infinity can only be a Float
ArithmeticError(Exception)>>signal (AnsiExcept.st:216)
ArithmeticError(Exception)>>signal: (AnsiExcept.st:226)
FloatD(Number)>>arithmeticError: (AnsiExcept.st:1526)
FloatD(Float)>>checkCoercion (Float.st:470)
FloatD(Float)>>floor (Float.st:633)
FloatQ(Float)>>floorLog: (Float.st:360)
FloatQ(Float)>>printOn:special: (Float.st:502)
FloatQ(Float)>>printOn: (Float.st:430)
FloatQ(Object)>>displayOn: (Object.st:505)
FloatQ(Object)>>displayString (Object.st:496)




_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: [bug] displayString on a FloatQ failed

MrGwen
Issue status update for
http://smalltalk.gnu.org/project/issue/316
Post a follow up:
http://smalltalk.gnu.org/project/comments/add/316

 Project:      GNU Smalltalk
 Version:      <none>
 Component:    Base classes
 Category:     bug reports
 Priority:     normal
 Assigned to:  Unassigned
 Reported by:  MrGwen
 Updated by:   MrGwen
 Status:       active

To reproduce this bug :

FloatQ allInstances and I've st> FloatQ allInstances
Object: -inf error: Infinity can only be a Float
ArithmeticError(Exception)>>signal (AnsiExcept.st:216)
ArithmeticError(Exception)>>signal: (AnsiExcept.st:226)
FloatD(Number)>>arithmeticError: (AnsiExcept.st:1526)
FloatD(Float)>>checkCoercion (Float.st:470)
FloatD(Float)>>floor (Float.st:633)
FloatQ(Float)>>floorLog: (Float.st:360)
FloatQ(Float)>>printOn:special: (Float.st:502)
FloatQ(Float)>>printOn: (Float.st:430)
[] in WeakArray(Array)>>printOn: (Array.st:60)
Array(SequenceableCollection)>>do: (SeqCollect.st:823)
WeakArray>>do: (WeakObjects.st:140)
WeakArray(Array)>>printOn: (Array.st:61)
WeakArray(Object)>>printString (Object.st:535)
WeakArray(Object)>>printNl ("Global garbage collection... done"
Object.st:571)




_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: [bug] "FloatQ fmin log: 10" fails

Paolo Bonzini-3
In reply to this post by MrGwen
Issue status update for
http://smalltalk.gnu.org/project/issue/316
Post a follow up:
http://smalltalk.gnu.org/project/comments/add/316

 Project:      GNU Smalltalk
 Version:      <none>
 Component:    Base classes
 Category:     bug reports
 Priority:     normal
-Assigned to:  Unassigned
+Assigned to:  bonzinip
 Reported by:  MrGwen
 Updated by:   bonzinip
 Status:       active

The root cause of the bug is this

st> FloatQ fmin log: 10
-Inf




_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: [bug] "FloatQ fmin log: 10" fails

Paolo Bonzini-3
In reply to this post by MrGwen
Issue status update for
http://smalltalk.gnu.org/project/issue/316
Post a follow up:
http://smalltalk.gnu.org/project/comments/add/316

 Project:      GNU Smalltalk
 Version:      <none>
 Component:    Base classes
 Category:     bug reports
 Priority:     normal
 Assigned to:  bonzinip
 Reported by:  MrGwen
 Updated by:   bonzinip
-Status:       active
+Status:       fixed

And here is the fix, pushed as 6f7344d:

diff --git a/kernel/Float.st b/kernel/Float.st
index af73a86..f3affe7 100644
--- a/kernel/Float.st
+++ b/kernel/Float.st
@@ -319,6 +319,13 @@ if the hardware supports it.'>
         ^self ln / self class ln10
     ]
 
+    log: aNumber [
+        "Answer log base aNumber of the receiver"
+
+        
+        ^self ln / (self coerce: aNumber) ln
+    ]
+
     ceilingLog: radix [
         "Answer (self log: radix) ceiling."
 




_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk