1
0
mirror of https://github.com/DanilaFe/abacus synced 2024-11-17 16:09:32 -08:00

Modify some functions in PreciseNumber for consistency.

This commit is contained in:
Arthur Drobot 2017-08-07 13:41:45 -07:00
parent 553349133d
commit c636289d3c

View File

@ -113,19 +113,18 @@ public class PreciseNumber extends NumberInterface {
String str = value.toPlainString();
int decimalIndex = str.indexOf('.');
if (decimalIndex != -1) {
return new PreciseNumber(str.substring(0, decimalIndex));
NumberInterface floor = new PreciseNumber(str.substring(0, decimalIndex));
if(signum() == -1){
floor = floor.subtract(ONE);
}
return floor;
}
return this;
}
@Override
public NumberInterface fractionalPartInternal() {
String str = value.toPlainString();
int decimalIndex = str.indexOf('.');
if (decimalIndex != -1) {
return new PreciseNumber(str.substring(decimalIndex + 1));
}
return ZERO;
return this.subtractInternal(floorInternal());
}
@Override