Re: [commons-numbers] [...] NUMBERS-91: Added ofInt() factory methods [...]

2019-01-14 Thread Eric Barnhill
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

Re: [commons-numbers] [...] NUMBERS-91: Added ofInt() factory methods [...]

2018-12-28 Thread Gilles
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

Re: [commons-numbers] [...] NUMBERS-91: Added ofInt() factory methods [...]

2018-12-28 Thread Stephen Colebourne
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

Re: [commons-numbers] [...] NUMBERS-91: Added ofInt() factory methods [...]

2018-12-28 Thread Eric Barnhill
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

Re: [commons-numbers] [...] NUMBERS-91: Added ofInt() factory methods [...]

2018-12-28 Thread Gilles
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