Closed elect86 closed 7 years ago
I'd also like to add methods to each unsigned type for multiplication and division as well..
May I also ask why constructors are privates and value
final?
However I'd like to expand it with glm common functions such as mix, step, clamp, uintBitsToFloat, etc..
Hmm, what are those? Would you mind sharing what they do and why they're generally useful?
I'd also like to add methods to each unsigned type for multiplication and division as well..
Sure, great idea. The naming of these methods would ideally match that of BigInteger
and BigDecimal
May I also ask why constructors are privates and value final?
These classes are value types. Users should not be allowed to construct them manually, or modify the final value. Do note that Number
constructors (such as Integer(int)
) are finally deprecated in Java 9, as they should be: http://download.java.net/java/jdk9/docs/api/java/lang/Integer.html#Integer-int-
Since unsigned numbers in JOOU are classes we don't need these overloads:
static <T extends Comparable<T>> min(T a, T b) {
return a.compareTo(b) < 0 ? a : b;
}
static <T extends Comparable<T>> max(T a, T b) {
return a.compareTo(b) > 0 ? a : b;
}
@sirikid You're right, thanks for the feedback. Given the limited advantage of having actual methods called min()
and max()
over the comparison with the compareTo()
result, I'm going to reject this PR for now, as there are currently no other useful UMath
method proposals.
Hi Lukas,
just wanted to say sorry if I didn't show up further, but I got totally keen up on Kotlin now, and I am switching definitely to it...
Thanks anyway for your avaialbility and sorry again! Giuseppe
@elect86 : Hey, no worries at all. Totally understand!
@elect86 Kotlin is addictive language :^) I'm also tried to write jOOU analogue in Kotlin, it isn't easy as it might seem at first glance.
UMath class
At the moment I only wrote
min
,max
However I'd like to expand it with glm common functions such as
mix
,step
,clamp
,uintBitsToFloat
, etc..