4 messages
Open this post in threaded view
|
Report Content as Inappropriate

 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.Float fmin -> 5.0e-324.Float fmax -> 1.7976931348623157e308.Float fmin exponent -> -1074 (that is Float emin - Float precision + 1)Float fmax exponent -> 1023 (that is Float emax)Thus we can find a Float x smaller thanDhbFloatingPointMachine new largestExponentArgument negatedfor which the exponent is still not zero.For example:self deny: DhbFloatingPointMachine new largestExponentArgument negated predecessor exp isZeroWe could eventually use:DhbFloatingPointMachine new smallestExponentArgumentcomputed as Float fmin ln ->  -744.4400719213812But 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 expBut 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 expfor 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.
Open this post in threaded view
|
Report Content as Inappropriate

Open this post in threaded view
|
Report Content as Inappropriate

Open this post in threaded view
|
Report Content as Inappropriate