
(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 13 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)))
(t_2 (* n (/ (fma t_0 100.0 -100.0) i))))
(if (<= t_1 (- INFINITY))
t_2
(if (<= t_1 0.0)
(* 100.0 (/ (expm1 (* n (log1p (/ i n)))) (/ i n)))
(if (<= t_1 INFINITY) t_2 (* 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) / (i / n);
double t_2 = n * (fma(t_0, 100.0, -100.0) / i);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = t_2;
} else if (t_1 <= 0.0) {
tmp = 100.0 * (expm1((n * log1p((i / n)))) / (i / n));
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_2;
} else {
tmp = n * 100.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)) t_2 = Float64(n * Float64(fma(t_0, 100.0, -100.0) / i)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = t_2; elseif (t_1 <= 0.0) tmp = Float64(100.0 * Float64(expm1(Float64(n * log1p(Float64(i / n)))) / Float64(i / n))); 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[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]}, Block[{t$95$2 = N[(n * N[(N[(t$95$0 * 100.0 + -100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], t$95$2, 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], t$95$2, N[(n * 100.0), $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}}\\
t_2 := n \cdot \frac{\mathsf{fma}\left(t\_0, 100, -100\right)}{i}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;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:\\
\;\;\;\;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)) < -inf.0 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 99.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-/.f64N/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
*-commutativeN/A
lower-fma.f64N/A
metadata-evalN/A
metadata-eval99.9
Applied rewrites99.9%
if -inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < -0.0Initial program 25.3%
lift--.f64N/A
lift-pow.f64N/A
pow-to-expN/A
lower-expm1.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
lower-log1p.f6499.6
Applied rewrites99.6%
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%
Taylor expanded in i around 0
*-commutativeN/A
lower-*.f6478.1
Applied rewrites78.1%
Final simplification95.7%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* n (* 100.0 (/ (expm1 i) i)))))
(if (<= n -1.25e-197)
t_0
(if (<= n 6.2e-267)
0.0
(if (<= n 4e-91)
(* n (/ (* (* n 100.0) (- (log i) (log n))) i))
t_0)))))
double code(double i, double n) {
double t_0 = n * (100.0 * (expm1(i) / i));
double tmp;
if (n <= -1.25e-197) {
tmp = t_0;
} else if (n <= 6.2e-267) {
tmp = 0.0;
} else if (n <= 4e-91) {
tmp = n * (((n * 100.0) * (log(i) - log(n))) / i);
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = n * (100.0 * (Math.expm1(i) / i));
double tmp;
if (n <= -1.25e-197) {
tmp = t_0;
} else if (n <= 6.2e-267) {
tmp = 0.0;
} else if (n <= 4e-91) {
tmp = n * (((n * 100.0) * (Math.log(i) - Math.log(n))) / i);
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = n * (100.0 * (math.expm1(i) / i)) tmp = 0 if n <= -1.25e-197: tmp = t_0 elif n <= 6.2e-267: tmp = 0.0 elif n <= 4e-91: tmp = n * (((n * 100.0) * (math.log(i) - math.log(n))) / i) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(n * Float64(100.0 * Float64(expm1(i) / i))) tmp = 0.0 if (n <= -1.25e-197) tmp = t_0; elseif (n <= 6.2e-267) tmp = 0.0; elseif (n <= 4e-91) tmp = Float64(n * Float64(Float64(Float64(n * 100.0) * Float64(log(i) - log(n))) / i)); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(n * N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1.25e-197], t$95$0, If[LessEqual[n, 6.2e-267], 0.0, If[LessEqual[n, 4e-91], N[(n * N[(N[(N[(n * 100.0), $MachinePrecision] * N[(N[Log[i], $MachinePrecision] - N[Log[n], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{if}\;n \leq -1.25 \cdot 10^{-197}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 6.2 \cdot 10^{-267}:\\
\;\;\;\;0\\
\mathbf{elif}\;n \leq 4 \cdot 10^{-91}:\\
\;\;\;\;n \cdot \frac{\left(n \cdot 100\right) \cdot \left(\log i - \log n\right)}{i}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -1.2500000000000001e-197 or 4.00000000000000009e-91 < n Initial program 23.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-/.f64N/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
*-commutativeN/A
lower-fma.f64N/A
metadata-evalN/A
metadata-eval23.3
Applied rewrites23.3%
Taylor expanded in n around inf
div-subN/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
distribute-lft-out--N/A
div-subN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6484.9
Applied rewrites84.9%
Applied rewrites85.0%
if -1.2500000000000001e-197 < n < 6.2000000000000002e-267Initial program 80.7%
lift-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lift-/.f64N/A
clear-numN/A
sub-negN/A
distribute-rgt-inN/A
lower-fma.f64N/A
lift-/.f64N/A
associate-/r/N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
lower-neg.f6433.4
Applied rewrites33.4%
Taylor expanded in i around 0
distribute-rgt-outN/A
metadata-evalN/A
mul0-rgtN/A
lower-/.f6490.7
Applied rewrites90.7%
Taylor expanded in i around 0
Applied rewrites90.7%
if 6.2000000000000002e-267 < n < 4.00000000000000009e-91Initial program 23.5%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-/.f64N/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
*-commutativeN/A
lower-fma.f64N/A
metadata-evalN/A
metadata-eval24.0
Applied rewrites24.0%
Taylor expanded in n around 0
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-log.f64N/A
lower-log.f6482.7
Applied rewrites82.7%
Final simplification85.2%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* n (* 100.0 (/ (expm1 i) i)))))
(if (<= n -1.25e-197)
t_0
(if (<= n 4.8e-170)
(* 100.0 (/ (+ 1.0 -1.0) (/ i n)))
(if (<= n 4e-91)
(/ (* (- (log i) (log n)) (* 100.0 (* n n))) i)
t_0)))))
double code(double i, double n) {
double t_0 = n * (100.0 * (expm1(i) / i));
double tmp;
if (n <= -1.25e-197) {
tmp = t_0;
} else if (n <= 4.8e-170) {
tmp = 100.0 * ((1.0 + -1.0) / (i / n));
} else if (n <= 4e-91) {
tmp = ((log(i) - log(n)) * (100.0 * (n * n))) / i;
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = n * (100.0 * (Math.expm1(i) / i));
double tmp;
if (n <= -1.25e-197) {
tmp = t_0;
} else if (n <= 4.8e-170) {
tmp = 100.0 * ((1.0 + -1.0) / (i / n));
} else if (n <= 4e-91) {
tmp = ((Math.log(i) - Math.log(n)) * (100.0 * (n * n))) / i;
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = n * (100.0 * (math.expm1(i) / i)) tmp = 0 if n <= -1.25e-197: tmp = t_0 elif n <= 4.8e-170: tmp = 100.0 * ((1.0 + -1.0) / (i / n)) elif n <= 4e-91: tmp = ((math.log(i) - math.log(n)) * (100.0 * (n * n))) / i else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(n * Float64(100.0 * Float64(expm1(i) / i))) tmp = 0.0 if (n <= -1.25e-197) tmp = t_0; elseif (n <= 4.8e-170) tmp = Float64(100.0 * Float64(Float64(1.0 + -1.0) / Float64(i / n))); elseif (n <= 4e-91) tmp = Float64(Float64(Float64(log(i) - log(n)) * Float64(100.0 * Float64(n * n))) / i); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(n * N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1.25e-197], t$95$0, If[LessEqual[n, 4.8e-170], N[(100.0 * N[(N[(1.0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 4e-91], N[(N[(N[(N[Log[i], $MachinePrecision] - N[Log[n], $MachinePrecision]), $MachinePrecision] * N[(100.0 * N[(n * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{if}\;n \leq -1.25 \cdot 10^{-197}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 4.8 \cdot 10^{-170}:\\
\;\;\;\;100 \cdot \frac{1 + -1}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 4 \cdot 10^{-91}:\\
\;\;\;\;\frac{\left(\log i - \log n\right) \cdot \left(100 \cdot \left(n \cdot n\right)\right)}{i}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -1.2500000000000001e-197 or 4.00000000000000009e-91 < n Initial program 23.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-/.f64N/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
*-commutativeN/A
lower-fma.f64N/A
metadata-evalN/A
metadata-eval23.3
Applied rewrites23.3%
Taylor expanded in n around inf
div-subN/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
distribute-lft-out--N/A
div-subN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6484.9
Applied rewrites84.9%
Applied rewrites85.0%
if -1.2500000000000001e-197 < n < 4.7999999999999999e-170Initial program 58.1%
Taylor expanded in i around 0
Applied rewrites79.7%
if 4.7999999999999999e-170 < n < 4.00000000000000009e-91Initial program 12.2%
Taylor expanded in n around 0
associate-*r/N/A
lower-/.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-log.f64N/A
lower-log.f6475.1
Applied rewrites75.1%
Final simplification83.8%
(FPCore (i n) :precision binary64 (let* ((t_0 (* n (* 100.0 (/ (expm1 i) i))))) (if (<= n -1.25e-197) t_0 (if (<= n 2.45e-91) 0.0 t_0))))
double code(double i, double n) {
double t_0 = n * (100.0 * (expm1(i) / i));
double tmp;
if (n <= -1.25e-197) {
tmp = t_0;
} else if (n <= 2.45e-91) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = n * (100.0 * (Math.expm1(i) / i));
double tmp;
if (n <= -1.25e-197) {
tmp = t_0;
} else if (n <= 2.45e-91) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = n * (100.0 * (math.expm1(i) / i)) tmp = 0 if n <= -1.25e-197: tmp = t_0 elif n <= 2.45e-91: tmp = 0.0 else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(n * Float64(100.0 * Float64(expm1(i) / i))) tmp = 0.0 if (n <= -1.25e-197) tmp = t_0; elseif (n <= 2.45e-91) tmp = 0.0; else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(n * N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1.25e-197], t$95$0, If[LessEqual[n, 2.45e-91], 0.0, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{if}\;n \leq -1.25 \cdot 10^{-197}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 2.45 \cdot 10^{-91}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -1.2500000000000001e-197 or 2.4499999999999999e-91 < n Initial program 23.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-/.f64N/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
*-commutativeN/A
lower-fma.f64N/A
metadata-evalN/A
metadata-eval23.3
Applied rewrites23.3%
Taylor expanded in n around inf
div-subN/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
distribute-lft-out--N/A
div-subN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6484.9
Applied rewrites84.9%
Applied rewrites85.0%
if -1.2500000000000001e-197 < n < 2.4499999999999999e-91Initial program 46.8%
lift-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lift-/.f64N/A
clear-numN/A
sub-negN/A
distribute-rgt-inN/A
lower-fma.f64N/A
lift-/.f64N/A
associate-/r/N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
lower-neg.f6416.2
Applied rewrites16.2%
Taylor expanded in i around 0
distribute-rgt-outN/A
metadata-evalN/A
mul0-rgtN/A
lower-/.f6469.3
Applied rewrites69.3%
Taylor expanded in i around 0
Applied rewrites69.3%
Final simplification82.0%
(FPCore (i n) :precision binary64 (let* ((t_0 (* 100.0 (/ (* n (expm1 i)) i)))) (if (<= n -1.12e-92) t_0 (if (<= n 2.45e-91) 0.0 t_0))))
double code(double i, double n) {
double t_0 = 100.0 * ((n * expm1(i)) / i);
double tmp;
if (n <= -1.12e-92) {
tmp = t_0;
} else if (n <= 2.45e-91) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = 100.0 * ((n * Math.expm1(i)) / i);
double tmp;
if (n <= -1.12e-92) {
tmp = t_0;
} else if (n <= 2.45e-91) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * ((n * math.expm1(i)) / i) tmp = 0 if n <= -1.12e-92: tmp = t_0 elif n <= 2.45e-91: tmp = 0.0 else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(Float64(n * expm1(i)) / i)) tmp = 0.0 if (n <= -1.12e-92) tmp = t_0; elseif (n <= 2.45e-91) tmp = 0.0; else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(N[(n * N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1.12e-92], t$95$0, If[LessEqual[n, 2.45e-91], 0.0, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \frac{n \cdot \mathsf{expm1}\left(i\right)}{i}\\
\mathbf{if}\;n \leq -1.12 \cdot 10^{-92}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 2.45 \cdot 10^{-91}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -1.11999999999999999e-92 or 2.4499999999999999e-91 < n Initial program 20.8%
Taylor expanded in n around inf
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6486.2
Applied rewrites86.2%
if -1.11999999999999999e-92 < n < 2.4499999999999999e-91Initial program 47.0%
lift-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lift-/.f64N/A
clear-numN/A
sub-negN/A
distribute-rgt-inN/A
lower-fma.f64N/A
lift-/.f64N/A
associate-/r/N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
lower-neg.f6420.9
Applied rewrites20.9%
Taylor expanded in i around 0
distribute-rgt-outN/A
metadata-evalN/A
mul0-rgtN/A
lower-/.f6463.4
Applied rewrites63.4%
Taylor expanded in i around 0
Applied rewrites63.4%
(FPCore (i n) :precision binary64 (let* ((t_0 (/ (* 100.0 (* n (expm1 i))) i))) (if (<= n -1.12e-92) t_0 (if (<= n 2.45e-91) 0.0 t_0))))
double code(double i, double n) {
double t_0 = (100.0 * (n * expm1(i))) / i;
double tmp;
if (n <= -1.12e-92) {
tmp = t_0;
} else if (n <= 2.45e-91) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = (100.0 * (n * Math.expm1(i))) / i;
double tmp;
if (n <= -1.12e-92) {
tmp = t_0;
} else if (n <= 2.45e-91) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = (100.0 * (n * math.expm1(i))) / i tmp = 0 if n <= -1.12e-92: tmp = t_0 elif n <= 2.45e-91: tmp = 0.0 else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(Float64(100.0 * Float64(n * expm1(i))) / i) tmp = 0.0 if (n <= -1.12e-92) tmp = t_0; elseif (n <= 2.45e-91) tmp = 0.0; else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[(100.0 * N[(n * N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]}, If[LessEqual[n, -1.12e-92], t$95$0, If[LessEqual[n, 2.45e-91], 0.0, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{100 \cdot \left(n \cdot \mathsf{expm1}\left(i\right)\right)}{i}\\
\mathbf{if}\;n \leq -1.12 \cdot 10^{-92}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 2.45 \cdot 10^{-91}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -1.11999999999999999e-92 or 2.4499999999999999e-91 < n Initial program 20.8%
Taylor expanded in n around inf
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-expm1.f6485.5
Applied rewrites85.5%
if -1.11999999999999999e-92 < n < 2.4499999999999999e-91Initial program 47.0%
lift-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lift-/.f64N/A
clear-numN/A
sub-negN/A
distribute-rgt-inN/A
lower-fma.f64N/A
lift-/.f64N/A
associate-/r/N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
lower-neg.f6420.9
Applied rewrites20.9%
Taylor expanded in i around 0
distribute-rgt-outN/A
metadata-evalN/A
mul0-rgtN/A
lower-/.f6463.4
Applied rewrites63.4%
Taylor expanded in i around 0
Applied rewrites63.4%
Final simplification79.7%
(FPCore (i n)
:precision binary64
(let* ((t_0
(/
(*
100.0
(*
i
(fma
i
(fma
n
0.5
(* i (* n (fma 0.041666666666666664 i 0.16666666666666666))))
n)))
i)))
(if (<= n -1.15e-92) t_0 (if (<= n 2.45e-91) 0.0 t_0))))
double code(double i, double n) {
double t_0 = (100.0 * (i * fma(i, fma(n, 0.5, (i * (n * fma(0.041666666666666664, i, 0.16666666666666666)))), n))) / i;
double tmp;
if (n <= -1.15e-92) {
tmp = t_0;
} else if (n <= 2.45e-91) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
function code(i, n) t_0 = Float64(Float64(100.0 * Float64(i * fma(i, fma(n, 0.5, Float64(i * Float64(n * fma(0.041666666666666664, i, 0.16666666666666666)))), n))) / i) tmp = 0.0 if (n <= -1.15e-92) tmp = t_0; elseif (n <= 2.45e-91) tmp = 0.0; else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[(100.0 * N[(i * N[(i * N[(n * 0.5 + N[(i * N[(n * N[(0.041666666666666664 * i + 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]}, If[LessEqual[n, -1.15e-92], t$95$0, If[LessEqual[n, 2.45e-91], 0.0, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{100 \cdot \left(i \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(n, 0.5, i \cdot \left(n \cdot \mathsf{fma}\left(0.041666666666666664, i, 0.16666666666666666\right)\right)\right), n\right)\right)}{i}\\
\mathbf{if}\;n \leq -1.15 \cdot 10^{-92}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 2.45 \cdot 10^{-91}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -1.15000000000000008e-92 or 2.4499999999999999e-91 < n Initial program 20.8%
Taylor expanded in n around inf
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-expm1.f6485.5
Applied rewrites85.5%
Taylor expanded in i around 0
Applied rewrites68.4%
if -1.15000000000000008e-92 < n < 2.4499999999999999e-91Initial program 47.0%
lift-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lift-/.f64N/A
clear-numN/A
sub-negN/A
distribute-rgt-inN/A
lower-fma.f64N/A
lift-/.f64N/A
associate-/r/N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
lower-neg.f6420.9
Applied rewrites20.9%
Taylor expanded in i around 0
distribute-rgt-outN/A
metadata-evalN/A
mul0-rgtN/A
lower-/.f6463.4
Applied rewrites63.4%
Taylor expanded in i around 0
Applied rewrites63.4%
Final simplification67.1%
(FPCore (i n)
:precision binary64
(if (<= n -1.12e-92)
(* n (fma i (fma i 16.666666666666668 50.0) 100.0))
(if (<= n 2.45e-91)
0.0
(*
n
(fma
i
(fma i (fma i 4.166666666666667 16.666666666666668) 50.0)
100.0)))))
double code(double i, double n) {
double tmp;
if (n <= -1.12e-92) {
tmp = n * fma(i, fma(i, 16.666666666666668, 50.0), 100.0);
} else if (n <= 2.45e-91) {
tmp = 0.0;
} else {
tmp = n * fma(i, fma(i, fma(i, 4.166666666666667, 16.666666666666668), 50.0), 100.0);
}
return tmp;
}
function code(i, n) tmp = 0.0 if (n <= -1.12e-92) tmp = Float64(n * fma(i, fma(i, 16.666666666666668, 50.0), 100.0)); elseif (n <= 2.45e-91) tmp = 0.0; else tmp = Float64(n * fma(i, fma(i, fma(i, 4.166666666666667, 16.666666666666668), 50.0), 100.0)); end return tmp end
code[i_, n_] := If[LessEqual[n, -1.12e-92], N[(n * N[(i * N[(i * 16.666666666666668 + 50.0), $MachinePrecision] + 100.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.45e-91], 0.0, N[(n * N[(i * N[(i * N[(i * 4.166666666666667 + 16.666666666666668), $MachinePrecision] + 50.0), $MachinePrecision] + 100.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.12 \cdot 10^{-92}:\\
\;\;\;\;n \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, 16.666666666666668, 50\right), 100\right)\\
\mathbf{elif}\;n \leq 2.45 \cdot 10^{-91}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;n \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, \mathsf{fma}\left(i, 4.166666666666667, 16.666666666666668\right), 50\right), 100\right)\\
\end{array}
\end{array}
if n < -1.11999999999999999e-92Initial program 24.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-/.f64N/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
*-commutativeN/A
lower-fma.f64N/A
metadata-evalN/A
metadata-eval24.4
Applied rewrites24.4%
Taylor expanded in n around inf
div-subN/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
distribute-lft-out--N/A
div-subN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6479.9
Applied rewrites79.9%
Taylor expanded in i around 0
Applied rewrites58.8%
if -1.11999999999999999e-92 < n < 2.4499999999999999e-91Initial program 47.0%
lift-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lift-/.f64N/A
clear-numN/A
sub-negN/A
distribute-rgt-inN/A
lower-fma.f64N/A
lift-/.f64N/A
associate-/r/N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
lower-neg.f6420.9
Applied rewrites20.9%
Taylor expanded in i around 0
distribute-rgt-outN/A
metadata-evalN/A
mul0-rgtN/A
lower-/.f6463.4
Applied rewrites63.4%
Taylor expanded in i around 0
Applied rewrites63.4%
if 2.4499999999999999e-91 < n Initial program 17.5%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-/.f64N/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
*-commutativeN/A
lower-fma.f64N/A
metadata-evalN/A
metadata-eval18.0
Applied rewrites18.0%
Taylor expanded in n around inf
div-subN/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
distribute-lft-out--N/A
div-subN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6493.4
Applied rewrites93.4%
Taylor expanded in i around 0
Applied rewrites76.9%
Final simplification66.6%
(FPCore (i n)
:precision binary64
(if (<= n -1.12e-92)
(* n (fma i (fma i 16.666666666666668 50.0) 100.0))
(if (<= n 2.45e-91)
0.0
(* 100.0 (* n (fma i (fma i 0.16666666666666666 0.5) 1.0))))))
double code(double i, double n) {
double tmp;
if (n <= -1.12e-92) {
tmp = n * fma(i, fma(i, 16.666666666666668, 50.0), 100.0);
} else if (n <= 2.45e-91) {
tmp = 0.0;
} else {
tmp = 100.0 * (n * fma(i, fma(i, 0.16666666666666666, 0.5), 1.0));
}
return tmp;
}
function code(i, n) tmp = 0.0 if (n <= -1.12e-92) tmp = Float64(n * fma(i, fma(i, 16.666666666666668, 50.0), 100.0)); elseif (n <= 2.45e-91) tmp = 0.0; else tmp = Float64(100.0 * Float64(n * fma(i, fma(i, 0.16666666666666666, 0.5), 1.0))); end return tmp end
code[i_, n_] := If[LessEqual[n, -1.12e-92], N[(n * N[(i * N[(i * 16.666666666666668 + 50.0), $MachinePrecision] + 100.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.45e-91], 0.0, N[(100.0 * N[(n * N[(i * N[(i * 0.16666666666666666 + 0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.12 \cdot 10^{-92}:\\
\;\;\;\;n \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, 16.666666666666668, 50\right), 100\right)\\
\mathbf{elif}\;n \leq 2.45 \cdot 10^{-91}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, 0.16666666666666666, 0.5\right), 1\right)\right)\\
\end{array}
\end{array}
if n < -1.11999999999999999e-92Initial program 24.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-/.f64N/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
*-commutativeN/A
lower-fma.f64N/A
metadata-evalN/A
metadata-eval24.4
Applied rewrites24.4%
Taylor expanded in n around inf
div-subN/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
distribute-lft-out--N/A
div-subN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6479.9
Applied rewrites79.9%
Taylor expanded in i around 0
Applied rewrites58.8%
if -1.11999999999999999e-92 < n < 2.4499999999999999e-91Initial program 47.0%
lift-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lift-/.f64N/A
clear-numN/A
sub-negN/A
distribute-rgt-inN/A
lower-fma.f64N/A
lift-/.f64N/A
associate-/r/N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
lower-neg.f6420.9
Applied rewrites20.9%
Taylor expanded in i around 0
distribute-rgt-outN/A
metadata-evalN/A
mul0-rgtN/A
lower-/.f6463.4
Applied rewrites63.4%
Taylor expanded in i around 0
Applied rewrites63.4%
if 2.4499999999999999e-91 < n Initial program 17.5%
Taylor expanded in i around 0
+-commutativeN/A
lower-fma.f64N/A
Applied rewrites70.8%
Taylor expanded in n around inf
Applied rewrites70.8%
Final simplification64.4%
(FPCore (i n) :precision binary64 (let* ((t_0 (* n (fma i (fma i 16.666666666666668 50.0) 100.0)))) (if (<= n -1.12e-92) t_0 (if (<= n 2.45e-91) 0.0 t_0))))
double code(double i, double n) {
double t_0 = n * fma(i, fma(i, 16.666666666666668, 50.0), 100.0);
double tmp;
if (n <= -1.12e-92) {
tmp = t_0;
} else if (n <= 2.45e-91) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
function code(i, n) t_0 = Float64(n * fma(i, fma(i, 16.666666666666668, 50.0), 100.0)) tmp = 0.0 if (n <= -1.12e-92) tmp = t_0; elseif (n <= 2.45e-91) tmp = 0.0; else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(n * N[(i * N[(i * 16.666666666666668 + 50.0), $MachinePrecision] + 100.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1.12e-92], t$95$0, If[LessEqual[n, 2.45e-91], 0.0, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, 16.666666666666668, 50\right), 100\right)\\
\mathbf{if}\;n \leq -1.12 \cdot 10^{-92}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 2.45 \cdot 10^{-91}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -1.11999999999999999e-92 or 2.4499999999999999e-91 < n Initial program 20.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-/.f64N/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
*-commutativeN/A
lower-fma.f64N/A
metadata-evalN/A
metadata-eval21.2
Applied rewrites21.2%
Taylor expanded in n around inf
div-subN/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
distribute-lft-out--N/A
div-subN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6486.6
Applied rewrites86.6%
Taylor expanded in i around 0
Applied rewrites64.8%
if -1.11999999999999999e-92 < n < 2.4499999999999999e-91Initial program 47.0%
lift-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lift-/.f64N/A
clear-numN/A
sub-negN/A
distribute-rgt-inN/A
lower-fma.f64N/A
lift-/.f64N/A
associate-/r/N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
lower-neg.f6420.9
Applied rewrites20.9%
Taylor expanded in i around 0
distribute-rgt-outN/A
metadata-evalN/A
mul0-rgtN/A
lower-/.f6463.4
Applied rewrites63.4%
Taylor expanded in i around 0
Applied rewrites63.4%
Final simplification64.4%
(FPCore (i n) :precision binary64 (let* ((t_0 (* n (fma i 50.0 100.0)))) (if (<= n -1.12e-92) t_0 (if (<= n 2.45e-91) 0.0 t_0))))
double code(double i, double n) {
double t_0 = n * fma(i, 50.0, 100.0);
double tmp;
if (n <= -1.12e-92) {
tmp = t_0;
} else if (n <= 2.45e-91) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
function code(i, n) t_0 = Float64(n * fma(i, 50.0, 100.0)) tmp = 0.0 if (n <= -1.12e-92) tmp = t_0; elseif (n <= 2.45e-91) tmp = 0.0; else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(n * N[(i * 50.0 + 100.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1.12e-92], t$95$0, If[LessEqual[n, 2.45e-91], 0.0, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \mathsf{fma}\left(i, 50, 100\right)\\
\mathbf{if}\;n \leq -1.12 \cdot 10^{-92}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 2.45 \cdot 10^{-91}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -1.11999999999999999e-92 or 2.4499999999999999e-91 < n Initial program 20.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-/.f64N/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
*-commutativeN/A
lower-fma.f64N/A
metadata-evalN/A
metadata-eval21.2
Applied rewrites21.2%
Taylor expanded in n around inf
div-subN/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
distribute-lft-out--N/A
div-subN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6486.6
Applied rewrites86.6%
Taylor expanded in i around 0
Applied rewrites60.9%
if -1.11999999999999999e-92 < n < 2.4499999999999999e-91Initial program 47.0%
lift-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lift-/.f64N/A
clear-numN/A
sub-negN/A
distribute-rgt-inN/A
lower-fma.f64N/A
lift-/.f64N/A
associate-/r/N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
lower-neg.f6420.9
Applied rewrites20.9%
Taylor expanded in i around 0
distribute-rgt-outN/A
metadata-evalN/A
mul0-rgtN/A
lower-/.f6463.4
Applied rewrites63.4%
Taylor expanded in i around 0
Applied rewrites63.4%
Final simplification61.5%
(FPCore (i n) :precision binary64 (if (<= i -215.0) 0.0 (if (<= i 1.02e+61) (* n 100.0) 0.0)))
double code(double i, double n) {
double tmp;
if (i <= -215.0) {
tmp = 0.0;
} else if (i <= 1.02e+61) {
tmp = n * 100.0;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= (-215.0d0)) then
tmp = 0.0d0
else if (i <= 1.02d+61) then
tmp = n * 100.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= -215.0) {
tmp = 0.0;
} else if (i <= 1.02e+61) {
tmp = n * 100.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -215.0: tmp = 0.0 elif i <= 1.02e+61: tmp = n * 100.0 else: tmp = 0.0 return tmp
function code(i, n) tmp = 0.0 if (i <= -215.0) tmp = 0.0; elseif (i <= 1.02e+61) tmp = Float64(n * 100.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -215.0) tmp = 0.0; elseif (i <= 1.02e+61) tmp = n * 100.0; else tmp = 0.0; end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -215.0], 0.0, If[LessEqual[i, 1.02e+61], N[(n * 100.0), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -215:\\
\;\;\;\;0\\
\mathbf{elif}\;i \leq 1.02 \cdot 10^{+61}:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if i < -215 or 1.01999999999999999e61 < i Initial program 51.7%
lift-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lift-/.f64N/A
clear-numN/A
sub-negN/A
distribute-rgt-inN/A
lower-fma.f64N/A
lift-/.f64N/A
associate-/r/N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
lower-neg.f6443.6
Applied rewrites43.6%
Taylor expanded in i around 0
distribute-rgt-outN/A
metadata-evalN/A
mul0-rgtN/A
lower-/.f6432.8
Applied rewrites32.8%
Taylor expanded in i around 0
Applied rewrites32.8%
if -215 < i < 1.01999999999999999e61Initial program 10.3%
Taylor expanded in i around 0
*-commutativeN/A
lower-*.f6475.5
Applied rewrites75.5%
(FPCore (i n) :precision binary64 0.0)
double code(double i, double n) {
return 0.0;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 0.0d0
end function
public static double code(double i, double n) {
return 0.0;
}
def code(i, n): return 0.0
function code(i, n) return 0.0 end
function tmp = code(i, n) tmp = 0.0; end
code[i_, n_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 27.6%
lift-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lift-/.f64N/A
clear-numN/A
sub-negN/A
distribute-rgt-inN/A
lower-fma.f64N/A
lift-/.f64N/A
associate-/r/N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
lower-neg.f6420.6
Applied rewrites20.6%
Taylor expanded in i around 0
distribute-rgt-outN/A
metadata-evalN/A
mul0-rgtN/A
lower-/.f6419.6
Applied rewrites19.6%
Taylor expanded in i around 0
Applied rewrites19.6%
(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 2024237
(FPCore (i n)
:name "Compound Interest"
:precision binary64
:alt
(! :herbie-platform default (let ((lnbase (if (== (+ 1 (/ i n)) 1) (/ i n) (/ (* (/ i n) (log (+ 1 (/ i n)))) (- (+ (/ i n) 1) 1))))) (* 100 (/ (- (exp (* n lnbase)) 1) (/ i n)))))
(* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))