mirror of
https://github.com/DanilaFe/abacus
synced 2024-12-22 15:30:09 -08:00
Implement sin function and helper functions such as getSmallAngle and floor.
This commit is contained in:
parent
1ee8c7d231
commit
b31151384d
|
@ -98,6 +98,11 @@ public class NaiveNumber implements NumberInterface {
|
|||
return (int) Math.ceil(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int floor() {
|
||||
return (int) Math.floor(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NumberInterface promoteTo(Class<? extends NumberInterface> toClass) {
|
||||
if (toClass == this.getClass()) return this;
|
||||
|
|
|
@ -85,6 +85,12 @@ public interface NumberInterface {
|
|||
*/
|
||||
int ceiling();
|
||||
|
||||
/**
|
||||
* Return the greatest integer less than or equal to the number.
|
||||
* @return the greatest int >= the number, if int can hold the value.
|
||||
*/
|
||||
int floor();
|
||||
|
||||
/**
|
||||
* Promotes this class to another number class.
|
||||
*
|
||||
|
|
|
@ -100,6 +100,11 @@ public class PreciseNumber implements NumberInterface {
|
|||
return (int) Math.ceil(value.doubleValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int floor() {
|
||||
return (int) Math.floor(value.doubleValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public NumberInterface negate() {
|
||||
return new PreciseNumber(value.negate());
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user