mirror of
https://github.com/DanilaFe/abacus
synced 2024-12-22 07:20:09 -08:00
Add precision getter to NaiveNumber.
This commit is contained in:
parent
9345faf7d3
commit
aec9953af2
|
@ -8,6 +8,11 @@ public class NaiveNumber implements Number {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int precision() {
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Number multiply(Number multiplier) {
|
public Number multiply(Number multiplier) {
|
||||||
if(!(multiplier instanceof NaiveNumber)) throw new IllegalArgumentException();
|
if(!(multiplier instanceof NaiveNumber)) throw new IllegalArgumentException();
|
||||||
|
|
|
@ -2,6 +2,7 @@ package org.nwapw.abacus.number;
|
||||||
|
|
||||||
public interface Number {
|
public interface Number {
|
||||||
|
|
||||||
|
int precision();
|
||||||
Number multiply(Number multiplier);
|
Number multiply(Number multiplier);
|
||||||
Number divide(Number divisor);
|
Number divide(Number divisor);
|
||||||
Number add(Number summand);
|
Number add(Number summand);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user