[Cuis-dev] Fraction numerator and denominator
Ezequiel Birman
ebirman77 at gmail.com
Fri Jul 5 09:28:44 PDT 2024
Hi!
`(4/6) numerator` returns 2 because `4/6` is evaluated first. Compare it to
`(Fraction numerator: 4 denominator: 6) numerator`.
Why would you need `numerator` or `denominator` if not working with
fraction arithmetic? I checked their senders, and the code shown only deals
with fractional arithmetic.
On Fri, 5 Jul 2024 at 16:52, Mark Volkmann via Cuis-dev <
cuis-dev at lists.cuis.st> wrote:
> I was surprised to see that the numerator and denominator instance methods
> of the Fraction class are in the private method category. Why
> should invoking those be avoided? Perhaps they are considered to be
> confusing since they return values from the reduced form of the fraction.
> For example, `(4 / 6) numerator` returns 2 because the reduced form of the
> fraction is `2 / 3`.
>
> --
> R. Mark Volkmann
> Object Computing, Inc.
> --
> Cuis-dev mailing list
> Cuis-dev at lists.cuis.st
> https://lists.cuis.st/mailman/listinfo/cuis-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20240705/397630c0/attachment.htm>
More information about the Cuis-dev
mailing list