[squeak-dev] asApproximateFraction[AtOrder:]
tim Rowledge
tim at rowledge.org
Mon Apr 23 22:54:33 UTC 2018
> On 23-04-2018, at 1:59 PM, Eliot Miranda <eliot.miranda at gmail.com> wrote:
>
> Hi Tim,
>
> On Mon, Apr 23, 2018 at 1:34 PM, tim Rowledge <tim at rowledge.org> wrote:
> Do you normally want your fraction precise to an actual epsilon or to a fraction of the real value?
>
> Actually I guess that you could make a % value by working out the integer part, approximating the epsilon from that and using your method, so go for it. Not that I'm a numerics geek by any stretch.
>
> So you'd rather see
>
> asApproximateFraction
> "Answer a Fraction approximating the receiver. This conversion uses the
> continued fraction method to approximate a floating point number."
>
> ^self asApproximateFractionToEpsilon: self abs / 1.0e6
>
> ?
Seems good to me. It's like the difference between wanting to print numbers to X decimal places vs Y significant digits. I think...
tim
--
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
Maintenance free: It's impossible to fix.
More information about the Squeak-dev
mailing list
|