12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- import java.math.BigInteger;
-
- /**
- * Write a description of class BonusFeatures here.
- *
- * @author (your name)
- * @version (a version number or a date)
- */
- public class BonusFeatures
- {
- CoreFeatures coreFeatures = new CoreFeatures();
-
- public double factorial(double x) {
-
- if (x % 1 != 0){
- coreFeatures.error();
- return 0;
- }
-
- int y = (int)x;
- BigInteger factorial = new BigInteger("1");
-
- for(int i = y; i > 1; i--){
- factorial = factorial.multiply(BigInteger.valueOf(i));
- }
-
- return Double.parseDouble(factorial.toString());
- }
-
- public double log(double x) {
- return Math.log10(x);
- }
-
- public double inverseLog(double x) {
- return Math.pow(10,x);
- }
-
- public double naturalLog(double x) {
- return Math.log(x);
- }
-
- public double inverseNaturalLog(double x) {
- return Math.pow(Math.E,x);
- }
- }
|