mirror of
https://github.com/DanilaFe/abacus
synced 2024-11-17 16:09:32 -08:00
Implement sin function and helper functions such as getSmallAngle and floor.
This commit is contained in:
parent
c7136f903a
commit
661bc170fc
|
@ -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