12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import java.math.BigInteger;
  2. /**
  3. * Write a description of class BonusFeatures here.
  4. *
  5. * @author (your name)
  6. * @version (a version number or a date)
  7. */
  8. public class BonusFeatures
  9. {
  10. CoreFeatures coreFeatures = new CoreFeatures();
  11. public double factorial(double x) {
  12. if (x % 1 != 0){
  13. coreFeatures.error();
  14. return 0;
  15. }
  16. int y = (int)x;
  17. BigInteger factorial = new BigInteger("1");
  18. for(int i = y; i > 1; i--){
  19. factorial = factorial.multiply(BigInteger.valueOf(i));
  20. }
  21. return Double.parseDouble(factorial.toString());
  22. }
  23. public double log(double x) {
  24. return Math.log10(x);
  25. }
  26. public double inverseLog(double x) {
  27. return Math.pow(10,x);
  28. }
  29. public double naturalLog(double x) {
  30. return Math.log(x);
  31. }
  32. public double inverseNaturalLog(double x) {
  33. return Math.pow(Math.E,x);
  34. }
  35. }