
(FPCore (i n) :precision binary64 (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))
double code(double i, double n) {
return 100.0 * ((pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 100.0d0 * ((((1.0d0 + (i / n)) ** n) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
return 100.0 * ((Math.pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
def code(i, n): return 100.0 * ((math.pow((1.0 + (i / n)), n) - 1.0) / (i / n))
function code(i, n) return Float64(100.0 * Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) - 1.0) / Float64(i / n))) end
function tmp = code(i, n) tmp = 100.0 * ((((1.0 + (i / n)) ^ n) - 1.0) / (i / n)); end
code[i_, n_] := N[(100.0 * N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 21 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (i n) :precision binary64 (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))
double code(double i, double n) {
return 100.0 * ((pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 100.0d0 * ((((1.0d0 + (i / n)) ** n) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
return 100.0 * ((Math.pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
def code(i, n): return 100.0 * ((math.pow((1.0 + (i / n)), n) - 1.0) / (i / n))
function code(i, n) return Float64(100.0 * Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) - 1.0) / Float64(i / n))) end
function tmp = code(i, n) tmp = 100.0 * ((((1.0 + (i / n)) ^ n) - 1.0) / (i / n)); end
code[i_, n_] := N[(100.0 * N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}
\end{array}
(FPCore (i n)
:precision binary64
(let* ((t_0 (+ (pow (+ 1.0 (/ i n)) n) -1.0)) (t_1 (/ t_0 (/ i n))))
(if (<= t_1 0.0)
(/ (* 100.0 (expm1 (* n (log1p (/ i n))))) (/ i n))
(if (<= t_1 INFINITY) (* 100.0 (* t_0 (/ n i))) (* n 100.0)))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n) + -1.0;
double t_1 = t_0 / (i / n);
double tmp;
if (t_1 <= 0.0) {
tmp = (100.0 * expm1((n * log1p((i / n))))) / (i / n);
} else if (t_1 <= ((double) INFINITY)) {
tmp = 100.0 * (t_0 * (n / i));
} else {
tmp = n * 100.0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n) + -1.0;
double t_1 = t_0 / (i / n);
double tmp;
if (t_1 <= 0.0) {
tmp = (100.0 * Math.expm1((n * Math.log1p((i / n))))) / (i / n);
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = 100.0 * (t_0 * (n / i));
} else {
tmp = n * 100.0;
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) + -1.0 t_1 = t_0 / (i / n) tmp = 0 if t_1 <= 0.0: tmp = (100.0 * math.expm1((n * math.log1p((i / n))))) / (i / n) elif t_1 <= math.inf: tmp = 100.0 * (t_0 * (n / i)) else: tmp = n * 100.0 return tmp
function code(i, n) t_0 = Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0) t_1 = Float64(t_0 / Float64(i / n)) tmp = 0.0 if (t_1 <= 0.0) tmp = Float64(Float64(100.0 * expm1(Float64(n * log1p(Float64(i / n))))) / Float64(i / n)); elseif (t_1 <= Inf) tmp = Float64(100.0 * Float64(t_0 * Float64(n / i))); else tmp = Float64(n * 100.0); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[(N[(100.0 * N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(100.0 * N[(t$95$0 * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n} + -1\\
t_1 := \frac{t\_0}{\frac{i}{n}}\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;\frac{100 \cdot \mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{\frac{i}{n}}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;100 \cdot \left(t\_0 \cdot \frac{n}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < -0.0Initial program 25.5%
sub-neg25.5%
metadata-eval25.5%
Applied egg-rr25.5%
metadata-eval25.5%
sub-neg25.5%
exp-to-pow23.4%
log1p-undefine38.9%
*-commutative38.9%
expm1-undefine97.4%
Simplified97.4%
associate-*r/97.5%
Applied egg-rr97.5%
if -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 98.8%
clear-num98.8%
associate-/r/98.8%
clear-num98.9%
add-exp-log98.9%
expm1-define98.9%
log-pow36.6%
log1p-define36.6%
Applied egg-rr36.6%
expm1-undefine35.7%
*-commutative35.7%
log1p-undefine35.7%
exp-to-pow98.9%
Applied egg-rr98.9%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) Initial program 0.0%
associate-/r/1.8%
associate-*r*1.8%
*-commutative1.8%
associate-*r/1.8%
sub-neg1.8%
distribute-lft-in1.8%
metadata-eval1.8%
metadata-eval1.8%
metadata-eval1.8%
fma-define1.8%
metadata-eval1.8%
Simplified1.8%
Taylor expanded in i around 0 77.7%
Final simplification94.4%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (+ t_0 -1.0)) (t_2 (/ t_1 (/ i n))))
(if (<= t_2 -1e-248)
(/ (+ (* t_0 100.0) -100.0) (/ i n))
(if (<= t_2 0.0)
(* 100.0 (* n (/ (expm1 i) i)))
(if (<= t_2 INFINITY) (* 100.0 (* t_1 (/ n i))) (* n 100.0))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = t_0 + -1.0;
double t_2 = t_1 / (i / n);
double tmp;
if (t_2 <= -1e-248) {
tmp = ((t_0 * 100.0) + -100.0) / (i / n);
} else if (t_2 <= 0.0) {
tmp = 100.0 * (n * (expm1(i) / i));
} else if (t_2 <= ((double) INFINITY)) {
tmp = 100.0 * (t_1 * (n / i));
} else {
tmp = n * 100.0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n);
double t_1 = t_0 + -1.0;
double t_2 = t_1 / (i / n);
double tmp;
if (t_2 <= -1e-248) {
tmp = ((t_0 * 100.0) + -100.0) / (i / n);
} else if (t_2 <= 0.0) {
tmp = 100.0 * (n * (Math.expm1(i) / i));
} else if (t_2 <= Double.POSITIVE_INFINITY) {
tmp = 100.0 * (t_1 * (n / i));
} else {
tmp = n * 100.0;
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = t_0 + -1.0 t_2 = t_1 / (i / n) tmp = 0 if t_2 <= -1e-248: tmp = ((t_0 * 100.0) + -100.0) / (i / n) elif t_2 <= 0.0: tmp = 100.0 * (n * (math.expm1(i) / i)) elif t_2 <= math.inf: tmp = 100.0 * (t_1 * (n / i)) else: tmp = n * 100.0 return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(t_0 + -1.0) t_2 = Float64(t_1 / Float64(i / n)) tmp = 0.0 if (t_2 <= -1e-248) tmp = Float64(Float64(Float64(t_0 * 100.0) + -100.0) / Float64(i / n)); elseif (t_2 <= 0.0) tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); elseif (t_2 <= Inf) tmp = Float64(100.0 * Float64(t_1 * Float64(n / i))); else tmp = Float64(n * 100.0); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 + -1.0), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e-248], N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.0], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[(100.0 * N[(t$95$1 * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := t\_0 + -1\\
t_2 := \frac{t\_1}{\frac{i}{n}}\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{-248}:\\
\;\;\;\;\frac{t\_0 \cdot 100 + -100}{\frac{i}{n}}\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;100 \cdot \left(t\_1 \cdot \frac{n}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < -9.9999999999999998e-249Initial program 97.2%
associate-*r/97.4%
sub-neg97.4%
distribute-rgt-in97.5%
metadata-eval97.5%
metadata-eval97.5%
Simplified97.5%
if -9.9999999999999998e-249 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < -0.0Initial program 19.2%
Taylor expanded in n around inf 29.4%
associate-/l*29.4%
expm1-define76.1%
Simplified76.1%
if -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 98.8%
clear-num98.8%
associate-/r/98.8%
clear-num98.9%
add-exp-log98.9%
expm1-define98.9%
log-pow36.6%
log1p-define36.6%
Applied egg-rr36.6%
expm1-undefine35.7%
*-commutative35.7%
log1p-undefine35.7%
exp-to-pow98.9%
Applied egg-rr98.9%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) Initial program 0.0%
associate-/r/1.8%
associate-*r*1.8%
*-commutative1.8%
associate-*r/1.8%
sub-neg1.8%
distribute-lft-in1.8%
metadata-eval1.8%
metadata-eval1.8%
metadata-eval1.8%
fma-define1.8%
metadata-eval1.8%
Simplified1.8%
Taylor expanded in i around 0 77.7%
Final simplification80.3%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (+ t_0 -1.0)) (t_2 (/ t_1 (/ i n))))
(if (<= t_2 -1e-248)
(* n (/ (+ (* t_0 100.0) -100.0) i))
(if (<= t_2 0.0)
(* 100.0 (* n (/ (expm1 i) i)))
(if (<= t_2 INFINITY) (* 100.0 (* t_1 (/ n i))) (* n 100.0))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = t_0 + -1.0;
double t_2 = t_1 / (i / n);
double tmp;
if (t_2 <= -1e-248) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else if (t_2 <= 0.0) {
tmp = 100.0 * (n * (expm1(i) / i));
} else if (t_2 <= ((double) INFINITY)) {
tmp = 100.0 * (t_1 * (n / i));
} else {
tmp = n * 100.0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n);
double t_1 = t_0 + -1.0;
double t_2 = t_1 / (i / n);
double tmp;
if (t_2 <= -1e-248) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else if (t_2 <= 0.0) {
tmp = 100.0 * (n * (Math.expm1(i) / i));
} else if (t_2 <= Double.POSITIVE_INFINITY) {
tmp = 100.0 * (t_1 * (n / i));
} else {
tmp = n * 100.0;
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = t_0 + -1.0 t_2 = t_1 / (i / n) tmp = 0 if t_2 <= -1e-248: tmp = n * (((t_0 * 100.0) + -100.0) / i) elif t_2 <= 0.0: tmp = 100.0 * (n * (math.expm1(i) / i)) elif t_2 <= math.inf: tmp = 100.0 * (t_1 * (n / i)) else: tmp = n * 100.0 return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(t_0 + -1.0) t_2 = Float64(t_1 / Float64(i / n)) tmp = 0.0 if (t_2 <= -1e-248) tmp = Float64(n * Float64(Float64(Float64(t_0 * 100.0) + -100.0) / i)); elseif (t_2 <= 0.0) tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); elseif (t_2 <= Inf) tmp = Float64(100.0 * Float64(t_1 * Float64(n / i))); else tmp = Float64(n * 100.0); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 + -1.0), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e-248], N[(n * N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.0], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[(100.0 * N[(t$95$1 * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := t\_0 + -1\\
t_2 := \frac{t\_1}{\frac{i}{n}}\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{-248}:\\
\;\;\;\;n \cdot \frac{t\_0 \cdot 100 + -100}{i}\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;100 \cdot \left(t\_1 \cdot \frac{n}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < -9.9999999999999998e-249Initial program 97.2%
associate-/r/97.0%
associate-*r*97.2%
*-commutative97.2%
associate-*r/97.4%
sub-neg97.4%
distribute-lft-in97.5%
metadata-eval97.5%
metadata-eval97.5%
metadata-eval97.5%
fma-define97.4%
metadata-eval97.4%
Simplified97.4%
fma-undefine97.5%
*-commutative97.5%
Applied egg-rr97.5%
if -9.9999999999999998e-249 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < -0.0Initial program 19.2%
Taylor expanded in n around inf 29.4%
associate-/l*29.4%
expm1-define76.1%
Simplified76.1%
if -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 98.8%
clear-num98.8%
associate-/r/98.8%
clear-num98.9%
add-exp-log98.9%
expm1-define98.9%
log-pow36.6%
log1p-define36.6%
Applied egg-rr36.6%
expm1-undefine35.7%
*-commutative35.7%
log1p-undefine35.7%
exp-to-pow98.9%
Applied egg-rr98.9%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) Initial program 0.0%
associate-/r/1.8%
associate-*r*1.8%
*-commutative1.8%
associate-*r/1.8%
sub-neg1.8%
distribute-lft-in1.8%
metadata-eval1.8%
metadata-eval1.8%
metadata-eval1.8%
fma-define1.8%
metadata-eval1.8%
Simplified1.8%
Taylor expanded in i around 0 77.7%
Final simplification80.3%
(FPCore (i n)
:precision binary64
(let* ((t_0 (+ (pow (+ 1.0 (/ i n)) n) -1.0))
(t_1 (/ t_0 (/ i n)))
(t_2 (* 100.0 (* t_0 (/ n i)))))
(if (<= t_1 -1e-49)
t_2
(if (<= t_1 0.0)
(* 100.0 (* n (/ (expm1 i) i)))
(if (<= t_1 INFINITY) t_2 (* n 100.0))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n) + -1.0;
double t_1 = t_0 / (i / n);
double t_2 = 100.0 * (t_0 * (n / i));
double tmp;
if (t_1 <= -1e-49) {
tmp = t_2;
} else if (t_1 <= 0.0) {
tmp = 100.0 * (n * (expm1(i) / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_2;
} else {
tmp = n * 100.0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n) + -1.0;
double t_1 = t_0 / (i / n);
double t_2 = 100.0 * (t_0 * (n / i));
double tmp;
if (t_1 <= -1e-49) {
tmp = t_2;
} else if (t_1 <= 0.0) {
tmp = 100.0 * (n * (Math.expm1(i) / i));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_2;
} else {
tmp = n * 100.0;
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) + -1.0 t_1 = t_0 / (i / n) t_2 = 100.0 * (t_0 * (n / i)) tmp = 0 if t_1 <= -1e-49: tmp = t_2 elif t_1 <= 0.0: tmp = 100.0 * (n * (math.expm1(i) / i)) elif t_1 <= math.inf: tmp = t_2 else: tmp = n * 100.0 return tmp
function code(i, n) t_0 = Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0) t_1 = Float64(t_0 / Float64(i / n)) t_2 = Float64(100.0 * Float64(t_0 * Float64(n / i))) tmp = 0.0 if (t_1 <= -1e-49) tmp = t_2; elseif (t_1 <= 0.0) tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); elseif (t_1 <= Inf) tmp = t_2; else tmp = Float64(n * 100.0); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(i / n), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(100.0 * N[(t$95$0 * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-49], t$95$2, If[LessEqual[t$95$1, 0.0], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$2, N[(n * 100.0), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n} + -1\\
t_1 := \frac{t\_0}{\frac{i}{n}}\\
t_2 := 100 \cdot \left(t\_0 \cdot \frac{n}{i}\right)\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-49}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < -9.99999999999999936e-50 or -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 98.1%
clear-num98.1%
associate-/r/98.1%
clear-num98.2%
add-exp-log98.2%
expm1-define98.2%
log-pow39.1%
log1p-define39.4%
Applied egg-rr39.4%
expm1-undefine37.8%
*-commutative37.8%
log1p-undefine37.8%
exp-to-pow98.2%
Applied egg-rr98.2%
if -9.99999999999999936e-50 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < -0.0Initial program 22.4%
Taylor expanded in n around inf 32.2%
associate-/l*32.1%
expm1-define77.1%
Simplified77.1%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) Initial program 0.0%
associate-/r/1.8%
associate-*r*1.8%
*-commutative1.8%
associate-*r/1.8%
sub-neg1.8%
distribute-lft-in1.8%
metadata-eval1.8%
metadata-eval1.8%
metadata-eval1.8%
fma-define1.8%
metadata-eval1.8%
Simplified1.8%
Taylor expanded in i around 0 77.7%
Final simplification80.3%
(FPCore (i n)
:precision binary64
(let* ((t_0 (+ (pow (+ 1.0 (/ i n)) n) -1.0)) (t_1 (/ t_0 (/ i n))))
(if (<= t_1 0.0)
(* 100.0 (/ (expm1 (* n (log1p (/ i n)))) (/ i n)))
(if (<= t_1 INFINITY) (* 100.0 (* t_0 (/ n i))) (* n 100.0)))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n) + -1.0;
double t_1 = t_0 / (i / n);
double tmp;
if (t_1 <= 0.0) {
tmp = 100.0 * (expm1((n * log1p((i / n)))) / (i / n));
} else if (t_1 <= ((double) INFINITY)) {
tmp = 100.0 * (t_0 * (n / i));
} else {
tmp = n * 100.0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n) + -1.0;
double t_1 = t_0 / (i / n);
double tmp;
if (t_1 <= 0.0) {
tmp = 100.0 * (Math.expm1((n * Math.log1p((i / n)))) / (i / n));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = 100.0 * (t_0 * (n / i));
} else {
tmp = n * 100.0;
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) + -1.0 t_1 = t_0 / (i / n) tmp = 0 if t_1 <= 0.0: tmp = 100.0 * (math.expm1((n * math.log1p((i / n)))) / (i / n)) elif t_1 <= math.inf: tmp = 100.0 * (t_0 * (n / i)) else: tmp = n * 100.0 return tmp
function code(i, n) t_0 = Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0) t_1 = Float64(t_0 / Float64(i / n)) tmp = 0.0 if (t_1 <= 0.0) tmp = Float64(100.0 * Float64(expm1(Float64(n * log1p(Float64(i / n)))) / Float64(i / n))); elseif (t_1 <= Inf) tmp = Float64(100.0 * Float64(t_0 * Float64(n / i))); else tmp = Float64(n * 100.0); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[(100.0 * N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(100.0 * N[(t$95$0 * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n} + -1\\
t_1 := \frac{t\_0}{\frac{i}{n}}\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{\frac{i}{n}}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;100 \cdot \left(t\_0 \cdot \frac{n}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < -0.0Initial program 25.5%
sub-neg25.5%
metadata-eval25.5%
Applied egg-rr25.5%
metadata-eval25.5%
sub-neg25.5%
exp-to-pow23.4%
log1p-undefine38.9%
*-commutative38.9%
expm1-undefine97.4%
Simplified97.4%
if -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 98.8%
clear-num98.8%
associate-/r/98.8%
clear-num98.9%
add-exp-log98.9%
expm1-define98.9%
log-pow36.6%
log1p-define36.6%
Applied egg-rr36.6%
expm1-undefine35.7%
*-commutative35.7%
log1p-undefine35.7%
exp-to-pow98.9%
Applied egg-rr98.9%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) Initial program 0.0%
associate-/r/1.8%
associate-*r*1.8%
*-commutative1.8%
associate-*r/1.8%
sub-neg1.8%
distribute-lft-in1.8%
metadata-eval1.8%
metadata-eval1.8%
metadata-eval1.8%
fma-define1.8%
metadata-eval1.8%
Simplified1.8%
Taylor expanded in i around 0 77.7%
Final simplification94.4%
(FPCore (i n)
:precision binary64
(let* ((t_0 (+ (pow (+ 1.0 (/ i n)) n) -1.0)) (t_1 (/ t_0 (/ i n))))
(if (<= t_1 0.0)
(* 100.0 (* n (/ (expm1 (* n (log1p (/ i n)))) i)))
(if (<= t_1 INFINITY) (* 100.0 (* t_0 (/ n i))) (* n 100.0)))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n) + -1.0;
double t_1 = t_0 / (i / n);
double tmp;
if (t_1 <= 0.0) {
tmp = 100.0 * (n * (expm1((n * log1p((i / n)))) / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = 100.0 * (t_0 * (n / i));
} else {
tmp = n * 100.0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n) + -1.0;
double t_1 = t_0 / (i / n);
double tmp;
if (t_1 <= 0.0) {
tmp = 100.0 * (n * (Math.expm1((n * Math.log1p((i / n)))) / i));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = 100.0 * (t_0 * (n / i));
} else {
tmp = n * 100.0;
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) + -1.0 t_1 = t_0 / (i / n) tmp = 0 if t_1 <= 0.0: tmp = 100.0 * (n * (math.expm1((n * math.log1p((i / n)))) / i)) elif t_1 <= math.inf: tmp = 100.0 * (t_0 * (n / i)) else: tmp = n * 100.0 return tmp
function code(i, n) t_0 = Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0) t_1 = Float64(t_0 / Float64(i / n)) tmp = 0.0 if (t_1 <= 0.0) tmp = Float64(100.0 * Float64(n * Float64(expm1(Float64(n * log1p(Float64(i / n)))) / i))); elseif (t_1 <= Inf) tmp = Float64(100.0 * Float64(t_0 * Float64(n / i))); else tmp = Float64(n * 100.0); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[(100.0 * N[(n * N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(100.0 * N[(t$95$0 * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n} + -1\\
t_1 := \frac{t\_0}{\frac{i}{n}}\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{i}\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;100 \cdot \left(t\_0 \cdot \frac{n}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < -0.0Initial program 25.5%
associate-/r/25.2%
add-exp-log25.2%
expm1-define25.2%
log-pow34.6%
log1p-define95.7%
Applied egg-rr95.7%
if -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 98.8%
clear-num98.8%
associate-/r/98.8%
clear-num98.9%
add-exp-log98.9%
expm1-define98.9%
log-pow36.6%
log1p-define36.6%
Applied egg-rr36.6%
expm1-undefine35.7%
*-commutative35.7%
log1p-undefine35.7%
exp-to-pow98.9%
Applied egg-rr98.9%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) Initial program 0.0%
associate-/r/1.8%
associate-*r*1.8%
*-commutative1.8%
associate-*r/1.8%
sub-neg1.8%
distribute-lft-in1.8%
metadata-eval1.8%
metadata-eval1.8%
metadata-eval1.8%
fma-define1.8%
metadata-eval1.8%
Simplified1.8%
Taylor expanded in i around 0 77.7%
Final simplification93.1%
(FPCore (i n)
:precision binary64
(let* ((t_0 (+ (pow (+ 1.0 (/ i n)) n) -1.0)) (t_1 (/ t_0 (/ i n))))
(if (<= t_1 0.0)
(* 100.0 (* (expm1 (* n (log1p (/ i n)))) (/ n i)))
(if (<= t_1 INFINITY) (* 100.0 (* t_0 (/ n i))) (* n 100.0)))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n) + -1.0;
double t_1 = t_0 / (i / n);
double tmp;
if (t_1 <= 0.0) {
tmp = 100.0 * (expm1((n * log1p((i / n)))) * (n / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = 100.0 * (t_0 * (n / i));
} else {
tmp = n * 100.0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n) + -1.0;
double t_1 = t_0 / (i / n);
double tmp;
if (t_1 <= 0.0) {
tmp = 100.0 * (Math.expm1((n * Math.log1p((i / n)))) * (n / i));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = 100.0 * (t_0 * (n / i));
} else {
tmp = n * 100.0;
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) + -1.0 t_1 = t_0 / (i / n) tmp = 0 if t_1 <= 0.0: tmp = 100.0 * (math.expm1((n * math.log1p((i / n)))) * (n / i)) elif t_1 <= math.inf: tmp = 100.0 * (t_0 * (n / i)) else: tmp = n * 100.0 return tmp
function code(i, n) t_0 = Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0) t_1 = Float64(t_0 / Float64(i / n)) tmp = 0.0 if (t_1 <= 0.0) tmp = Float64(100.0 * Float64(expm1(Float64(n * log1p(Float64(i / n)))) * Float64(n / i))); elseif (t_1 <= Inf) tmp = Float64(100.0 * Float64(t_0 * Float64(n / i))); else tmp = Float64(n * 100.0); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[(100.0 * N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(100.0 * N[(t$95$0 * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n} + -1\\
t_1 := \frac{t\_0}{\frac{i}{n}}\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;100 \cdot \left(\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot \frac{n}{i}\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;100 \cdot \left(t\_0 \cdot \frac{n}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < -0.0Initial program 25.5%
clear-num25.5%
associate-/r/25.5%
clear-num25.2%
add-exp-log25.2%
expm1-define25.2%
log-pow34.6%
log1p-define95.0%
Applied egg-rr95.0%
if -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 98.8%
clear-num98.8%
associate-/r/98.8%
clear-num98.9%
add-exp-log98.9%
expm1-define98.9%
log-pow36.6%
log1p-define36.6%
Applied egg-rr36.6%
expm1-undefine35.7%
*-commutative35.7%
log1p-undefine35.7%
exp-to-pow98.9%
Applied egg-rr98.9%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) Initial program 0.0%
associate-/r/1.8%
associate-*r*1.8%
*-commutative1.8%
associate-*r/1.8%
sub-neg1.8%
distribute-lft-in1.8%
metadata-eval1.8%
metadata-eval1.8%
metadata-eval1.8%
fma-define1.8%
metadata-eval1.8%
Simplified1.8%
Taylor expanded in i around 0 77.7%
Final simplification92.6%
(FPCore (i n)
:precision binary64
(if (<= i 1.06e-33)
(* 100.0 (* n (/ (expm1 i) i)))
(if (<= i 9.5e+158)
(* i (log (exp (* n (+ 50.0 (/ 100.0 i))))))
(* 100.0 (- (* n (/ (pow (+ 1.0 (/ i n)) n) i)) (/ n i))))))
double code(double i, double n) {
double tmp;
if (i <= 1.06e-33) {
tmp = 100.0 * (n * (expm1(i) / i));
} else if (i <= 9.5e+158) {
tmp = i * log(exp((n * (50.0 + (100.0 / i)))));
} else {
tmp = 100.0 * ((n * (pow((1.0 + (i / n)), n) / i)) - (n / i));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if (i <= 1.06e-33) {
tmp = 100.0 * (n * (Math.expm1(i) / i));
} else if (i <= 9.5e+158) {
tmp = i * Math.log(Math.exp((n * (50.0 + (100.0 / i)))));
} else {
tmp = 100.0 * ((n * (Math.pow((1.0 + (i / n)), n) / i)) - (n / i));
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 1.06e-33: tmp = 100.0 * (n * (math.expm1(i) / i)) elif i <= 9.5e+158: tmp = i * math.log(math.exp((n * (50.0 + (100.0 / i))))) else: tmp = 100.0 * ((n * (math.pow((1.0 + (i / n)), n) / i)) - (n / i)) return tmp
function code(i, n) tmp = 0.0 if (i <= 1.06e-33) tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); elseif (i <= 9.5e+158) tmp = Float64(i * log(exp(Float64(n * Float64(50.0 + Float64(100.0 / i)))))); else tmp = Float64(100.0 * Float64(Float64(n * Float64((Float64(1.0 + Float64(i / n)) ^ n) / i)) - Float64(n / i))); end return tmp end
code[i_, n_] := If[LessEqual[i, 1.06e-33], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 9.5e+158], N[(i * N[Log[N[Exp[N[(n * N[(50.0 + N[(100.0 / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(N[(n * N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision] - N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 1.06 \cdot 10^{-33}:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;i \leq 9.5 \cdot 10^{+158}:\\
\;\;\;\;i \cdot \log \left(e^{n \cdot \left(50 + \frac{100}{i}\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n}}{i} - \frac{n}{i}\right)\\
\end{array}
\end{array}
if i < 1.0599999999999999e-33Initial program 19.6%
Taylor expanded in n around inf 24.5%
associate-/l*24.5%
expm1-define83.9%
Simplified83.9%
if 1.0599999999999999e-33 < i < 9.49999999999999913e158Initial program 47.4%
associate-*r/47.4%
sub-neg47.4%
distribute-rgt-in47.4%
metadata-eval47.4%
metadata-eval47.4%
Simplified47.4%
Taylor expanded in n around inf 44.9%
Taylor expanded in i around 0 21.0%
*-commutative21.0%
Simplified21.0%
Taylor expanded in i around inf 12.6%
add-log-exp70.8%
associate-*r/70.8%
associate-*l/70.8%
distribute-rgt-out70.8%
Applied egg-rr70.8%
if 9.49999999999999913e158 < i Initial program 67.8%
clear-num67.8%
associate-/r/67.8%
clear-num67.9%
add-exp-log67.9%
expm1-define67.9%
log-pow27.7%
log1p-define35.9%
Applied egg-rr35.9%
*-commutative35.9%
clear-num35.9%
div-inv35.9%
expm1-undefine31.8%
div-sub31.8%
*-commutative31.8%
log1p-undefine23.6%
exp-to-pow67.8%
clear-num67.9%
Applied egg-rr67.9%
associate-/r/68.2%
Simplified68.2%
Final simplification80.0%
(FPCore (i n) :precision binary64 (if (or (<= n -8e-244) (not (<= n 3.1e-155))) (* 100.0 (* n (/ (expm1 i) i))) (/ 0.0 (/ i n))))
double code(double i, double n) {
double tmp;
if ((n <= -8e-244) || !(n <= 3.1e-155)) {
tmp = 100.0 * (n * (expm1(i) / i));
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((n <= -8e-244) || !(n <= 3.1e-155)) {
tmp = 100.0 * (n * (Math.expm1(i) / i));
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -8e-244) or not (n <= 3.1e-155): tmp = 100.0 * (n * (math.expm1(i) / i)) else: tmp = 0.0 / (i / n) return tmp
function code(i, n) tmp = 0.0 if ((n <= -8e-244) || !(n <= 3.1e-155)) tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); else tmp = Float64(0.0 / Float64(i / n)); end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -8e-244], N[Not[LessEqual[n, 3.1e-155]], $MachinePrecision]], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -8 \cdot 10^{-244} \lor \neg \left(n \leq 3.1 \cdot 10^{-155}\right):\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -7.9999999999999994e-244 or 3.1e-155 < n Initial program 26.8%
Taylor expanded in n around inf 27.1%
associate-/l*27.1%
expm1-define79.2%
Simplified79.2%
if -7.9999999999999994e-244 < n < 3.1e-155Initial program 46.2%
associate-*r/46.2%
sub-neg46.2%
distribute-rgt-in46.2%
metadata-eval46.2%
metadata-eval46.2%
Simplified46.2%
Taylor expanded in i around 0 68.2%
Final simplification77.4%
(FPCore (i n)
:precision binary64
(if (<= n -1.15e-163)
(+ (* n 100.0) (* i (+ (* 16.666666666666668 (* i n)) (* n 50.0))))
(if (<= n 8.4e-156)
(/ 0.0 (/ i n))
(+
(* n 100.0)
(*
i
(+
(* n 50.0)
(* i (+ (* (* i n) 4.166666666666667) (* n 16.666666666666668)))))))))
double code(double i, double n) {
double tmp;
if (n <= -1.15e-163) {
tmp = (n * 100.0) + (i * ((16.666666666666668 * (i * n)) + (n * 50.0)));
} else if (n <= 8.4e-156) {
tmp = 0.0 / (i / n);
} else {
tmp = (n * 100.0) + (i * ((n * 50.0) + (i * (((i * n) * 4.166666666666667) + (n * 16.666666666666668)))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-1.15d-163)) then
tmp = (n * 100.0d0) + (i * ((16.666666666666668d0 * (i * n)) + (n * 50.0d0)))
else if (n <= 8.4d-156) then
tmp = 0.0d0 / (i / n)
else
tmp = (n * 100.0d0) + (i * ((n * 50.0d0) + (i * (((i * n) * 4.166666666666667d0) + (n * 16.666666666666668d0)))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -1.15e-163) {
tmp = (n * 100.0) + (i * ((16.666666666666668 * (i * n)) + (n * 50.0)));
} else if (n <= 8.4e-156) {
tmp = 0.0 / (i / n);
} else {
tmp = (n * 100.0) + (i * ((n * 50.0) + (i * (((i * n) * 4.166666666666667) + (n * 16.666666666666668)))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -1.15e-163: tmp = (n * 100.0) + (i * ((16.666666666666668 * (i * n)) + (n * 50.0))) elif n <= 8.4e-156: tmp = 0.0 / (i / n) else: tmp = (n * 100.0) + (i * ((n * 50.0) + (i * (((i * n) * 4.166666666666667) + (n * 16.666666666666668))))) return tmp
function code(i, n) tmp = 0.0 if (n <= -1.15e-163) tmp = Float64(Float64(n * 100.0) + Float64(i * Float64(Float64(16.666666666666668 * Float64(i * n)) + Float64(n * 50.0)))); elseif (n <= 8.4e-156) tmp = Float64(0.0 / Float64(i / n)); else tmp = Float64(Float64(n * 100.0) + Float64(i * Float64(Float64(n * 50.0) + Float64(i * Float64(Float64(Float64(i * n) * 4.166666666666667) + Float64(n * 16.666666666666668)))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -1.15e-163) tmp = (n * 100.0) + (i * ((16.666666666666668 * (i * n)) + (n * 50.0))); elseif (n <= 8.4e-156) tmp = 0.0 / (i / n); else tmp = (n * 100.0) + (i * ((n * 50.0) + (i * (((i * n) * 4.166666666666667) + (n * 16.666666666666668))))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -1.15e-163], N[(N[(n * 100.0), $MachinePrecision] + N[(i * N[(N[(16.666666666666668 * N[(i * n), $MachinePrecision]), $MachinePrecision] + N[(n * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 8.4e-156], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(N[(n * 100.0), $MachinePrecision] + N[(i * N[(N[(n * 50.0), $MachinePrecision] + N[(i * N[(N[(N[(i * n), $MachinePrecision] * 4.166666666666667), $MachinePrecision] + N[(n * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.15 \cdot 10^{-163}:\\
\;\;\;\;n \cdot 100 + i \cdot \left(16.666666666666668 \cdot \left(i \cdot n\right) + n \cdot 50\right)\\
\mathbf{elif}\;n \leq 8.4 \cdot 10^{-156}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100 + i \cdot \left(n \cdot 50 + i \cdot \left(\left(i \cdot n\right) \cdot 4.166666666666667 + n \cdot 16.666666666666668\right)\right)\\
\end{array}
\end{array}
if n < -1.15e-163Initial program 30.6%
associate-*r/30.6%
sub-neg30.6%
distribute-rgt-in30.6%
metadata-eval30.6%
metadata-eval30.6%
Simplified30.6%
Taylor expanded in n around inf 26.1%
Taylor expanded in i around 0 56.6%
if -1.15e-163 < n < 8.40000000000000049e-156Initial program 47.3%
associate-*r/47.3%
sub-neg47.3%
distribute-rgt-in47.3%
metadata-eval47.3%
metadata-eval47.3%
Simplified47.3%
Taylor expanded in i around 0 65.7%
if 8.40000000000000049e-156 < n Initial program 20.1%
associate-*r/20.1%
sub-neg20.1%
distribute-rgt-in20.1%
metadata-eval20.1%
metadata-eval20.1%
Simplified20.1%
Taylor expanded in n around inf 27.1%
Taylor expanded in i around 0 78.1%
Final simplification66.2%
(FPCore (i n)
:precision binary64
(if (<= n -6.4e-164)
(* 100.0 (+ n (* (* i n) (- 0.5 (/ 0.5 n)))))
(if (<= n 2.9e-233)
(/ 0.0 (/ i n))
(if (<= n 0.00047)
(* 100.0 (* i (/ n i)))
(* (/ 1.0 i) (* i (* n (+ 100.0 (* i 50.0)))))))))
double code(double i, double n) {
double tmp;
if (n <= -6.4e-164) {
tmp = 100.0 * (n + ((i * n) * (0.5 - (0.5 / n))));
} else if (n <= 2.9e-233) {
tmp = 0.0 / (i / n);
} else if (n <= 0.00047) {
tmp = 100.0 * (i * (n / i));
} else {
tmp = (1.0 / i) * (i * (n * (100.0 + (i * 50.0))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-6.4d-164)) then
tmp = 100.0d0 * (n + ((i * n) * (0.5d0 - (0.5d0 / n))))
else if (n <= 2.9d-233) then
tmp = 0.0d0 / (i / n)
else if (n <= 0.00047d0) then
tmp = 100.0d0 * (i * (n / i))
else
tmp = (1.0d0 / i) * (i * (n * (100.0d0 + (i * 50.0d0))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -6.4e-164) {
tmp = 100.0 * (n + ((i * n) * (0.5 - (0.5 / n))));
} else if (n <= 2.9e-233) {
tmp = 0.0 / (i / n);
} else if (n <= 0.00047) {
tmp = 100.0 * (i * (n / i));
} else {
tmp = (1.0 / i) * (i * (n * (100.0 + (i * 50.0))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -6.4e-164: tmp = 100.0 * (n + ((i * n) * (0.5 - (0.5 / n)))) elif n <= 2.9e-233: tmp = 0.0 / (i / n) elif n <= 0.00047: tmp = 100.0 * (i * (n / i)) else: tmp = (1.0 / i) * (i * (n * (100.0 + (i * 50.0)))) return tmp
function code(i, n) tmp = 0.0 if (n <= -6.4e-164) tmp = Float64(100.0 * Float64(n + Float64(Float64(i * n) * Float64(0.5 - Float64(0.5 / n))))); elseif (n <= 2.9e-233) tmp = Float64(0.0 / Float64(i / n)); elseif (n <= 0.00047) tmp = Float64(100.0 * Float64(i * Float64(n / i))); else tmp = Float64(Float64(1.0 / i) * Float64(i * Float64(n * Float64(100.0 + Float64(i * 50.0))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -6.4e-164) tmp = 100.0 * (n + ((i * n) * (0.5 - (0.5 / n)))); elseif (n <= 2.9e-233) tmp = 0.0 / (i / n); elseif (n <= 0.00047) tmp = 100.0 * (i * (n / i)); else tmp = (1.0 / i) * (i * (n * (100.0 + (i * 50.0)))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -6.4e-164], N[(100.0 * N[(n + N[(N[(i * n), $MachinePrecision] * N[(0.5 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.9e-233], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 0.00047], N[(100.0 * N[(i * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / i), $MachinePrecision] * N[(i * N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -6.4 \cdot 10^{-164}:\\
\;\;\;\;100 \cdot \left(n + \left(i \cdot n\right) \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\\
\mathbf{elif}\;n \leq 2.9 \cdot 10^{-233}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 0.00047:\\
\;\;\;\;100 \cdot \left(i \cdot \frac{n}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{i} \cdot \left(i \cdot \left(n \cdot \left(100 + i \cdot 50\right)\right)\right)\\
\end{array}
\end{array}
if n < -6.4000000000000001e-164Initial program 30.6%
associate-/r/30.3%
associate-*r*30.4%
*-commutative30.4%
associate-*r/30.4%
sub-neg30.4%
distribute-lft-in30.4%
metadata-eval30.4%
metadata-eval30.4%
metadata-eval30.4%
fma-define30.4%
metadata-eval30.4%
Simplified30.4%
Taylor expanded in i around 0 56.1%
distribute-lft-out56.1%
associate-*r*56.1%
associate-*r/56.1%
metadata-eval56.1%
Simplified56.1%
if -6.4000000000000001e-164 < n < 2.89999999999999982e-233Initial program 59.1%
associate-*r/59.1%
sub-neg59.1%
distribute-rgt-in59.1%
metadata-eval59.1%
metadata-eval59.1%
Simplified59.1%
Taylor expanded in i around 0 75.3%
if 2.89999999999999982e-233 < n < 4.69999999999999986e-4Initial program 20.4%
clear-num20.4%
associate-/r/20.4%
clear-num20.4%
add-exp-log20.4%
expm1-define20.4%
log-pow43.3%
log1p-define87.6%
Applied egg-rr87.6%
Taylor expanded in i around 0 61.2%
if 4.69999999999999986e-4 < n Initial program 21.7%
associate-*r/21.7%
sub-neg21.7%
distribute-rgt-in21.7%
metadata-eval21.7%
metadata-eval21.7%
Simplified21.7%
Taylor expanded in n around inf 35.8%
Taylor expanded in i around 0 54.2%
*-commutative54.2%
Simplified54.2%
*-un-lft-identity54.2%
div-inv54.0%
times-frac78.9%
+-commutative78.9%
fma-define78.9%
Applied egg-rr78.9%
Taylor expanded in n around 0 78.9%
Final simplification65.4%
(FPCore (i n)
:precision binary64
(if (or (<= n -1.5e-163) (not (<= n 2.7e-155)))
(*
n
(+
100.0
(* i (+ 50.0 (* i (+ 16.666666666666668 (* i 4.166666666666667)))))))
(/ 0.0 (/ i n))))
double code(double i, double n) {
double tmp;
if ((n <= -1.5e-163) || !(n <= 2.7e-155)) {
tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-1.5d-163)) .or. (.not. (n <= 2.7d-155))) then
tmp = n * (100.0d0 + (i * (50.0d0 + (i * (16.666666666666668d0 + (i * 4.166666666666667d0))))))
else
tmp = 0.0d0 / (i / n)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -1.5e-163) || !(n <= 2.7e-155)) {
tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -1.5e-163) or not (n <= 2.7e-155): tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667)))))) else: tmp = 0.0 / (i / n) return tmp
function code(i, n) tmp = 0.0 if ((n <= -1.5e-163) || !(n <= 2.7e-155)) tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * Float64(16.666666666666668 + Float64(i * 4.166666666666667))))))); else tmp = Float64(0.0 / Float64(i / n)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -1.5e-163) || ~((n <= 2.7e-155))) tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667)))))); else tmp = 0.0 / (i / n); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -1.5e-163], N[Not[LessEqual[n, 2.7e-155]], $MachinePrecision]], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * N[(16.666666666666668 + N[(i * 4.166666666666667), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.5 \cdot 10^{-163} \lor \neg \left(n \leq 2.7 \cdot 10^{-155}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot \left(16.666666666666668 + i \cdot 4.166666666666667\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -1.5000000000000001e-163 or 2.69999999999999981e-155 < n Initial program 25.8%
associate-*r/25.8%
sub-neg25.8%
distribute-rgt-in25.8%
metadata-eval25.8%
metadata-eval25.8%
Simplified25.8%
Taylor expanded in n around inf 26.6%
Taylor expanded in i around 0 50.3%
*-commutative50.3%
Simplified50.3%
Taylor expanded in n around 0 66.1%
if -1.5000000000000001e-163 < n < 2.69999999999999981e-155Initial program 47.3%
associate-*r/47.3%
sub-neg47.3%
distribute-rgt-in47.3%
metadata-eval47.3%
metadata-eval47.3%
Simplified47.3%
Taylor expanded in i around 0 65.7%
Final simplification66.0%
(FPCore (i n)
:precision binary64
(if (<= n -9.5e-162)
(+ (* n 100.0) (* i (+ (* 16.666666666666668 (* i n)) (* n 50.0))))
(if (<= n 9.5e-155)
(/ 0.0 (/ i n))
(*
n
(+
100.0
(* i (+ 50.0 (* i (+ 16.666666666666668 (* i 4.166666666666667))))))))))
double code(double i, double n) {
double tmp;
if (n <= -9.5e-162) {
tmp = (n * 100.0) + (i * ((16.666666666666668 * (i * n)) + (n * 50.0)));
} else if (n <= 9.5e-155) {
tmp = 0.0 / (i / n);
} else {
tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-9.5d-162)) then
tmp = (n * 100.0d0) + (i * ((16.666666666666668d0 * (i * n)) + (n * 50.0d0)))
else if (n <= 9.5d-155) then
tmp = 0.0d0 / (i / n)
else
tmp = n * (100.0d0 + (i * (50.0d0 + (i * (16.666666666666668d0 + (i * 4.166666666666667d0))))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -9.5e-162) {
tmp = (n * 100.0) + (i * ((16.666666666666668 * (i * n)) + (n * 50.0)));
} else if (n <= 9.5e-155) {
tmp = 0.0 / (i / n);
} else {
tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -9.5e-162: tmp = (n * 100.0) + (i * ((16.666666666666668 * (i * n)) + (n * 50.0))) elif n <= 9.5e-155: tmp = 0.0 / (i / n) else: tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667)))))) return tmp
function code(i, n) tmp = 0.0 if (n <= -9.5e-162) tmp = Float64(Float64(n * 100.0) + Float64(i * Float64(Float64(16.666666666666668 * Float64(i * n)) + Float64(n * 50.0)))); elseif (n <= 9.5e-155) tmp = Float64(0.0 / Float64(i / n)); else tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * Float64(16.666666666666668 + Float64(i * 4.166666666666667))))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -9.5e-162) tmp = (n * 100.0) + (i * ((16.666666666666668 * (i * n)) + (n * 50.0))); elseif (n <= 9.5e-155) tmp = 0.0 / (i / n); else tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667)))))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -9.5e-162], N[(N[(n * 100.0), $MachinePrecision] + N[(i * N[(N[(16.666666666666668 * N[(i * n), $MachinePrecision]), $MachinePrecision] + N[(n * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 9.5e-155], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * N[(16.666666666666668 + N[(i * 4.166666666666667), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -9.5 \cdot 10^{-162}:\\
\;\;\;\;n \cdot 100 + i \cdot \left(16.666666666666668 \cdot \left(i \cdot n\right) + n \cdot 50\right)\\
\mathbf{elif}\;n \leq 9.5 \cdot 10^{-155}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot \left(16.666666666666668 + i \cdot 4.166666666666667\right)\right)\right)\\
\end{array}
\end{array}
if n < -9.5000000000000004e-162Initial program 30.6%
associate-*r/30.6%
sub-neg30.6%
distribute-rgt-in30.6%
metadata-eval30.6%
metadata-eval30.6%
Simplified30.6%
Taylor expanded in n around inf 26.1%
Taylor expanded in i around 0 56.6%
if -9.5000000000000004e-162 < n < 9.50000000000000024e-155Initial program 47.3%
associate-*r/47.3%
sub-neg47.3%
distribute-rgt-in47.3%
metadata-eval47.3%
metadata-eval47.3%
Simplified47.3%
Taylor expanded in i around 0 65.7%
if 9.50000000000000024e-155 < n Initial program 20.1%
associate-*r/20.1%
sub-neg20.1%
distribute-rgt-in20.1%
metadata-eval20.1%
metadata-eval20.1%
Simplified20.1%
Taylor expanded in n around inf 27.1%
Taylor expanded in i around 0 61.4%
*-commutative61.4%
Simplified61.4%
Taylor expanded in n around 0 78.1%
Final simplification66.2%
(FPCore (i n) :precision binary64 (if (<= n -1.22e-163) (* 100.0 (+ n (* (* i n) (- 0.5 (/ 0.5 n))))) (if (<= n 8.8e-156) (/ 0.0 (/ i n)) (* n (+ 100.0 (* i 50.0))))))
double code(double i, double n) {
double tmp;
if (n <= -1.22e-163) {
tmp = 100.0 * (n + ((i * n) * (0.5 - (0.5 / n))));
} else if (n <= 8.8e-156) {
tmp = 0.0 / (i / n);
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-1.22d-163)) then
tmp = 100.0d0 * (n + ((i * n) * (0.5d0 - (0.5d0 / n))))
else if (n <= 8.8d-156) then
tmp = 0.0d0 / (i / n)
else
tmp = n * (100.0d0 + (i * 50.0d0))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -1.22e-163) {
tmp = 100.0 * (n + ((i * n) * (0.5 - (0.5 / n))));
} else if (n <= 8.8e-156) {
tmp = 0.0 / (i / n);
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -1.22e-163: tmp = 100.0 * (n + ((i * n) * (0.5 - (0.5 / n)))) elif n <= 8.8e-156: tmp = 0.0 / (i / n) else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) tmp = 0.0 if (n <= -1.22e-163) tmp = Float64(100.0 * Float64(n + Float64(Float64(i * n) * Float64(0.5 - Float64(0.5 / n))))); elseif (n <= 8.8e-156) tmp = Float64(0.0 / Float64(i / n)); else tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -1.22e-163) tmp = 100.0 * (n + ((i * n) * (0.5 - (0.5 / n)))); elseif (n <= 8.8e-156) tmp = 0.0 / (i / n); else tmp = n * (100.0 + (i * 50.0)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -1.22e-163], N[(100.0 * N[(n + N[(N[(i * n), $MachinePrecision] * N[(0.5 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 8.8e-156], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.22 \cdot 10^{-163}:\\
\;\;\;\;100 \cdot \left(n + \left(i \cdot n\right) \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\\
\mathbf{elif}\;n \leq 8.8 \cdot 10^{-156}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < -1.22000000000000003e-163Initial program 30.6%
associate-/r/30.3%
associate-*r*30.4%
*-commutative30.4%
associate-*r/30.4%
sub-neg30.4%
distribute-lft-in30.4%
metadata-eval30.4%
metadata-eval30.4%
metadata-eval30.4%
fma-define30.4%
metadata-eval30.4%
Simplified30.4%
Taylor expanded in i around 0 56.1%
distribute-lft-out56.1%
associate-*r*56.1%
associate-*r/56.1%
metadata-eval56.1%
Simplified56.1%
if -1.22000000000000003e-163 < n < 8.7999999999999996e-156Initial program 47.3%
associate-*r/47.3%
sub-neg47.3%
distribute-rgt-in47.3%
metadata-eval47.3%
metadata-eval47.3%
Simplified47.3%
Taylor expanded in i around 0 65.7%
if 8.7999999999999996e-156 < n Initial program 20.1%
associate-*r/20.1%
sub-neg20.1%
distribute-rgt-in20.1%
metadata-eval20.1%
metadata-eval20.1%
Simplified20.1%
Taylor expanded in n around inf 27.1%
Taylor expanded in i around 0 55.4%
*-commutative55.4%
Simplified55.4%
Taylor expanded in n around 0 69.2%
Final simplification62.8%
(FPCore (i n) :precision binary64 (if (or (<= n -4.5e-163) (not (<= n 5.4e-152))) (* n (+ 100.0 (* i 50.0))) (/ 0.0 (/ i n))))
double code(double i, double n) {
double tmp;
if ((n <= -4.5e-163) || !(n <= 5.4e-152)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-4.5d-163)) .or. (.not. (n <= 5.4d-152))) then
tmp = n * (100.0d0 + (i * 50.0d0))
else
tmp = 0.0d0 / (i / n)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -4.5e-163) || !(n <= 5.4e-152)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -4.5e-163) or not (n <= 5.4e-152): tmp = n * (100.0 + (i * 50.0)) else: tmp = 0.0 / (i / n) return tmp
function code(i, n) tmp = 0.0 if ((n <= -4.5e-163) || !(n <= 5.4e-152)) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); else tmp = Float64(0.0 / Float64(i / n)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -4.5e-163) || ~((n <= 5.4e-152))) tmp = n * (100.0 + (i * 50.0)); else tmp = 0.0 / (i / n); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -4.5e-163], N[Not[LessEqual[n, 5.4e-152]], $MachinePrecision]], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -4.5 \cdot 10^{-163} \lor \neg \left(n \leq 5.4 \cdot 10^{-152}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -4.4999999999999997e-163 or 5.39999999999999997e-152 < n Initial program 25.8%
associate-*r/25.8%
sub-neg25.8%
distribute-rgt-in25.8%
metadata-eval25.8%
metadata-eval25.8%
Simplified25.8%
Taylor expanded in n around inf 26.6%
Taylor expanded in i around 0 47.6%
*-commutative47.6%
Simplified47.6%
Taylor expanded in n around 0 62.0%
if -4.4999999999999997e-163 < n < 5.39999999999999997e-152Initial program 47.3%
associate-*r/47.3%
sub-neg47.3%
distribute-rgt-in47.3%
metadata-eval47.3%
metadata-eval47.3%
Simplified47.3%
Taylor expanded in i around 0 65.7%
Final simplification62.7%
(FPCore (i n) :precision binary64 (if (or (<= n -1.95e+22) (not (<= n 0.00047))) (* n (+ 100.0 (* i 50.0))) (* 100.0 (/ i (/ i n)))))
double code(double i, double n) {
double tmp;
if ((n <= -1.95e+22) || !(n <= 0.00047)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-1.95d+22)) .or. (.not. (n <= 0.00047d0))) then
tmp = n * (100.0d0 + (i * 50.0d0))
else
tmp = 100.0d0 * (i / (i / n))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -1.95e+22) || !(n <= 0.00047)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -1.95e+22) or not (n <= 0.00047): tmp = n * (100.0 + (i * 50.0)) else: tmp = 100.0 * (i / (i / n)) return tmp
function code(i, n) tmp = 0.0 if ((n <= -1.95e+22) || !(n <= 0.00047)) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); else tmp = Float64(100.0 * Float64(i / Float64(i / n))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -1.95e+22) || ~((n <= 0.00047))) tmp = n * (100.0 + (i * 50.0)); else tmp = 100.0 * (i / (i / n)); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -1.95e+22], N[Not[LessEqual[n, 0.00047]], $MachinePrecision]], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.95 \cdot 10^{+22} \lor \neg \left(n \leq 0.00047\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -1.9500000000000001e22 or 4.69999999999999986e-4 < n Initial program 28.7%
associate-*r/28.8%
sub-neg28.8%
distribute-rgt-in28.8%
metadata-eval28.8%
metadata-eval28.8%
Simplified28.8%
Taylor expanded in n around inf 34.3%
Taylor expanded in i around 0 40.6%
*-commutative40.6%
Simplified40.6%
Taylor expanded in n around 0 61.6%
if -1.9500000000000001e22 < n < 4.69999999999999986e-4Initial program 31.4%
Taylor expanded in i around 0 60.8%
Final simplification61.2%
(FPCore (i n) :precision binary64 (if (or (<= i -5e-15) (not (<= i 3.1e-56))) (* 100.0 (/ i (/ i n))) (* n 100.0)))
double code(double i, double n) {
double tmp;
if ((i <= -5e-15) || !(i <= 3.1e-56)) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = n * 100.0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((i <= (-5d-15)) .or. (.not. (i <= 3.1d-56))) then
tmp = 100.0d0 * (i / (i / n))
else
tmp = n * 100.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((i <= -5e-15) || !(i <= 3.1e-56)) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = n * 100.0;
}
return tmp;
}
def code(i, n): tmp = 0 if (i <= -5e-15) or not (i <= 3.1e-56): tmp = 100.0 * (i / (i / n)) else: tmp = n * 100.0 return tmp
function code(i, n) tmp = 0.0 if ((i <= -5e-15) || !(i <= 3.1e-56)) tmp = Float64(100.0 * Float64(i / Float64(i / n))); else tmp = Float64(n * 100.0); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((i <= -5e-15) || ~((i <= 3.1e-56))) tmp = 100.0 * (i / (i / n)); else tmp = n * 100.0; end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[i, -5e-15], N[Not[LessEqual[i, 3.1e-56]], $MachinePrecision]], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -5 \cdot 10^{-15} \lor \neg \left(i \leq 3.1 \cdot 10^{-56}\right):\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if i < -4.99999999999999999e-15 or 3.09999999999999987e-56 < i Initial program 53.6%
Taylor expanded in i around 0 24.8%
if -4.99999999999999999e-15 < i < 3.09999999999999987e-56Initial program 8.1%
associate-/r/8.5%
associate-*r*8.5%
*-commutative8.5%
associate-*r/8.5%
sub-neg8.5%
distribute-lft-in8.5%
metadata-eval8.5%
metadata-eval8.5%
metadata-eval8.5%
fma-define8.5%
metadata-eval8.5%
Simplified8.5%
Taylor expanded in i around 0 87.2%
Final simplification57.2%
(FPCore (i n) :precision binary64 (if (or (<= i -2e+112) (not (<= i 1.42e-21))) (* 100.0 (* i (/ n i))) (* n 100.0)))
double code(double i, double n) {
double tmp;
if ((i <= -2e+112) || !(i <= 1.42e-21)) {
tmp = 100.0 * (i * (n / i));
} else {
tmp = n * 100.0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((i <= (-2d+112)) .or. (.not. (i <= 1.42d-21))) then
tmp = 100.0d0 * (i * (n / i))
else
tmp = n * 100.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((i <= -2e+112) || !(i <= 1.42e-21)) {
tmp = 100.0 * (i * (n / i));
} else {
tmp = n * 100.0;
}
return tmp;
}
def code(i, n): tmp = 0 if (i <= -2e+112) or not (i <= 1.42e-21): tmp = 100.0 * (i * (n / i)) else: tmp = n * 100.0 return tmp
function code(i, n) tmp = 0.0 if ((i <= -2e+112) || !(i <= 1.42e-21)) tmp = Float64(100.0 * Float64(i * Float64(n / i))); else tmp = Float64(n * 100.0); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((i <= -2e+112) || ~((i <= 1.42e-21))) tmp = 100.0 * (i * (n / i)); else tmp = n * 100.0; end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[i, -2e+112], N[Not[LessEqual[i, 1.42e-21]], $MachinePrecision]], N[(100.0 * N[(i * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -2 \cdot 10^{+112} \lor \neg \left(i \leq 1.42 \cdot 10^{-21}\right):\\
\;\;\;\;100 \cdot \left(i \cdot \frac{n}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if i < -1.9999999999999999e112 or 1.42e-21 < i Initial program 61.3%
clear-num61.3%
associate-/r/61.3%
clear-num60.8%
add-exp-log60.8%
expm1-define60.8%
log-pow43.7%
log1p-define65.4%
Applied egg-rr65.4%
Taylor expanded in i around 0 20.6%
if -1.9999999999999999e112 < i < 1.42e-21Initial program 11.4%
associate-/r/11.8%
associate-*r*11.8%
*-commutative11.8%
associate-*r/11.8%
sub-neg11.8%
distribute-lft-in11.8%
metadata-eval11.8%
metadata-eval11.8%
metadata-eval11.8%
fma-define11.8%
metadata-eval11.8%
Simplified11.8%
Taylor expanded in i around 0 77.7%
Final simplification56.5%
(FPCore (i n) :precision binary64 (if (<= i 1.15e+23) (* n 100.0) (* i (* n 50.0))))
double code(double i, double n) {
double tmp;
if (i <= 1.15e+23) {
tmp = n * 100.0;
} else {
tmp = i * (n * 50.0);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= 1.15d+23) then
tmp = n * 100.0d0
else
tmp = i * (n * 50.0d0)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= 1.15e+23) {
tmp = n * 100.0;
} else {
tmp = i * (n * 50.0);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 1.15e+23: tmp = n * 100.0 else: tmp = i * (n * 50.0) return tmp
function code(i, n) tmp = 0.0 if (i <= 1.15e+23) tmp = Float64(n * 100.0); else tmp = Float64(i * Float64(n * 50.0)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= 1.15e+23) tmp = n * 100.0; else tmp = i * (n * 50.0); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, 1.15e+23], N[(n * 100.0), $MachinePrecision], N[(i * N[(n * 50.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 1.15 \cdot 10^{+23}:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;i \cdot \left(n \cdot 50\right)\\
\end{array}
\end{array}
if i < 1.15e23Initial program 21.4%
associate-/r/21.4%
associate-*r*21.5%
*-commutative21.5%
associate-*r/21.5%
sub-neg21.5%
distribute-lft-in21.5%
metadata-eval21.5%
metadata-eval21.5%
metadata-eval21.5%
fma-define21.5%
metadata-eval21.5%
Simplified21.5%
Taylor expanded in i around 0 63.8%
if 1.15e23 < i Initial program 61.1%
associate-*r/61.1%
sub-neg61.1%
distribute-rgt-in61.1%
metadata-eval61.1%
metadata-eval61.1%
Simplified61.1%
Taylor expanded in n around inf 36.9%
Taylor expanded in i around 0 25.5%
*-commutative25.5%
Simplified25.5%
Taylor expanded in i around inf 19.0%
*-commutative19.0%
associate-*r*19.0%
Simplified19.0%
Final simplification54.2%
(FPCore (i n) :precision binary64 (if (<= i 1.15e+23) (* n 100.0) (* 50.0 (* i n))))
double code(double i, double n) {
double tmp;
if (i <= 1.15e+23) {
tmp = n * 100.0;
} else {
tmp = 50.0 * (i * n);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= 1.15d+23) then
tmp = n * 100.0d0
else
tmp = 50.0d0 * (i * n)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= 1.15e+23) {
tmp = n * 100.0;
} else {
tmp = 50.0 * (i * n);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 1.15e+23: tmp = n * 100.0 else: tmp = 50.0 * (i * n) return tmp
function code(i, n) tmp = 0.0 if (i <= 1.15e+23) tmp = Float64(n * 100.0); else tmp = Float64(50.0 * Float64(i * n)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= 1.15e+23) tmp = n * 100.0; else tmp = 50.0 * (i * n); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, 1.15e+23], N[(n * 100.0), $MachinePrecision], N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 1.15 \cdot 10^{+23}:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;50 \cdot \left(i \cdot n\right)\\
\end{array}
\end{array}
if i < 1.15e23Initial program 21.4%
associate-/r/21.4%
associate-*r*21.5%
*-commutative21.5%
associate-*r/21.5%
sub-neg21.5%
distribute-lft-in21.5%
metadata-eval21.5%
metadata-eval21.5%
metadata-eval21.5%
fma-define21.5%
metadata-eval21.5%
Simplified21.5%
Taylor expanded in i around 0 63.8%
if 1.15e23 < i Initial program 61.1%
associate-*r/61.1%
sub-neg61.1%
distribute-rgt-in61.1%
metadata-eval61.1%
metadata-eval61.1%
Simplified61.1%
Taylor expanded in n around inf 36.9%
Taylor expanded in i around 0 25.5%
*-commutative25.5%
Simplified25.5%
Taylor expanded in i around inf 19.0%
*-commutative19.0%
Simplified19.0%
Final simplification54.2%
(FPCore (i n) :precision binary64 (* n 100.0))
double code(double i, double n) {
return n * 100.0;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = n * 100.0d0
end function
public static double code(double i, double n) {
return n * 100.0;
}
def code(i, n): return n * 100.0
function code(i, n) return Float64(n * 100.0) end
function tmp = code(i, n) tmp = n * 100.0; end
code[i_, n_] := N[(n * 100.0), $MachinePrecision]
\begin{array}{l}
\\
n \cdot 100
\end{array}
Initial program 29.9%
associate-/r/30.0%
associate-*r*30.0%
*-commutative30.0%
associate-*r/30.0%
sub-neg30.0%
distribute-lft-in30.0%
metadata-eval30.0%
metadata-eval30.0%
metadata-eval30.0%
fma-define30.0%
metadata-eval30.0%
Simplified30.0%
Taylor expanded in i around 0 51.0%
Final simplification51.0%
(FPCore (i n)
:precision binary64
(let* ((t_0 (+ 1.0 (/ i n))))
(*
100.0
(/
(-
(exp
(*
n
(if (== t_0 1.0)
(/ i n)
(/ (* (/ i n) (log t_0)) (- (+ (/ i n) 1.0) 1.0)))))
1.0)
(/ i n)))))
double code(double i, double n) {
double t_0 = 1.0 + (i / n);
double tmp;
if (t_0 == 1.0) {
tmp = i / n;
} else {
tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0) - 1.0);
}
return 100.0 * ((exp((n * tmp)) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + (i / n)
if (t_0 == 1.0d0) then
tmp = i / n
else
tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0d0) - 1.0d0)
end if
code = 100.0d0 * ((exp((n * tmp)) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
double t_0 = 1.0 + (i / n);
double tmp;
if (t_0 == 1.0) {
tmp = i / n;
} else {
tmp = ((i / n) * Math.log(t_0)) / (((i / n) + 1.0) - 1.0);
}
return 100.0 * ((Math.exp((n * tmp)) - 1.0) / (i / n));
}
def code(i, n): t_0 = 1.0 + (i / n) tmp = 0 if t_0 == 1.0: tmp = i / n else: tmp = ((i / n) * math.log(t_0)) / (((i / n) + 1.0) - 1.0) return 100.0 * ((math.exp((n * tmp)) - 1.0) / (i / n))
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) tmp = 0.0 if (t_0 == 1.0) tmp = Float64(i / n); else tmp = Float64(Float64(Float64(i / n) * log(t_0)) / Float64(Float64(Float64(i / n) + 1.0) - 1.0)); end return Float64(100.0 * Float64(Float64(exp(Float64(n * tmp)) - 1.0) / Float64(i / n))) end
function tmp_2 = code(i, n) t_0 = 1.0 + (i / n); tmp = 0.0; if (t_0 == 1.0) tmp = i / n; else tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0) - 1.0); end tmp_2 = 100.0 * ((exp((n * tmp)) - 1.0) / (i / n)); end
code[i_, n_] := Block[{t$95$0 = N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision]}, N[(100.0 * N[(N[(N[Exp[N[(n * If[Equal[t$95$0, 1.0], N[(i / n), $MachinePrecision], N[(N[(N[(i / n), $MachinePrecision] * N[Log[t$95$0], $MachinePrecision]), $MachinePrecision] / N[(N[(N[(i / n), $MachinePrecision] + 1.0), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{i}{n}\\
100 \cdot \frac{e^{n \cdot \begin{array}{l}
\mathbf{if}\;t\_0 = 1:\\
\;\;\;\;\frac{i}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{i}{n} \cdot \log t\_0}{\left(\frac{i}{n} + 1\right) - 1}\\
\end{array}} - 1}{\frac{i}{n}}
\end{array}
\end{array}
herbie shell --seed 2024111
(FPCore (i n)
:name "Compound Interest"
:precision binary64
:alt
(* 100.0 (/ (- (exp (* n (if (== (+ 1.0 (/ i n)) 1.0) (/ i n) (/ (* (/ i n) (log (+ 1.0 (/ i n)))) (- (+ (/ i n) 1.0) 1.0))))) 1.0) (/ i n)))
(* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))