DhbFloatingPointMachine new largestExponentArgument usage is questionable. Thanks to gradual underflow, there is a dissymetry between the exponent of smallest Float we can represent and that of the largest Float.DhbFloatingPointMachine new largestExponentArgument negated For example: self deny: DhbFloatingPointMachine new largestExponentArgument negated predecessor exp isZeroWe could eventually use: DhbFloatingPointMachine new smallestExponentArgument computed as Float fmin ln -> -744.4400719213812 But are we going to need it? This is used for example in: DhbFisherTippettDistribution>>distributionValue: aNumber "Answers the probability of observing a random variable distributed according to the receiver with a value lower than or equal to aNumber." | arg | arg := ( aNumber - alpha) / beta. arg := arg < DhbFloatingPointMachine new largestExponentArgument negated ifTrue: [ ^0] ifFalse:[arg negated exp]. ^arg negated exp But this code is false... It should return 1 not 0 ! So even better is to not bother at all and let the floating point underflow take care of it: DhbFisherTippettDistribution>>distributionValue: aNumber "Answers the probability of observing a random variable distributed according to the receiver with a value lower than or equal to aNumber." | arg | arg := ( aNumber - alpha) / beta. ^arg negated exp negated exp for the density, we should simply write: value: aNumber "Answers the probability that a random variable distributed according to the receiver gives a value between aNumber and aNumber + espilon (infinitesimal interval)." | arg | arg := ( aNumber - alpha) / beta. ^(arg negated exp + arg) negated exp : beta You received this message because you are subscribed to the Google Groups "SciSmalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
2016-05-04 15:30 GMT+02:00 Nicolas Cellier <[hidden email]>:
Ah my bad, sorry, it sounds like I completely miss-understood the code. arg negated exp negated exp may indeed fail when arg is very negative, so the code was perfectly correct.Just throw this message in the trash bin :) You received this message because you are subscribed to the Google Groups "SciSmalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
Nonetheless, on Smalltalk dialects that handle floatint point overflow the IEEE 754 way by answering infinity like Squeak/Pharo, we can use simple formula. -1000 negated exp negated exp -> 0 (thru Float infinity negated exp)2016-05-04 15:59 GMT+02:00 Nicolas Cellier <[hidden email]>:
You received this message because you are subscribed to the Google Groups "SciSmalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
In reply to this post by Nicolas Cellier
Hi nicolas
I do not understand what you are saying but I trust you :). Can you publish a fixed version so that we improve Polymath. My participation to Polymath is at the meta level (package, QA)
but I cannot fix what I do not understand. Stef Le 4/5/16 à 15:30, Nicolas Cellier a
écrit :
-- You received this message because you are subscribed to the Google Groups "SciSmalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
Free forum by Nabble - Scala forum | Edit this page |