public static double fv(double r, double n, double y, double p, boolean t) {double retval = 0;if (r == 0) {retval = -1*(p+(n*y));}else {double r1 = r + 1;retval =((1-Math.pow(r1, n)) * (t ? r1 : 1) * y ) / r-p*Math.pow(r1, n);}return retval;}
public static double fv(double r, double n, double y, double p, bool t){double retval = 0;if (r == 0){retval = -1 * (p + (n * y));}else{double r1 = r + 1;retval = ((1 - Math.Pow(r1, n)) * (t ? r1 : 1) * y) / r-p * Math.Pow(r1, n);}return retval;}