1
0
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:
Arthur Drobot
2017-08-02 12:00:56 -07:00
parent 52fbfd5134
commit 601c4fea55
4 changed files with 60 additions and 12 deletions

View File

@@ -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