
(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 18 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)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 0.0)
(* 100.0 (/ (expm1 (* n (log1p (/ i n)))) (/ i n)))
(if (<= t_1 INFINITY)
(/ n (/ i (fma t_0 100.0 -100.0)))
(+ 1.0 (fma 100.0 n -1.0))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.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 = n / (i / fma(t_0, 100.0, -100.0));
} else {
tmp = 1.0 + fma(100.0, n, -1.0);
}
return tmp;
}
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.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(n / Float64(i / fma(t_0, 100.0, -100.0))); else tmp = Float64(1.0 + fma(100.0, n, -1.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[(N[(t$95$0 + -1.0), $MachinePrecision] / 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[(n / N[(i / N[(t$95$0 * 100.0 + -100.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(100.0 * n + -1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t\_0 + -1}{\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:\\
\;\;\;\;\frac{n}{\frac{i}{\mathsf{fma}\left(t\_0, 100, -100\right)}}\\
\mathbf{else}:\\
\;\;\;\;1 + \mathsf{fma}\left(100, n, -1\right)\\
\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 24.2%
sub-neg24.2%
metadata-eval24.2%
Applied egg-rr24.2%
metadata-eval24.2%
sub-neg24.2%
exp-to-pow22.4%
log1p-undefine43.2%
*-commutative43.2%
expm1-undefine97.8%
Simplified97.8%
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 99.8%
associate-*r/99.8%
sub-neg99.8%
distribute-rgt-in99.8%
metadata-eval99.8%
metadata-eval99.8%
associate-/r/99.7%
*-commutative99.7%
fma-undefine99.7%
clear-num99.7%
associate-*l/99.8%
*-un-lft-identity99.8%
fma-undefine99.8%
*-commutative99.8%
fma-define99.8%
Applied egg-rr99.8%
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/0.0%
sub-neg0.0%
distribute-rgt-in0.0%
metadata-eval0.0%
metadata-eval0.0%
Simplified0.0%
Taylor expanded in i around 0 15.6%
+-commutative15.6%
Simplified15.6%
expm1-log1p-u15.6%
expm1-undefine15.6%
associate-/r/17.3%
*-commutative17.3%
*-commutative17.3%
fma-define17.3%
Applied egg-rr17.3%
expm1-define2.8%
associate-*r/2.8%
associate-*l/15.6%
fma-undefine15.6%
*-commutative15.6%
distribute-lft1-in15.6%
associate-+l+18.2%
metadata-eval18.2%
+-rgt-identity18.2%
*-commutative18.2%
expm1-define18.2%
log1p-undefine18.2%
rem-exp-log21.0%
associate-+r-21.0%
*-commutative21.0%
associate-*r*21.0%
*-commutative21.0%
fmm-def21.0%
Simplified100.0%
Final simplification98.6%
(FPCore (i n)
:precision binary64
(let* ((t_0 (/ (+ (pow (+ 1.0 (/ i n)) n) -1.0) (/ i n))))
(if (<= t_0 0.0)
(* 100.0 (* n (/ (expm1 i) i)))
(if (<= t_0 INFINITY) (* t_0 100.0) (+ 1.0 (fma 100.0 n -1.0))))))
double code(double i, double n) {
double t_0 = (pow((1.0 + (i / n)), n) + -1.0) / (i / n);
double tmp;
if (t_0 <= 0.0) {
tmp = 100.0 * (n * (expm1(i) / i));
} else if (t_0 <= ((double) INFINITY)) {
tmp = t_0 * 100.0;
} else {
tmp = 1.0 + fma(100.0, n, -1.0);
}
return tmp;
}
function code(i, n) t_0 = Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0) / Float64(i / n)) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); elseif (t_0 <= Inf) tmp = Float64(t_0 * 100.0); else tmp = Float64(1.0 + fma(100.0, n, -1.0)); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(t$95$0 * 100.0), $MachinePrecision], N[(1.0 + N[(100.0 * n + -1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}}\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;t\_0 \cdot 100\\
\mathbf{else}:\\
\;\;\;\;1 + \mathsf{fma}\left(100, n, -1\right)\\
\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 24.2%
Taylor expanded in n around inf 38.9%
*-commutative38.9%
associate-/l*38.9%
expm1-define76.0%
Simplified76.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 99.8%
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/0.0%
sub-neg0.0%
distribute-rgt-in0.0%
metadata-eval0.0%
metadata-eval0.0%
Simplified0.0%
Taylor expanded in i around 0 15.6%
+-commutative15.6%
Simplified15.6%
expm1-log1p-u15.6%
expm1-undefine15.6%
associate-/r/17.3%
*-commutative17.3%
*-commutative17.3%
fma-define17.3%
Applied egg-rr17.3%
expm1-define2.8%
associate-*r/2.8%
associate-*l/15.6%
fma-undefine15.6%
*-commutative15.6%
distribute-lft1-in15.6%
associate-+l+18.2%
metadata-eval18.2%
+-rgt-identity18.2%
*-commutative18.2%
expm1-define18.2%
log1p-undefine18.2%
rem-exp-log21.0%
associate-+r-21.0%
*-commutative21.0%
associate-*r*21.0%
*-commutative21.0%
fmm-def21.0%
Simplified100.0%
Final simplification84.3%
(FPCore (i n)
:precision binary64
(let* ((t_0 (/ (+ (pow (+ 1.0 (/ i n)) n) -1.0) (/ i n))))
(if (<= t_0 0.0)
(* 100.0 (* n (/ (expm1 (* n (log1p (/ i n)))) i)))
(if (<= t_0 INFINITY) (* t_0 100.0) (+ 1.0 (fma 100.0 n -1.0))))))
double code(double i, double n) {
double t_0 = (pow((1.0 + (i / n)), n) + -1.0) / (i / n);
double tmp;
if (t_0 <= 0.0) {
tmp = 100.0 * (n * (expm1((n * log1p((i / n)))) / i));
} else if (t_0 <= ((double) INFINITY)) {
tmp = t_0 * 100.0;
} else {
tmp = 1.0 + fma(100.0, n, -1.0);
}
return tmp;
}
function code(i, n) t_0 = Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0) / Float64(i / n)) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(100.0 * Float64(n * Float64(expm1(Float64(n * log1p(Float64(i / n)))) / i))); elseif (t_0 <= Inf) tmp = Float64(t_0 * 100.0); else tmp = Float64(1.0 + fma(100.0, n, -1.0)); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 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$0, Infinity], N[(t$95$0 * 100.0), $MachinePrecision], N[(1.0 + N[(100.0 * n + -1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}}\\
\mathbf{if}\;t\_0 \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\_0 \leq \infty:\\
\;\;\;\;t\_0 \cdot 100\\
\mathbf{else}:\\
\;\;\;\;1 + \mathsf{fma}\left(100, n, -1\right)\\
\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 24.2%
associate-/r/23.4%
add-exp-log23.4%
expm1-define23.4%
log-pow36.0%
log1p-define95.3%
Applied egg-rr95.3%
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 99.8%
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/0.0%
sub-neg0.0%
distribute-rgt-in0.0%
metadata-eval0.0%
metadata-eval0.0%
Simplified0.0%
Taylor expanded in i around 0 15.6%
+-commutative15.6%
Simplified15.6%
expm1-log1p-u15.6%
expm1-undefine15.6%
associate-/r/17.3%
*-commutative17.3%
*-commutative17.3%
fma-define17.3%
Applied egg-rr17.3%
expm1-define2.8%
associate-*r/2.8%
associate-*l/15.6%
fma-undefine15.6%
*-commutative15.6%
distribute-lft1-in15.6%
associate-+l+18.2%
metadata-eval18.2%
+-rgt-identity18.2%
*-commutative18.2%
expm1-define18.2%
log1p-undefine18.2%
rem-exp-log21.0%
associate-+r-21.0%
*-commutative21.0%
associate-*r*21.0%
*-commutative21.0%
fmm-def21.0%
Simplified100.0%
Final simplification96.9%
(FPCore (i n)
:precision binary64
(let* ((t_0 (/ (+ (pow (+ 1.0 (/ i n)) n) -1.0) (/ i n))))
(if (<= t_0 0.0)
(* 100.0 (/ (expm1 (* n (log1p (/ i n)))) (/ i n)))
(if (<= t_0 INFINITY) (* t_0 100.0) (+ 1.0 (fma 100.0 n -1.0))))))
double code(double i, double n) {
double t_0 = (pow((1.0 + (i / n)), n) + -1.0) / (i / n);
double tmp;
if (t_0 <= 0.0) {
tmp = 100.0 * (expm1((n * log1p((i / n)))) / (i / n));
} else if (t_0 <= ((double) INFINITY)) {
tmp = t_0 * 100.0;
} else {
tmp = 1.0 + fma(100.0, n, -1.0);
}
return tmp;
}
function code(i, n) t_0 = Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0) / Float64(i / n)) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(100.0 * Float64(expm1(Float64(n * log1p(Float64(i / n)))) / Float64(i / n))); elseif (t_0 <= Inf) tmp = Float64(t_0 * 100.0); else tmp = Float64(1.0 + fma(100.0, n, -1.0)); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 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$0, Infinity], N[(t$95$0 * 100.0), $MachinePrecision], N[(1.0 + N[(100.0 * n + -1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}}\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{\frac{i}{n}}\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;t\_0 \cdot 100\\
\mathbf{else}:\\
\;\;\;\;1 + \mathsf{fma}\left(100, n, -1\right)\\
\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 24.2%
sub-neg24.2%
metadata-eval24.2%
Applied egg-rr24.2%
metadata-eval24.2%
sub-neg24.2%
exp-to-pow22.4%
log1p-undefine43.2%
*-commutative43.2%
expm1-undefine97.8%
Simplified97.8%
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 99.8%
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/0.0%
sub-neg0.0%
distribute-rgt-in0.0%
metadata-eval0.0%
metadata-eval0.0%
Simplified0.0%
Taylor expanded in i around 0 15.6%
+-commutative15.6%
Simplified15.6%
expm1-log1p-u15.6%
expm1-undefine15.6%
associate-/r/17.3%
*-commutative17.3%
*-commutative17.3%
fma-define17.3%
Applied egg-rr17.3%
expm1-define2.8%
associate-*r/2.8%
associate-*l/15.6%
fma-undefine15.6%
*-commutative15.6%
distribute-lft1-in15.6%
associate-+l+18.2%
metadata-eval18.2%
+-rgt-identity18.2%
*-commutative18.2%
expm1-define18.2%
log1p-undefine18.2%
rem-exp-log21.0%
associate-+r-21.0%
*-commutative21.0%
associate-*r*21.0%
*-commutative21.0%
fmm-def21.0%
Simplified100.0%
Final simplification98.6%
(FPCore (i n) :precision binary64 (if (or (<= n -1.8e-223) (not (<= n 1.2e-123))) (* n (* (expm1 i) (/ 100.0 i))) (/ 0.0 (/ i n))))
double code(double i, double n) {
double tmp;
if ((n <= -1.8e-223) || !(n <= 1.2e-123)) {
tmp = n * (expm1(i) * (100.0 / i));
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((n <= -1.8e-223) || !(n <= 1.2e-123)) {
tmp = n * (Math.expm1(i) * (100.0 / i));
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -1.8e-223) or not (n <= 1.2e-123): tmp = n * (math.expm1(i) * (100.0 / i)) else: tmp = 0.0 / (i / n) return tmp
function code(i, n) tmp = 0.0 if ((n <= -1.8e-223) || !(n <= 1.2e-123)) tmp = Float64(n * Float64(expm1(i) * Float64(100.0 / i))); else tmp = Float64(0.0 / Float64(i / n)); end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -1.8e-223], N[Not[LessEqual[n, 1.2e-123]], $MachinePrecision]], N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] * N[(100.0 / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.8 \cdot 10^{-223} \lor \neg \left(n \leq 1.2 \cdot 10^{-123}\right):\\
\;\;\;\;n \cdot \left(\mathsf{expm1}\left(i\right) \cdot \frac{100}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -1.8000000000000002e-223 or 1.2e-123 < n Initial program 21.8%
Taylor expanded in n around inf 30.7%
*-commutative30.7%
associate-/l*30.7%
expm1-define84.5%
Simplified84.5%
Taylor expanded in n around 0 30.7%
associate-*r/30.3%
expm1-define79.2%
*-commutative79.2%
associate-*r*79.5%
associate-/l*84.5%
associate-*r/83.6%
Simplified83.6%
if -1.8000000000000002e-223 < n < 1.2e-123Initial program 46.8%
associate-*r/46.8%
sub-neg46.8%
distribute-rgt-in46.8%
metadata-eval46.8%
metadata-eval46.8%
Simplified46.8%
Taylor expanded in i around 0 60.6%
*-commutative60.6%
Simplified60.6%
Taylor expanded in i around 0 70.5%
Final simplification81.6%
(FPCore (i n) :precision binary64 (if (or (<= n -2.6e-222) (not (<= n 1.2e-123))) (* n (/ (expm1 i) (* i 0.01))) (/ 0.0 (/ i n))))
double code(double i, double n) {
double tmp;
if ((n <= -2.6e-222) || !(n <= 1.2e-123)) {
tmp = n * (expm1(i) / (i * 0.01));
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((n <= -2.6e-222) || !(n <= 1.2e-123)) {
tmp = n * (Math.expm1(i) / (i * 0.01));
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -2.6e-222) or not (n <= 1.2e-123): tmp = n * (math.expm1(i) / (i * 0.01)) else: tmp = 0.0 / (i / n) return tmp
function code(i, n) tmp = 0.0 if ((n <= -2.6e-222) || !(n <= 1.2e-123)) tmp = Float64(n * Float64(expm1(i) / Float64(i * 0.01))); else tmp = Float64(0.0 / Float64(i / n)); end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -2.6e-222], N[Not[LessEqual[n, 1.2e-123]], $MachinePrecision]], N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / N[(i * 0.01), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.6 \cdot 10^{-222} \lor \neg \left(n \leq 1.2 \cdot 10^{-123}\right):\\
\;\;\;\;n \cdot \frac{\mathsf{expm1}\left(i\right)}{i \cdot 0.01}\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -2.5999999999999998e-222 or 1.2e-123 < n Initial program 21.8%
Taylor expanded in n around inf 30.7%
*-commutative30.7%
associate-/l*30.7%
expm1-define84.5%
Simplified84.5%
Taylor expanded in n around 0 30.7%
associate-*r/30.3%
expm1-define79.2%
*-commutative79.2%
associate-*r*79.5%
associate-/l*84.5%
associate-*r/83.6%
Simplified83.6%
clear-num83.4%
un-div-inv84.4%
div-inv84.4%
metadata-eval84.4%
Applied egg-rr84.4%
if -2.5999999999999998e-222 < n < 1.2e-123Initial program 46.8%
associate-*r/46.8%
sub-neg46.8%
distribute-rgt-in46.8%
metadata-eval46.8%
metadata-eval46.8%
Simplified46.8%
Taylor expanded in i around 0 60.6%
*-commutative60.6%
Simplified60.6%
Taylor expanded in i around 0 70.5%
Final simplification82.3%
(FPCore (i n) :precision binary64 (if (or (<= n -5e-222) (not (<= n 1.2e-123))) (* n (/ (* 100.0 (expm1 i)) i)) (/ 0.0 (/ i n))))
double code(double i, double n) {
double tmp;
if ((n <= -5e-222) || !(n <= 1.2e-123)) {
tmp = n * ((100.0 * expm1(i)) / i);
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((n <= -5e-222) || !(n <= 1.2e-123)) {
tmp = n * ((100.0 * Math.expm1(i)) / i);
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -5e-222) or not (n <= 1.2e-123): tmp = n * ((100.0 * math.expm1(i)) / i) else: tmp = 0.0 / (i / n) return tmp
function code(i, n) tmp = 0.0 if ((n <= -5e-222) || !(n <= 1.2e-123)) tmp = Float64(n * Float64(Float64(100.0 * expm1(i)) / i)); else tmp = Float64(0.0 / Float64(i / n)); end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -5e-222], N[Not[LessEqual[n, 1.2e-123]], $MachinePrecision]], N[(n * N[(N[(100.0 * N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -5 \cdot 10^{-222} \lor \neg \left(n \leq 1.2 \cdot 10^{-123}\right):\\
\;\;\;\;n \cdot \frac{100 \cdot \mathsf{expm1}\left(i\right)}{i}\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -5.00000000000000008e-222 or 1.2e-123 < n Initial program 21.8%
associate-/r/22.0%
associate-*r*22.0%
*-commutative22.0%
associate-*r/22.1%
sub-neg22.1%
distribute-lft-in22.1%
metadata-eval22.1%
metadata-eval22.1%
metadata-eval22.1%
fma-define22.1%
metadata-eval22.1%
Simplified22.1%
Taylor expanded in n around inf 30.8%
sub-neg30.8%
metadata-eval30.8%
metadata-eval30.8%
distribute-lft-in30.8%
metadata-eval30.8%
sub-neg30.8%
expm1-define84.5%
Simplified84.5%
if -5.00000000000000008e-222 < n < 1.2e-123Initial program 46.8%
associate-*r/46.8%
sub-neg46.8%
distribute-rgt-in46.8%
metadata-eval46.8%
metadata-eval46.8%
Simplified46.8%
Taylor expanded in i around 0 60.6%
*-commutative60.6%
Simplified60.6%
Taylor expanded in i around 0 70.5%
Final simplification82.4%
(FPCore (i n) :precision binary64 (if (<= n -1.4e-220) (* n (/ (* 100.0 (expm1 i)) i)) (if (<= n 1.2e-123) (/ 0.0 (/ i n)) (* 100.0 (* n (/ (expm1 i) i))))))
double code(double i, double n) {
double tmp;
if (n <= -1.4e-220) {
tmp = n * ((100.0 * expm1(i)) / i);
} else if (n <= 1.2e-123) {
tmp = 0.0 / (i / n);
} else {
tmp = 100.0 * (n * (expm1(i) / i));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if (n <= -1.4e-220) {
tmp = n * ((100.0 * Math.expm1(i)) / i);
} else if (n <= 1.2e-123) {
tmp = 0.0 / (i / n);
} else {
tmp = 100.0 * (n * (Math.expm1(i) / i));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -1.4e-220: tmp = n * ((100.0 * math.expm1(i)) / i) elif n <= 1.2e-123: tmp = 0.0 / (i / n) else: tmp = 100.0 * (n * (math.expm1(i) / i)) return tmp
function code(i, n) tmp = 0.0 if (n <= -1.4e-220) tmp = Float64(n * Float64(Float64(100.0 * expm1(i)) / i)); elseif (n <= 1.2e-123) tmp = Float64(0.0 / Float64(i / n)); else tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); end return tmp end
code[i_, n_] := If[LessEqual[n, -1.4e-220], N[(n * N[(N[(100.0 * N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.2e-123], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.4 \cdot 10^{-220}:\\
\;\;\;\;n \cdot \frac{100 \cdot \mathsf{expm1}\left(i\right)}{i}\\
\mathbf{elif}\;n \leq 1.2 \cdot 10^{-123}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\end{array}
\end{array}
if n < -1.4e-220Initial program 24.8%
associate-/r/24.7%
associate-*r*24.8%
*-commutative24.8%
associate-*r/24.8%
sub-neg24.8%
distribute-lft-in24.8%
metadata-eval24.8%
metadata-eval24.8%
metadata-eval24.8%
fma-define24.8%
metadata-eval24.8%
Simplified24.8%
Taylor expanded in n around inf 29.7%
sub-neg29.7%
metadata-eval29.7%
metadata-eval29.7%
distribute-lft-in29.7%
metadata-eval29.7%
sub-neg29.7%
expm1-define81.0%
Simplified81.0%
if -1.4e-220 < n < 1.2e-123Initial program 46.8%
associate-*r/46.8%
sub-neg46.8%
distribute-rgt-in46.8%
metadata-eval46.8%
metadata-eval46.8%
Simplified46.8%
Taylor expanded in i around 0 60.6%
*-commutative60.6%
Simplified60.6%
Taylor expanded in i around 0 70.5%
if 1.2e-123 < n Initial program 18.5%
Taylor expanded in n around inf 32.1%
*-commutative32.1%
associate-/l*32.1%
expm1-define88.6%
Simplified88.6%
Final simplification82.4%
(FPCore (i n)
:precision binary64
(if (<= n -4.3e-150)
(* 100.0 (+ n (* i (* n (+ (* i 0.16666666666666666) 0.5)))))
(if (<= n 1.2e-123)
(+ 1.0 (fma 100.0 n -1.0))
(*
n
(+
100.0
(* i (+ 50.0 (* i (+ 16.666666666666668 (* i 4.166666666666667))))))))))
double code(double i, double n) {
double tmp;
if (n <= -4.3e-150) {
tmp = 100.0 * (n + (i * (n * ((i * 0.16666666666666666) + 0.5))));
} else if (n <= 1.2e-123) {
tmp = 1.0 + fma(100.0, n, -1.0);
} 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 <= -4.3e-150) tmp = Float64(100.0 * Float64(n + Float64(i * Float64(n * Float64(Float64(i * 0.16666666666666666) + 0.5))))); elseif (n <= 1.2e-123) tmp = Float64(1.0 + fma(100.0, n, -1.0)); 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
code[i_, n_] := If[LessEqual[n, -4.3e-150], N[(100.0 * N[(n + N[(i * N[(n * N[(N[(i * 0.16666666666666666), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.2e-123], N[(1.0 + N[(100.0 * n + -1.0), $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 -4.3 \cdot 10^{-150}:\\
\;\;\;\;100 \cdot \left(n + i \cdot \left(n \cdot \left(i \cdot 0.16666666666666666 + 0.5\right)\right)\right)\\
\mathbf{elif}\;n \leq 1.2 \cdot 10^{-123}:\\
\;\;\;\;1 + \mathsf{fma}\left(100, n, -1\right)\\
\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 < -4.30000000000000004e-150Initial program 21.9%
Taylor expanded in n around inf 28.6%
*-commutative28.6%
associate-/l*28.6%
expm1-define82.6%
Simplified82.6%
Taylor expanded in i around 0 62.2%
associate-*r*62.2%
distribute-rgt-out62.2%
Simplified62.2%
if -4.30000000000000004e-150 < n < 1.2e-123Initial program 49.1%
associate-*r/49.1%
sub-neg49.1%
distribute-rgt-in49.1%
metadata-eval49.1%
metadata-eval49.1%
Simplified49.1%
Taylor expanded in i around 0 58.3%
+-commutative58.3%
Simplified58.3%
expm1-log1p-u58.3%
expm1-undefine68.3%
associate-/r/68.3%
*-commutative68.3%
*-commutative68.3%
fma-define68.3%
Applied egg-rr68.3%
expm1-define20.6%
associate-*r/20.6%
associate-*l/52.3%
fma-undefine52.3%
*-commutative52.3%
distribute-lft1-in52.3%
associate-+l+51.2%
metadata-eval51.2%
+-rgt-identity51.2%
*-commutative51.2%
expm1-define68.3%
log1p-undefine68.3%
rem-exp-log68.3%
associate-+r-68.3%
*-commutative68.3%
associate-*r*68.3%
*-commutative68.3%
fmm-def68.3%
Simplified68.3%
if 1.2e-123 < n Initial program 18.5%
associate-/r/18.9%
associate-*r*18.9%
*-commutative18.9%
associate-*r/18.9%
sub-neg18.9%
distribute-lft-in18.9%
metadata-eval18.9%
metadata-eval18.9%
metadata-eval18.9%
fma-define18.9%
metadata-eval18.9%
Simplified18.9%
Taylor expanded in n around inf 32.1%
sub-neg32.1%
metadata-eval32.1%
metadata-eval32.1%
distribute-lft-in32.1%
metadata-eval32.1%
sub-neg32.1%
expm1-define88.5%
Simplified88.5%
Taylor expanded in i around 0 76.3%
*-commutative76.3%
Simplified76.3%
Final simplification68.9%
(FPCore (i n)
:precision binary64
(if (<= n -8e-153)
(* 100.0 (+ n (* i (* n (+ (* i 0.16666666666666666) 0.5)))))
(if (<= n 1.2e-123)
(/ 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 <= -8e-153) {
tmp = 100.0 * (n + (i * (n * ((i * 0.16666666666666666) + 0.5))));
} else if (n <= 1.2e-123) {
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 <= (-8d-153)) then
tmp = 100.0d0 * (n + (i * (n * ((i * 0.16666666666666666d0) + 0.5d0))))
else if (n <= 1.2d-123) 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 <= -8e-153) {
tmp = 100.0 * (n + (i * (n * ((i * 0.16666666666666666) + 0.5))));
} else if (n <= 1.2e-123) {
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 <= -8e-153: tmp = 100.0 * (n + (i * (n * ((i * 0.16666666666666666) + 0.5)))) elif n <= 1.2e-123: 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 <= -8e-153) tmp = Float64(100.0 * Float64(n + Float64(i * Float64(n * Float64(Float64(i * 0.16666666666666666) + 0.5))))); elseif (n <= 1.2e-123) 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 <= -8e-153) tmp = 100.0 * (n + (i * (n * ((i * 0.16666666666666666) + 0.5)))); elseif (n <= 1.2e-123) 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, -8e-153], N[(100.0 * N[(n + N[(i * N[(n * N[(N[(i * 0.16666666666666666), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.2e-123], 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 -8 \cdot 10^{-153}:\\
\;\;\;\;100 \cdot \left(n + i \cdot \left(n \cdot \left(i \cdot 0.16666666666666666 + 0.5\right)\right)\right)\\
\mathbf{elif}\;n \leq 1.2 \cdot 10^{-123}:\\
\;\;\;\;\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 < -8.00000000000000031e-153Initial program 21.9%
Taylor expanded in n around inf 28.6%
*-commutative28.6%
associate-/l*28.6%
expm1-define82.6%
Simplified82.6%
Taylor expanded in i around 0 62.2%
associate-*r*62.2%
distribute-rgt-out62.2%
Simplified62.2%
if -8.00000000000000031e-153 < n < 1.2e-123Initial program 49.1%
associate-*r/49.1%
sub-neg49.1%
distribute-rgt-in49.1%
metadata-eval49.1%
metadata-eval49.1%
Simplified49.1%
Taylor expanded in i around 0 58.3%
*-commutative58.3%
Simplified58.3%
Taylor expanded in i around 0 68.3%
if 1.2e-123 < n Initial program 18.5%
associate-/r/18.9%
associate-*r*18.9%
*-commutative18.9%
associate-*r/18.9%
sub-neg18.9%
distribute-lft-in18.9%
metadata-eval18.9%
metadata-eval18.9%
metadata-eval18.9%
fma-define18.9%
metadata-eval18.9%
Simplified18.9%
Taylor expanded in n around inf 32.1%
sub-neg32.1%
metadata-eval32.1%
metadata-eval32.1%
distribute-lft-in32.1%
metadata-eval32.1%
sub-neg32.1%
expm1-define88.5%
Simplified88.5%
Taylor expanded in i around 0 76.3%
*-commutative76.3%
Simplified76.3%
Final simplification68.9%
(FPCore (i n) :precision binary64 (if (or (<= n -6.6e-159) (not (<= n 1.2e-123))) (* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668))))) (/ 0.0 (/ i n))))
double code(double i, double n) {
double tmp;
if ((n <= -6.6e-159) || !(n <= 1.2e-123)) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} 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 <= (-6.6d-159)) .or. (.not. (n <= 1.2d-123))) then
tmp = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
else
tmp = 0.0d0 / (i / n)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -6.6e-159) || !(n <= 1.2e-123)) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -6.6e-159) or not (n <= 1.2e-123): tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) else: tmp = 0.0 / (i / n) return tmp
function code(i, n) tmp = 0.0 if ((n <= -6.6e-159) || !(n <= 1.2e-123)) tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))); else tmp = Float64(0.0 / Float64(i / n)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -6.6e-159) || ~((n <= 1.2e-123))) tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); else tmp = 0.0 / (i / n); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -6.6e-159], N[Not[LessEqual[n, 1.2e-123]], $MachinePrecision]], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -6.6 \cdot 10^{-159} \lor \neg \left(n \leq 1.2 \cdot 10^{-123}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -6.6000000000000003e-159 or 1.2e-123 < n Initial program 20.2%
associate-/r/20.7%
associate-*r*20.8%
*-commutative20.8%
associate-*r/20.8%
sub-neg20.8%
distribute-lft-in20.8%
metadata-eval20.8%
metadata-eval20.8%
metadata-eval20.8%
fma-define20.8%
metadata-eval20.8%
Simplified20.8%
Taylor expanded in n around inf 30.3%
sub-neg30.3%
metadata-eval30.3%
metadata-eval30.3%
distribute-lft-in30.3%
metadata-eval30.3%
sub-neg30.3%
expm1-define85.5%
Simplified85.5%
Taylor expanded in i around 0 67.4%
*-commutative67.4%
Simplified67.4%
if -6.6000000000000003e-159 < n < 1.2e-123Initial program 49.1%
associate-*r/49.1%
sub-neg49.1%
distribute-rgt-in49.1%
metadata-eval49.1%
metadata-eval49.1%
Simplified49.1%
Taylor expanded in i around 0 58.3%
*-commutative58.3%
Simplified58.3%
Taylor expanded in i around 0 68.3%
Final simplification67.6%
(FPCore (i n)
:precision binary64
(if (<= n -2.8e-159)
(* 100.0 (+ n (* i (* n (+ (* i 0.16666666666666666) 0.5)))))
(if (<= n 1.2e-123)
(/ 0.0 (/ i n))
(* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668))))))))
double code(double i, double n) {
double tmp;
if (n <= -2.8e-159) {
tmp = 100.0 * (n + (i * (n * ((i * 0.16666666666666666) + 0.5))));
} else if (n <= 1.2e-123) {
tmp = 0.0 / (i / n);
} else {
tmp = n * (100.0 + (i * (50.0 + (i * 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 <= (-2.8d-159)) then
tmp = 100.0d0 * (n + (i * (n * ((i * 0.16666666666666666d0) + 0.5d0))))
else if (n <= 1.2d-123) then
tmp = 0.0d0 / (i / n)
else
tmp = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -2.8e-159) {
tmp = 100.0 * (n + (i * (n * ((i * 0.16666666666666666) + 0.5))));
} else if (n <= 1.2e-123) {
tmp = 0.0 / (i / n);
} else {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -2.8e-159: tmp = 100.0 * (n + (i * (n * ((i * 0.16666666666666666) + 0.5)))) elif n <= 1.2e-123: tmp = 0.0 / (i / n) else: tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) return tmp
function code(i, n) tmp = 0.0 if (n <= -2.8e-159) tmp = Float64(100.0 * Float64(n + Float64(i * Float64(n * Float64(Float64(i * 0.16666666666666666) + 0.5))))); elseif (n <= 1.2e-123) tmp = Float64(0.0 / Float64(i / n)); else tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -2.8e-159) tmp = 100.0 * (n + (i * (n * ((i * 0.16666666666666666) + 0.5)))); elseif (n <= 1.2e-123) tmp = 0.0 / (i / n); else tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -2.8e-159], N[(100.0 * N[(n + N[(i * N[(n * N[(N[(i * 0.16666666666666666), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.2e-123], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.8 \cdot 10^{-159}:\\
\;\;\;\;100 \cdot \left(n + i \cdot \left(n \cdot \left(i \cdot 0.16666666666666666 + 0.5\right)\right)\right)\\
\mathbf{elif}\;n \leq 1.2 \cdot 10^{-123}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\end{array}
\end{array}
if n < -2.8000000000000002e-159Initial program 21.9%
Taylor expanded in n around inf 28.6%
*-commutative28.6%
associate-/l*28.6%
expm1-define82.6%
Simplified82.6%
Taylor expanded in i around 0 62.2%
associate-*r*62.2%
distribute-rgt-out62.2%
Simplified62.2%
if -2.8000000000000002e-159 < n < 1.2e-123Initial program 49.1%
associate-*r/49.1%
sub-neg49.1%
distribute-rgt-in49.1%
metadata-eval49.1%
metadata-eval49.1%
Simplified49.1%
Taylor expanded in i around 0 58.3%
*-commutative58.3%
Simplified58.3%
Taylor expanded in i around 0 68.3%
if 1.2e-123 < n Initial program 18.5%
associate-/r/18.9%
associate-*r*18.9%
*-commutative18.9%
associate-*r/18.9%
sub-neg18.9%
distribute-lft-in18.9%
metadata-eval18.9%
metadata-eval18.9%
metadata-eval18.9%
fma-define18.9%
metadata-eval18.9%
Simplified18.9%
Taylor expanded in n around inf 32.1%
sub-neg32.1%
metadata-eval32.1%
metadata-eval32.1%
distribute-lft-in32.1%
metadata-eval32.1%
sub-neg32.1%
expm1-define88.5%
Simplified88.5%
Taylor expanded in i around 0 72.8%
*-commutative72.8%
Simplified72.8%
Final simplification67.6%
(FPCore (i n) :precision binary64 (if (or (<= n -5.9e+31) (not (<= n 9.5e-26))) (* n (+ 100.0 (* i 50.0))) (* 100.0 (/ i (/ i n)))))
double code(double i, double n) {
double tmp;
if ((n <= -5.9e+31) || !(n <= 9.5e-26)) {
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 <= (-5.9d+31)) .or. (.not. (n <= 9.5d-26))) 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 <= -5.9e+31) || !(n <= 9.5e-26)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -5.9e+31) or not (n <= 9.5e-26): 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 <= -5.9e+31) || !(n <= 9.5e-26)) 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 <= -5.9e+31) || ~((n <= 9.5e-26))) 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, -5.9e+31], N[Not[LessEqual[n, 9.5e-26]], $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 -5.9 \cdot 10^{+31} \lor \neg \left(n \leq 9.5 \cdot 10^{-26}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -5.9000000000000004e31 or 9.4999999999999995e-26 < n Initial program 21.0%
Taylor expanded in n around inf 36.0%
*-commutative36.0%
associate-/l*36.0%
expm1-define93.3%
Simplified93.3%
Taylor expanded in i around 0 68.2%
+-commutative68.2%
associate-*r*68.2%
distribute-rgt-out68.2%
*-commutative68.2%
Simplified68.2%
if -5.9000000000000004e31 < n < 9.4999999999999995e-26Initial program 34.0%
Taylor expanded in i around 0 55.4%
Final simplification63.7%
(FPCore (i n) :precision binary64 (if (or (<= n -1.9e-153) (not (<= n 1.45e-123))) (* n (+ 100.0 (* i 50.0))) (/ 0.0 (/ i n))))
double code(double i, double n) {
double tmp;
if ((n <= -1.9e-153) || !(n <= 1.45e-123)) {
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 <= (-1.9d-153)) .or. (.not. (n <= 1.45d-123))) 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 <= -1.9e-153) || !(n <= 1.45e-123)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -1.9e-153) or not (n <= 1.45e-123): tmp = n * (100.0 + (i * 50.0)) else: tmp = 0.0 / (i / n) return tmp
function code(i, n) tmp = 0.0 if ((n <= -1.9e-153) || !(n <= 1.45e-123)) 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 <= -1.9e-153) || ~((n <= 1.45e-123))) 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, -1.9e-153], N[Not[LessEqual[n, 1.45e-123]], $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 -1.9 \cdot 10^{-153} \lor \neg \left(n \leq 1.45 \cdot 10^{-123}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -1.90000000000000011e-153 or 1.45000000000000002e-123 < n Initial program 20.2%
Taylor expanded in n around inf 30.3%
*-commutative30.3%
associate-/l*30.3%
expm1-define85.5%
Simplified85.5%
Taylor expanded in i around 0 64.6%
+-commutative64.6%
associate-*r*64.6%
distribute-rgt-out64.6%
*-commutative64.6%
Simplified64.6%
if -1.90000000000000011e-153 < n < 1.45000000000000002e-123Initial program 49.1%
associate-*r/49.1%
sub-neg49.1%
distribute-rgt-in49.1%
metadata-eval49.1%
metadata-eval49.1%
Simplified49.1%
Taylor expanded in i around 0 58.3%
*-commutative58.3%
Simplified58.3%
Taylor expanded in i around 0 68.3%
Final simplification65.2%
(FPCore (i n) :precision binary64 (if (<= n -1.42e-158) (* 100.0 (+ n (* 0.5 (* i n)))) (if (<= n 1.2e-123) (/ 0.0 (/ i n)) (* n (+ 100.0 (* i 50.0))))))
double code(double i, double n) {
double tmp;
if (n <= -1.42e-158) {
tmp = 100.0 * (n + (0.5 * (i * n)));
} else if (n <= 1.2e-123) {
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.42d-158)) then
tmp = 100.0d0 * (n + (0.5d0 * (i * n)))
else if (n <= 1.2d-123) 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.42e-158) {
tmp = 100.0 * (n + (0.5 * (i * n)));
} else if (n <= 1.2e-123) {
tmp = 0.0 / (i / n);
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -1.42e-158: tmp = 100.0 * (n + (0.5 * (i * n))) elif n <= 1.2e-123: 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.42e-158) tmp = Float64(100.0 * Float64(n + Float64(0.5 * Float64(i * n)))); elseif (n <= 1.2e-123) 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.42e-158) tmp = 100.0 * (n + (0.5 * (i * n))); elseif (n <= 1.2e-123) 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.42e-158], N[(100.0 * N[(n + N[(0.5 * N[(i * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.2e-123], 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.42 \cdot 10^{-158}:\\
\;\;\;\;100 \cdot \left(n + 0.5 \cdot \left(i \cdot n\right)\right)\\
\mathbf{elif}\;n \leq 1.2 \cdot 10^{-123}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < -1.42000000000000005e-158Initial program 21.9%
Taylor expanded in n around inf 28.6%
*-commutative28.6%
associate-/l*28.6%
expm1-define82.6%
Simplified82.6%
Taylor expanded in i around 0 60.3%
*-commutative60.3%
*-commutative60.3%
Simplified60.3%
if -1.42000000000000005e-158 < n < 1.2e-123Initial program 49.1%
associate-*r/49.1%
sub-neg49.1%
distribute-rgt-in49.1%
metadata-eval49.1%
metadata-eval49.1%
Simplified49.1%
Taylor expanded in i around 0 58.3%
*-commutative58.3%
Simplified58.3%
Taylor expanded in i around 0 68.3%
if 1.2e-123 < n Initial program 18.5%
Taylor expanded in n around inf 32.1%
*-commutative32.1%
associate-/l*32.1%
expm1-define88.6%
Simplified88.6%
Taylor expanded in i around 0 69.0%
+-commutative69.0%
associate-*r*69.0%
distribute-rgt-out69.0%
*-commutative69.0%
Simplified69.0%
Final simplification65.3%
(FPCore (i n) :precision binary64 (if (<= i -5e+59) (* 100.0 (/ i (/ i n))) (if (<= i 5.2e+123) (* n 100.0) (* 50.0 (* i n)))))
double code(double i, double n) {
double tmp;
if (i <= -5e+59) {
tmp = 100.0 * (i / (i / n));
} else if (i <= 5.2e+123) {
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 <= (-5d+59)) then
tmp = 100.0d0 * (i / (i / n))
else if (i <= 5.2d+123) 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 <= -5e+59) {
tmp = 100.0 * (i / (i / n));
} else if (i <= 5.2e+123) {
tmp = n * 100.0;
} else {
tmp = 50.0 * (i * n);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -5e+59: tmp = 100.0 * (i / (i / n)) elif i <= 5.2e+123: tmp = n * 100.0 else: tmp = 50.0 * (i * n) return tmp
function code(i, n) tmp = 0.0 if (i <= -5e+59) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (i <= 5.2e+123) 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 <= -5e+59) tmp = 100.0 * (i / (i / n)); elseif (i <= 5.2e+123) tmp = n * 100.0; else tmp = 50.0 * (i * n); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -5e+59], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 5.2e+123], N[(n * 100.0), $MachinePrecision], N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -5 \cdot 10^{+59}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;i \leq 5.2 \cdot 10^{+123}:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;50 \cdot \left(i \cdot n\right)\\
\end{array}
\end{array}
if i < -4.9999999999999997e59Initial program 58.0%
Taylor expanded in i around 0 27.1%
if -4.9999999999999997e59 < i < 5.19999999999999971e123Initial program 11.8%
Taylor expanded in i around 0 73.3%
*-commutative73.3%
Simplified73.3%
if 5.19999999999999971e123 < i Initial program 53.4%
Taylor expanded in n around inf 42.9%
*-commutative42.9%
associate-/l*42.9%
expm1-define42.9%
Simplified42.9%
Taylor expanded in i around 0 33.5%
+-commutative33.5%
associate-*r*33.5%
distribute-rgt-out33.5%
*-commutative33.5%
Simplified33.5%
Taylor expanded in i around inf 33.5%
Final simplification59.8%
(FPCore (i n) :precision binary64 (if (<= i 5.2e+123) (* n 100.0) (* 50.0 (* i n))))
double code(double i, double n) {
double tmp;
if (i <= 5.2e+123) {
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 <= 5.2d+123) 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 <= 5.2e+123) {
tmp = n * 100.0;
} else {
tmp = 50.0 * (i * n);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 5.2e+123: tmp = n * 100.0 else: tmp = 50.0 * (i * n) return tmp
function code(i, n) tmp = 0.0 if (i <= 5.2e+123) 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 <= 5.2e+123) tmp = n * 100.0; else tmp = 50.0 * (i * n); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, 5.2e+123], N[(n * 100.0), $MachinePrecision], N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 5.2 \cdot 10^{+123}:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;50 \cdot \left(i \cdot n\right)\\
\end{array}
\end{array}
if i < 5.19999999999999971e123Initial program 20.7%
Taylor expanded in i around 0 60.1%
*-commutative60.1%
Simplified60.1%
if 5.19999999999999971e123 < i Initial program 53.4%
Taylor expanded in n around inf 42.9%
*-commutative42.9%
associate-/l*42.9%
expm1-define42.9%
Simplified42.9%
Taylor expanded in i around 0 33.5%
+-commutative33.5%
associate-*r*33.5%
distribute-rgt-out33.5%
*-commutative33.5%
Simplified33.5%
Taylor expanded in i around inf 33.5%
Final simplification56.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 25.5%
Taylor expanded in i around 0 51.9%
*-commutative51.9%
Simplified51.9%
Final simplification51.9%
(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 2024089
(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))))