I think you make some good points here. Why call the "straightforward"
factory method ofInt when there is no reason not to use a long, or
BigInteger (or I suppose byte). These could all be handled with the
overloaded factory method of(). For Fraction, it is probably reasonable to
have only
On Fri, 28 Dec 2018 09:17:08 -0800, Eric Barnhill wrote:
Fractions are constructed using either ints or doubles. In the case
of
ints, the numerator and denominator are passed (or the denominator is
assumed to be one). Constructing fractions from doubles is more
algorithmic
work: if I pass a
I'd suggest `of` and `ofXxx` for factories that perform little work,
such as assigning to instance fields, and `from` and `fromXxx` for
factories that perform meaningful work or conversion.
Stephen
On Fri, 28 Dec 2018 at 17:24, Eric Barnhill wrote:
>
> Fractions are constructed using either
Fractions are constructed using either ints or doubles. In the case of
ints, the numerator and denominator are passed (or the denominator is
assumed to be one). Constructing fractions from doubles is more algorithmic
work: if I pass a known fixed quantity such as 0.6 of course it will not be
hard
Hello Eric.
On Thu, 27 Dec 2018 17:00:15 -0800, Eric Barnhill wrote:
I am overloading:
public static BigFraction ofInt(final BigInteger num) {
return new BigFraction(num, BigInteger.ONE);
}
public static BigFraction ofInt(BigInteger num, BigInteger den) {
return new