SqrtFunction.java
Go to the documentation of this file.00001 package com.graphbuilder.math.func;
00002
00008 public class SqrtFunction implements Function {
00009
00010 public SqrtFunction() {}
00011
00015 public double of(double[] d, int numParam) {
00016 double root = d[0];
00017
00018
00019
00020 if (root< 0.0) {
00021
00022 return 0.0;
00023 }
00024 return java.lang.Math.sqrt(root);
00025 }
00026
00030 public boolean acceptNumParam(int numParam) {
00031 return numParam == 1;
00032 }
00033
00034 public String toString() {
00035 return "sqrt(x)";
00036 }
00037 }