mirror of
https://github.com/DanilaFe/abacus
synced 2024-12-23 16:00:09 -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);
|
return (int) Math.ceil(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int floor() {
|
||||||
|
return (int) Math.floor(value);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NumberInterface promoteTo(Class<? extends NumberInterface> toClass) {
|
public NumberInterface promoteTo(Class<? extends NumberInterface> toClass) {
|
||||||
if (toClass == this.getClass()) return this;
|
if (toClass == this.getClass()) return this;
|
||||||
|
|
|
@ -85,6 +85,12 @@ public interface NumberInterface {
|
||||||
*/
|
*/
|
||||||
int ceiling();
|
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.
|
* Promotes this class to another number class.
|
||||||
*
|
*
|
||||||
|
|
|
@ -100,6 +100,11 @@ public class PreciseNumber implements NumberInterface {
|
||||||
return (int) Math.ceil(value.doubleValue());
|
return (int) Math.ceil(value.doubleValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int floor() {
|
||||||
|
return (int) Math.floor(value.doubleValue());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NumberInterface negate() {
|
public NumberInterface negate() {
|
||||||
return new PreciseNumber(value.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