mirror of
https://github.com/DanilaFe/abacus
synced 2026-01-26 16:45:21 +00:00
Change ceiling and floor to return NumberInterface. Add fractional part function. Add intValue function. Change StandardPlugin correspondingly.
This commit is contained in:
@@ -94,13 +94,23 @@ public class NaiveNumber implements NumberInterface {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int ceiling() {
|
||||
return (int) Math.ceil(value);
|
||||
public NumberInterface ceiling() {
|
||||
return new NaiveNumber(Math.ceil(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int floor() {
|
||||
return (int) Math.floor(value);
|
||||
public NumberInterface floor() {
|
||||
return new NaiveNumber(Math.floor(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public NumberInterface fractionalPart() {
|
||||
return new NaiveNumber(value - Math.floor(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int intValue() {
|
||||
return (int)value;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user