[Cuis-dev] Fraction numerator and denominator
Andres Valloud
ten at smallinteger.com
Fri Jul 5 09:37:45 PDT 2024
The accessors should be public (and the setters should be private).
I found a couple others that should be recategorized.
On 7/5/24 8:51 AM, Mark Volkmann via Cuis-dev 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.
>
-------------- next part --------------
'From Cuis7.1 [latest update: #6452] on 5 July 2024 at 9:36:39 am'!
!Fraction reorganize!
('arithmetic' * + - / denominator negated numerator)
('comparing' < <= = hash)
('converting' adaptToInteger:andSend: asFloat asFraction moduloTwoPiAsFloat)
('mathematical functions' cubed floorLog: ln log log2 log: nthRoot: raisedToFraction: raisedToInteger: reciprocal sqrt squared)
('printing' isLiteral printAsLiteralOn: printOn:base: printOn:fractionDigits: storeOn: storeOn:base:)
('testing' is: isFraction isPowerOfTwo negative positive)
('truncation and round off' truncated)
('private' reduced setNumerator:denominator:)
!
More information about the Cuis-dev
mailing list