mirror of
https://github.com/DanilaFe/abacus
synced 2024-12-22 23:40:08 -08:00
Modify some functions in PreciseNumber for consistency.
This commit is contained in:
parent
553349133d
commit
c636289d3c
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user