
(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 16 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 (fma t_0 100.0 -100.0))
(t_2 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_2 -2e-7)
(/ (* n t_1) i)
(if (<= t_2 2e-289)
(* 100.0 (/ (expm1 (* n (log1p (/ i n)))) (/ i n)))
(if (<= t_2 INFINITY) (* t_1 (/ n i)) (* n 100.0))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = fma(t_0, 100.0, -100.0);
double t_2 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_2 <= -2e-7) {
tmp = (n * t_1) / i;
} else if (t_2 <= 2e-289) {
tmp = 100.0 * (expm1((n * log1p((i / n)))) / (i / n));
} else if (t_2 <= ((double) INFINITY)) {
tmp = t_1 * (n / i);
} else {
tmp = n * 100.0;
}
return tmp;
}
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = fma(t_0, 100.0, -100.0) t_2 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_2 <= -2e-7) tmp = Float64(Float64(n * t_1) / i); elseif (t_2 <= 2e-289) tmp = Float64(100.0 * Float64(expm1(Float64(n * log1p(Float64(i / n)))) / Float64(i / n))); elseif (t_2 <= Inf) tmp = Float64(t_1 * Float64(n / i)); else tmp = Float64(n * 100.0); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * 100.0 + -100.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e-7], N[(N[(n * t$95$1), $MachinePrecision] / i), $MachinePrecision], If[LessEqual[t$95$2, 2e-289], 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$2, Infinity], N[(t$95$1 * N[(n / i), $MachinePrecision]), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \mathsf{fma}\left(t\_0, 100, -100\right)\\
t_2 := \frac{t\_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{-7}:\\
\;\;\;\;\frac{n \cdot t\_1}{i}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-289}:\\
\;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{\frac{i}{n}}\\
\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;t\_1 \cdot \frac{n}{i}\\
\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)) < -1.9999999999999999e-7Initial program 99.8%
lift-/.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift--.f64N/A
*-rgt-identityN/A
lift-/.f64N/A
associate-*r/N/A
lift-/.f64N/A
clear-numN/A
associate-*r*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites100.0%
if -1.9999999999999999e-7 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 2e-289Initial program 24.4%
lift-/.f64N/A
lift-+.f64N/A
sqr-powN/A
sqr-powN/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 2e-289 < (/.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%
lift-/.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift--.f64N/A
*-rgt-identityN/A
lift-/.f64N/A
associate-*r/N/A
lift-/.f64N/A
clear-numN/A
associate-*r*N/A
lower-*.f64N/A
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)) Initial program 0.0%
Taylor expanded in i around 0
*-commutativeN/A
lower-*.f6480.8
Applied rewrites80.8%
Final simplification96.4%
(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 -5e-196)
(* n (/ (fma t_0 100.0 -100.0) i))
(if (<= t_1 0.0)
(* n (* 100.0 (/ (expm1 i) i)))
(if (<= t_1 INFINITY)
(* 100.0 (- (* t_0 (/ n i)) (/ n i)))
(* n 100.0))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= -5e-196) {
tmp = n * (fma(t_0, 100.0, -100.0) / i);
} else if (t_1 <= 0.0) {
tmp = n * (100.0 * (expm1(i) / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = 100.0 * ((t_0 * (n / i)) - (n / i));
} else {
tmp = n * 100.0;
}
return tmp;
}
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_1 <= -5e-196) tmp = Float64(n * Float64(fma(t_0, 100.0, -100.0) / i)); elseif (t_1 <= 0.0) tmp = Float64(n * Float64(100.0 * Float64(expm1(i) / i))); elseif (t_1 <= Inf) tmp = Float64(100.0 * Float64(Float64(t_0 * Float64(n / i)) - Float64(n / i))); else tmp = Float64(n * 100.0); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-196], N[(n * N[(N[(t$95$0 * 100.0 + -100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(n * N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(100.0 * N[(N[(t$95$0 * N[(n / i), $MachinePrecision]), $MachinePrecision] - N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t\_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{-196}:\\
\;\;\;\;n \cdot \frac{\mathsf{fma}\left(t\_0, 100, -100\right)}{i}\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;100 \cdot \left(t\_0 \cdot \frac{n}{i} - \frac{n}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < -5.0000000000000005e-196Initial program 90.9%
lift-/.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift--.f64N/A
*-rgt-identityN/A
lift-/.f64N/A
associate-*r/N/A
div-invN/A
associate-*r/N/A
lift-/.f64N/A
associate-/r/N/A
lower-*.f64N/A
Applied rewrites91.1%
if -5.0000000000000005e-196 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 0.0Initial program 18.4%
Taylor expanded in n around inf
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6470.3
Applied rewrites70.3%
lift-expm1.f64N/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6476.1
Applied rewrites76.1%
if 0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 95.8%
lift-/.f64N/A
lift-+.f64N/A
sqr-powN/A
sqr-powN/A
pow-to-expN/A
lower-expm1.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
lower-log1p.f6451.8
Applied rewrites51.8%
lift-/.f64N/A
lift-+.f64N/A
rem-exp-logN/A
lift-+.f64N/A
lift-log1p.f64N/A
lift-log1p.f64N/A
lift-+.f64N/A
rem-exp-logN/A
lift-+.f64N/A
lift-log1p.f64N/A
lift-*.f64N/A
lift-/.f64N/A
div-subN/A
Applied rewrites96.0%
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-*.f6480.8
Applied rewrites80.8%
Final simplification80.4%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n))
(t_1 (fma t_0 100.0 -100.0))
(t_2 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_2 -5e-196)
(* n (/ t_1 i))
(if (<= t_2 0.0)
(* n (* 100.0 (/ (expm1 i) i)))
(if (<= t_2 INFINITY) (* t_1 (/ n i)) (* n 100.0))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = fma(t_0, 100.0, -100.0);
double t_2 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_2 <= -5e-196) {
tmp = n * (t_1 / i);
} else if (t_2 <= 0.0) {
tmp = n * (100.0 * (expm1(i) / i));
} else if (t_2 <= ((double) INFINITY)) {
tmp = t_1 * (n / i);
} else {
tmp = n * 100.0;
}
return tmp;
}
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = fma(t_0, 100.0, -100.0) t_2 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_2 <= -5e-196) tmp = Float64(n * Float64(t_1 / i)); elseif (t_2 <= 0.0) tmp = Float64(n * Float64(100.0 * Float64(expm1(i) / i))); elseif (t_2 <= Inf) tmp = Float64(t_1 * Float64(n / i)); else tmp = Float64(n * 100.0); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * 100.0 + -100.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e-196], N[(n * N[(t$95$1 / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.0], N[(n * N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[(t$95$1 * N[(n / i), $MachinePrecision]), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \mathsf{fma}\left(t\_0, 100, -100\right)\\
t_2 := \frac{t\_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-196}:\\
\;\;\;\;n \cdot \frac{t\_1}{i}\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;t\_1 \cdot \frac{n}{i}\\
\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)) < -5.0000000000000005e-196Initial program 90.9%
lift-/.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift--.f64N/A
*-rgt-identityN/A
lift-/.f64N/A
associate-*r/N/A
div-invN/A
associate-*r/N/A
lift-/.f64N/A
associate-/r/N/A
lower-*.f64N/A
Applied rewrites91.1%
if -5.0000000000000005e-196 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 0.0Initial program 18.4%
Taylor expanded in n around inf
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6470.3
Applied rewrites70.3%
lift-expm1.f64N/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6476.1
Applied rewrites76.1%
if 0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 95.8%
lift-/.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift--.f64N/A
*-rgt-identityN/A
lift-/.f64N/A
associate-*r/N/A
lift-/.f64N/A
clear-numN/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites95.9%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) Initial program 0.0%
Taylor expanded in i around 0
*-commutativeN/A
lower-*.f6480.8
Applied rewrites80.8%
Final simplification80.3%
(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 -5e-196)
t_2
(if (<= t_1 0.0)
(* n (* 100.0 (/ (expm1 i) i)))
(if (<= t_1 INFINITY) t_2 (* n 100.0))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
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 <= -5e-196) {
tmp = t_2;
} else if (t_1 <= 0.0) {
tmp = n * (100.0 * (expm1(i) / i));
} 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 <= -5e-196) tmp = t_2; elseif (t_1 <= 0.0) tmp = Float64(n * Float64(100.0 * Float64(expm1(i) / i))); elseif (t_1 <= Inf) tmp = t_2; else tmp = Float64(n * 100.0); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[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, -5e-196], t$95$2, If[LessEqual[t$95$1, 0.0], N[(n * N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$2, N[(n * 100.0), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
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 -5 \cdot 10^{-196}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < -5.0000000000000005e-196 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 93.5%
lift-/.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift--.f64N/A
*-rgt-identityN/A
lift-/.f64N/A
associate-*r/N/A
div-invN/A
associate-*r/N/A
lift-/.f64N/A
associate-/r/N/A
lower-*.f64N/A
Applied rewrites93.5%
if -5.0000000000000005e-196 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 0.0Initial program 18.4%
Taylor expanded in n around inf
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6470.3
Applied rewrites70.3%
lift-expm1.f64N/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6476.1
Applied rewrites76.1%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) Initial program 0.0%
Taylor expanded in i around 0
*-commutativeN/A
lower-*.f6480.8
Applied rewrites80.8%
Final simplification80.3%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* n (* 100.0 (/ (expm1 i) i)))))
(if (<= n -2e-311)
t_0
(if (<= n 1.6e-142)
(* 100.0 (/ (* n (- (log i) (log n))) (/ i n)))
t_0))))
double code(double i, double n) {
double t_0 = n * (100.0 * (expm1(i) / i));
double tmp;
if (n <= -2e-311) {
tmp = t_0;
} else if (n <= 1.6e-142) {
tmp = 100.0 * ((n * (log(i) - log(n))) / (i / n));
} 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 <= -2e-311) {
tmp = t_0;
} else if (n <= 1.6e-142) {
tmp = 100.0 * ((n * (Math.log(i) - Math.log(n))) / (i / n));
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = n * (100.0 * (math.expm1(i) / i)) tmp = 0 if n <= -2e-311: tmp = t_0 elif n <= 1.6e-142: tmp = 100.0 * ((n * (math.log(i) - math.log(n))) / (i / n)) 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 <= -2e-311) tmp = t_0; elseif (n <= 1.6e-142) tmp = Float64(100.0 * Float64(Float64(n * Float64(log(i) - log(n))) / Float64(i / n))); 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, -2e-311], t$95$0, If[LessEqual[n, 1.6e-142], N[(100.0 * N[(N[(n * N[(N[Log[i], $MachinePrecision] - N[Log[n], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(i / n), $MachinePrecision]), $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 -2 \cdot 10^{-311}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 1.6 \cdot 10^{-142}:\\
\;\;\;\;100 \cdot \frac{n \cdot \left(\log i - \log n\right)}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -1.9999999999999e-311 or 1.5999999999999999e-142 < n Initial program 28.5%
Taylor expanded in n around inf
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6473.0
Applied rewrites73.0%
lift-expm1.f64N/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6478.1
Applied rewrites78.1%
if -1.9999999999999e-311 < n < 1.5999999999999999e-142Initial program 44.0%
Taylor expanded in n around 0
lower-*.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-log.f64N/A
lower-log.f6490.8
Applied rewrites90.8%
Final simplification79.2%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* n (* 100.0 (/ (expm1 i) i)))))
(if (<= n -2e-311)
t_0
(if (<= n 1.6e-142)
(* 100.0 (* n (* n (/ (- (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 <= -2e-311) {
tmp = t_0;
} else if (n <= 1.6e-142) {
tmp = 100.0 * (n * (n * ((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 <= -2e-311) {
tmp = t_0;
} else if (n <= 1.6e-142) {
tmp = 100.0 * (n * (n * ((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 <= -2e-311: tmp = t_0 elif n <= 1.6e-142: tmp = 100.0 * (n * (n * ((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 <= -2e-311) tmp = t_0; elseif (n <= 1.6e-142) tmp = Float64(100.0 * Float64(n * Float64(n * Float64(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, -2e-311], t$95$0, If[LessEqual[n, 1.6e-142], N[(100.0 * N[(n * N[(n * N[(N[(N[Log[i], $MachinePrecision] - N[Log[n], $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $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 -2 \cdot 10^{-311}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 1.6 \cdot 10^{-142}:\\
\;\;\;\;100 \cdot \left(n \cdot \left(n \cdot \frac{\log i - \log n}{i}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -1.9999999999999e-311 or 1.5999999999999999e-142 < n Initial program 28.5%
Taylor expanded in n around inf
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6473.0
Applied rewrites73.0%
lift-expm1.f64N/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6478.1
Applied rewrites78.1%
if -1.9999999999999e-311 < n < 1.5999999999999999e-142Initial program 44.0%
lift-/.f64N/A
lift-+.f64N/A
sqr-powN/A
sqr-powN/A
pow-to-expN/A
lower-expm1.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
lower-log1p.f6473.4
Applied rewrites73.4%
lift-/.f64N/A
lift-+.f64N/A
rem-exp-logN/A
lift-+.f64N/A
lift-log1p.f64N/A
lift-log1p.f64N/A
lift-+.f64N/A
rem-exp-logN/A
lift-+.f64N/A
lift-log1p.f64N/A
lift-*.f64N/A
lift-/.f64N/A
div-subN/A
Applied rewrites44.0%
Taylor expanded in n around 0
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
div-subN/A
unsub-negN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-log.f64N/A
lower-log.f6490.6
Applied rewrites90.6%
Final simplification79.2%
(FPCore (i n)
:precision binary64
(if (<= i 8.5e-181)
(* n (* 100.0 (/ (expm1 i) i)))
(if (<= i 4.5e+63)
(* 100.0 (/ (* n (expm1 i)) i))
(*
100.0
(/
(+ (* (/ i n) (/ (pow (+ 1.0 (/ i n)) n) i)) (/ -1.0 n))
(/ (/ i n) n))))))
double code(double i, double n) {
double tmp;
if (i <= 8.5e-181) {
tmp = n * (100.0 * (expm1(i) / i));
} else if (i <= 4.5e+63) {
tmp = 100.0 * ((n * expm1(i)) / i);
} else {
tmp = 100.0 * ((((i / n) * (pow((1.0 + (i / n)), n) / i)) + (-1.0 / n)) / ((i / n) / n));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if (i <= 8.5e-181) {
tmp = n * (100.0 * (Math.expm1(i) / i));
} else if (i <= 4.5e+63) {
tmp = 100.0 * ((n * Math.expm1(i)) / i);
} else {
tmp = 100.0 * ((((i / n) * (Math.pow((1.0 + (i / n)), n) / i)) + (-1.0 / n)) / ((i / n) / n));
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 8.5e-181: tmp = n * (100.0 * (math.expm1(i) / i)) elif i <= 4.5e+63: tmp = 100.0 * ((n * math.expm1(i)) / i) else: tmp = 100.0 * ((((i / n) * (math.pow((1.0 + (i / n)), n) / i)) + (-1.0 / n)) / ((i / n) / n)) return tmp
function code(i, n) tmp = 0.0 if (i <= 8.5e-181) tmp = Float64(n * Float64(100.0 * Float64(expm1(i) / i))); elseif (i <= 4.5e+63) tmp = Float64(100.0 * Float64(Float64(n * expm1(i)) / i)); else tmp = Float64(100.0 * Float64(Float64(Float64(Float64(i / n) * Float64((Float64(1.0 + Float64(i / n)) ^ n) / i)) + Float64(-1.0 / n)) / Float64(Float64(i / n) / n))); end return tmp end
code[i_, n_] := If[LessEqual[i, 8.5e-181], N[(n * N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 4.5e+63], N[(100.0 * N[(N[(n * N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(N[(N[(N[(i / n), $MachinePrecision] * N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / n), $MachinePrecision]), $MachinePrecision] / N[(N[(i / n), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 8.5 \cdot 10^{-181}:\\
\;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;i \leq 4.5 \cdot 10^{+63}:\\
\;\;\;\;100 \cdot \frac{n \cdot \mathsf{expm1}\left(i\right)}{i}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{\frac{i}{n} \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n}}{i} + \frac{-1}{n}}{\frac{\frac{i}{n}}{n}}\\
\end{array}
\end{array}
if i < 8.49999999999999953e-181Initial program 24.1%
Taylor expanded in n around inf
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6474.3
Applied rewrites74.3%
lift-expm1.f64N/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6483.1
Applied rewrites83.1%
if 8.49999999999999953e-181 < i < 4.50000000000000017e63Initial program 21.4%
Taylor expanded in n around inf
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6480.3
Applied rewrites80.3%
if 4.50000000000000017e63 < i Initial program 60.5%
lift-/.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift--.f64N/A
*-rgt-identityN/A
lift-/.f64N/A
associate-*r/N/A
div-invN/A
lift--.f64N/A
div-subN/A
lift-/.f64N/A
div-invN/A
associate-/r*N/A
frac-subN/A
lower-/.f64N/A
Applied rewrites62.6%
Final simplification78.9%
(FPCore (i n) :precision binary64 (let* ((t_0 (* n (* 100.0 (/ (expm1 i) i))))) (if (<= n -8.8e-205) t_0 (if (<= n 5.8e-130) (* 100.0 0.0) t_0))))
double code(double i, double n) {
double t_0 = n * (100.0 * (expm1(i) / i));
double tmp;
if (n <= -8.8e-205) {
tmp = t_0;
} else if (n <= 5.8e-130) {
tmp = 100.0 * 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 <= -8.8e-205) {
tmp = t_0;
} else if (n <= 5.8e-130) {
tmp = 100.0 * 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 <= -8.8e-205: tmp = t_0 elif n <= 5.8e-130: tmp = 100.0 * 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 <= -8.8e-205) tmp = t_0; elseif (n <= 5.8e-130) tmp = Float64(100.0 * 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, -8.8e-205], t$95$0, If[LessEqual[n, 5.8e-130], N[(100.0 * 0.0), $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 -8.8 \cdot 10^{-205}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 5.8 \cdot 10^{-130}:\\
\;\;\;\;100 \cdot 0\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -8.80000000000000036e-205 or 5.8e-130 < n Initial program 26.7%
Taylor expanded in n around inf
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6474.4
Applied rewrites74.4%
lift-expm1.f64N/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6479.4
Applied rewrites79.4%
if -8.80000000000000036e-205 < n < 5.8e-130Initial program 50.5%
lift-/.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift--.f64N/A
*-rgt-identityN/A
div-invN/A
times-fracN/A
div-invN/A
lift--.f64N/A
div-subN/A
sub-divN/A
frac-subN/A
pow2N/A
lower-/.f64N/A
Applied rewrites32.4%
Taylor expanded in i around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6452.4
Applied rewrites52.4%
metadata-evalN/A
frac-timesN/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
div-subN/A
+-inverses70.5
Applied rewrites70.5%
Final simplification78.2%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (/ (* n (expm1 i)) i))))
(if (<= n -2.2e-18)
t_0
(if (<= n 0.0013) (* 100.0 (/ (/ 1.0 n) (/ (/ 1.0 n) n))) t_0))))
double code(double i, double n) {
double t_0 = 100.0 * ((n * expm1(i)) / i);
double tmp;
if (n <= -2.2e-18) {
tmp = t_0;
} else if (n <= 0.0013) {
tmp = 100.0 * ((1.0 / n) / ((1.0 / n) / n));
} 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 <= -2.2e-18) {
tmp = t_0;
} else if (n <= 0.0013) {
tmp = 100.0 * ((1.0 / n) / ((1.0 / n) / n));
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * ((n * math.expm1(i)) / i) tmp = 0 if n <= -2.2e-18: tmp = t_0 elif n <= 0.0013: tmp = 100.0 * ((1.0 / n) / ((1.0 / n) / n)) 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 <= -2.2e-18) tmp = t_0; elseif (n <= 0.0013) tmp = Float64(100.0 * Float64(Float64(1.0 / n) / Float64(Float64(1.0 / n) / n))); 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, -2.2e-18], t$95$0, If[LessEqual[n, 0.0013], N[(100.0 * N[(N[(1.0 / n), $MachinePrecision] / N[(N[(1.0 / n), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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 -2.2 \cdot 10^{-18}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 0.0013:\\
\;\;\;\;100 \cdot \frac{\frac{1}{n}}{\frac{\frac{1}{n}}{n}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -2.1999999999999998e-18 or 0.0012999999999999999 < n Initial program 29.4%
Taylor expanded in n around inf
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6486.9
Applied rewrites86.9%
if -2.1999999999999998e-18 < n < 0.0012999999999999999Initial program 30.8%
lift-/.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift--.f64N/A
*-rgt-identityN/A
div-invN/A
times-fracN/A
div-invN/A
lift--.f64N/A
div-subN/A
sub-divN/A
frac-subN/A
pow2N/A
lower-/.f64N/A
Applied rewrites23.1%
Taylor expanded in i around 0
lower-/.f6459.3
Applied rewrites59.3%
(FPCore (i n)
:precision binary64
(if (<= n -2.8e-132)
(* n (fma i (fma i 16.666666666666668 50.0) 100.0))
(if (<= n 5.8e-130)
(* 100.0 0.0)
(*
100.0
(fma
i
(fma i (* n (fma i 0.041666666666666664 0.16666666666666666)) (* n 0.5))
n)))))
double code(double i, double n) {
double tmp;
if (n <= -2.8e-132) {
tmp = n * fma(i, fma(i, 16.666666666666668, 50.0), 100.0);
} else if (n <= 5.8e-130) {
tmp = 100.0 * 0.0;
} else {
tmp = 100.0 * fma(i, fma(i, (n * fma(i, 0.041666666666666664, 0.16666666666666666)), (n * 0.5)), n);
}
return tmp;
}
function code(i, n) tmp = 0.0 if (n <= -2.8e-132) tmp = Float64(n * fma(i, fma(i, 16.666666666666668, 50.0), 100.0)); elseif (n <= 5.8e-130) tmp = Float64(100.0 * 0.0); else tmp = Float64(100.0 * fma(i, fma(i, Float64(n * fma(i, 0.041666666666666664, 0.16666666666666666)), Float64(n * 0.5)), n)); end return tmp end
code[i_, n_] := If[LessEqual[n, -2.8e-132], N[(n * N[(i * N[(i * 16.666666666666668 + 50.0), $MachinePrecision] + 100.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 5.8e-130], N[(100.0 * 0.0), $MachinePrecision], N[(100.0 * N[(i * N[(i * N[(n * N[(i * 0.041666666666666664 + 0.16666666666666666), $MachinePrecision]), $MachinePrecision] + N[(n * 0.5), $MachinePrecision]), $MachinePrecision] + n), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.8 \cdot 10^{-132}:\\
\;\;\;\;n \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, 16.666666666666668, 50\right), 100\right)\\
\mathbf{elif}\;n \leq 5.8 \cdot 10^{-130}:\\
\;\;\;\;100 \cdot 0\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, n \cdot \mathsf{fma}\left(i, 0.041666666666666664, 0.16666666666666666\right), n \cdot 0.5\right), n\right)\\
\end{array}
\end{array}
if n < -2.80000000000000002e-132Initial program 31.1%
Taylor expanded in n around inf
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6476.6
Applied rewrites76.6%
lift-expm1.f64N/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6480.1
Applied rewrites80.1%
Taylor expanded in i around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6454.3
Applied rewrites54.3%
if -2.80000000000000002e-132 < n < 5.8e-130Initial program 47.5%
lift-/.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift--.f64N/A
*-rgt-identityN/A
div-invN/A
times-fracN/A
div-invN/A
lift--.f64N/A
div-subN/A
sub-divN/A
frac-subN/A
pow2N/A
lower-/.f64N/A
Applied rewrites34.4%
Taylor expanded in i around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6446.2
Applied rewrites46.2%
metadata-evalN/A
frac-timesN/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
div-subN/A
+-inverses61.3
Applied rewrites61.3%
if 5.8e-130 < n Initial program 19.8%
Taylor expanded in n around inf
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6479.2
Applied rewrites79.2%
Taylor expanded in i around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
associate-*r*N/A
distribute-rgt-outN/A
+-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6472.1
Applied rewrites72.1%
(FPCore (i n)
:precision binary64
(if (<= n -2.8e-132)
(* n (fma i (fma i 16.666666666666668 50.0) 100.0))
(if (<= n 5.8e-130)
(* 100.0 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 <= -2.8e-132) {
tmp = n * fma(i, fma(i, 16.666666666666668, 50.0), 100.0);
} else if (n <= 5.8e-130) {
tmp = 100.0 * 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 <= -2.8e-132) tmp = Float64(n * fma(i, fma(i, 16.666666666666668, 50.0), 100.0)); elseif (n <= 5.8e-130) tmp = Float64(100.0 * 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, -2.8e-132], N[(n * N[(i * N[(i * 16.666666666666668 + 50.0), $MachinePrecision] + 100.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 5.8e-130], N[(100.0 * 0.0), $MachinePrecision], 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 -2.8 \cdot 10^{-132}:\\
\;\;\;\;n \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, 16.666666666666668, 50\right), 100\right)\\
\mathbf{elif}\;n \leq 5.8 \cdot 10^{-130}:\\
\;\;\;\;100 \cdot 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 < -2.80000000000000002e-132Initial program 31.1%
Taylor expanded in n around inf
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6476.6
Applied rewrites76.6%
lift-expm1.f64N/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6480.1
Applied rewrites80.1%
Taylor expanded in i around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6454.3
Applied rewrites54.3%
if -2.80000000000000002e-132 < n < 5.8e-130Initial program 47.5%
lift-/.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift--.f64N/A
*-rgt-identityN/A
div-invN/A
times-fracN/A
div-invN/A
lift--.f64N/A
div-subN/A
sub-divN/A
frac-subN/A
pow2N/A
lower-/.f64N/A
Applied rewrites34.4%
Taylor expanded in i around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6446.2
Applied rewrites46.2%
metadata-evalN/A
frac-timesN/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
div-subN/A
+-inverses61.3
Applied rewrites61.3%
if 5.8e-130 < n Initial program 19.8%
Taylor expanded in n around inf
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6479.2
Applied rewrites79.2%
lift-expm1.f64N/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6483.7
Applied rewrites83.7%
Taylor expanded in i around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6472.1
Applied rewrites72.1%
(FPCore (i n) :precision binary64 (if (<= n -2.8e-132) (* n (fma i (fma i 16.666666666666668 50.0) 100.0)) (if (<= n 5.8e-130) (* 100.0 0.0) (fma n (fma 50.0 i 100.0) (* i -50.0)))))
double code(double i, double n) {
double tmp;
if (n <= -2.8e-132) {
tmp = n * fma(i, fma(i, 16.666666666666668, 50.0), 100.0);
} else if (n <= 5.8e-130) {
tmp = 100.0 * 0.0;
} else {
tmp = fma(n, fma(50.0, i, 100.0), (i * -50.0));
}
return tmp;
}
function code(i, n) tmp = 0.0 if (n <= -2.8e-132) tmp = Float64(n * fma(i, fma(i, 16.666666666666668, 50.0), 100.0)); elseif (n <= 5.8e-130) tmp = Float64(100.0 * 0.0); else tmp = fma(n, fma(50.0, i, 100.0), Float64(i * -50.0)); end return tmp end
code[i_, n_] := If[LessEqual[n, -2.8e-132], N[(n * N[(i * N[(i * 16.666666666666668 + 50.0), $MachinePrecision] + 100.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 5.8e-130], N[(100.0 * 0.0), $MachinePrecision], N[(n * N[(50.0 * i + 100.0), $MachinePrecision] + N[(i * -50.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.8 \cdot 10^{-132}:\\
\;\;\;\;n \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, 16.666666666666668, 50\right), 100\right)\\
\mathbf{elif}\;n \leq 5.8 \cdot 10^{-130}:\\
\;\;\;\;100 \cdot 0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(n, \mathsf{fma}\left(50, i, 100\right), i \cdot -50\right)\\
\end{array}
\end{array}
if n < -2.80000000000000002e-132Initial program 31.1%
Taylor expanded in n around inf
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6476.6
Applied rewrites76.6%
lift-expm1.f64N/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6480.1
Applied rewrites80.1%
Taylor expanded in i around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6454.3
Applied rewrites54.3%
if -2.80000000000000002e-132 < n < 5.8e-130Initial program 47.5%
lift-/.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift--.f64N/A
*-rgt-identityN/A
div-invN/A
times-fracN/A
div-invN/A
lift--.f64N/A
div-subN/A
sub-divN/A
frac-subN/A
pow2N/A
lower-/.f64N/A
Applied rewrites34.4%
Taylor expanded in i around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6446.2
Applied rewrites46.2%
metadata-evalN/A
frac-timesN/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
div-subN/A
+-inverses61.3
Applied rewrites61.3%
if 5.8e-130 < n Initial program 19.8%
Taylor expanded in i around 0
distribute-lft-outN/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6467.5
Applied rewrites67.5%
Taylor expanded in n around 0
+-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-inN/A
metadata-evalN/A
associate-*r*N/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6467.4
Applied rewrites67.4%
(FPCore (i n) :precision binary64 (if (<= n -2.8e-132) (* n (fma i (fma i 16.666666666666668 50.0) 100.0)) (if (<= n 5.8e-130) (* 100.0 0.0) (* n (fma 50.0 i 100.0)))))
double code(double i, double n) {
double tmp;
if (n <= -2.8e-132) {
tmp = n * fma(i, fma(i, 16.666666666666668, 50.0), 100.0);
} else if (n <= 5.8e-130) {
tmp = 100.0 * 0.0;
} else {
tmp = n * fma(50.0, i, 100.0);
}
return tmp;
}
function code(i, n) tmp = 0.0 if (n <= -2.8e-132) tmp = Float64(n * fma(i, fma(i, 16.666666666666668, 50.0), 100.0)); elseif (n <= 5.8e-130) tmp = Float64(100.0 * 0.0); else tmp = Float64(n * fma(50.0, i, 100.0)); end return tmp end
code[i_, n_] := If[LessEqual[n, -2.8e-132], N[(n * N[(i * N[(i * 16.666666666666668 + 50.0), $MachinePrecision] + 100.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 5.8e-130], N[(100.0 * 0.0), $MachinePrecision], N[(n * N[(50.0 * i + 100.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.8 \cdot 10^{-132}:\\
\;\;\;\;n \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, 16.666666666666668, 50\right), 100\right)\\
\mathbf{elif}\;n \leq 5.8 \cdot 10^{-130}:\\
\;\;\;\;100 \cdot 0\\
\mathbf{else}:\\
\;\;\;\;n \cdot \mathsf{fma}\left(50, i, 100\right)\\
\end{array}
\end{array}
if n < -2.80000000000000002e-132Initial program 31.1%
Taylor expanded in n around inf
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6476.6
Applied rewrites76.6%
lift-expm1.f64N/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6480.1
Applied rewrites80.1%
Taylor expanded in i around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6454.3
Applied rewrites54.3%
if -2.80000000000000002e-132 < n < 5.8e-130Initial program 47.5%
lift-/.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift--.f64N/A
*-rgt-identityN/A
div-invN/A
times-fracN/A
div-invN/A
lift--.f64N/A
div-subN/A
sub-divN/A
frac-subN/A
pow2N/A
lower-/.f64N/A
Applied rewrites34.4%
Taylor expanded in i around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6446.2
Applied rewrites46.2%
metadata-evalN/A
frac-timesN/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
div-subN/A
+-inverses61.3
Applied rewrites61.3%
if 5.8e-130 < n Initial program 19.8%
Taylor expanded in n around inf
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6479.2
Applied rewrites79.2%
Taylor expanded in i around 0
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-fma.f6467.4
Applied rewrites67.4%
(FPCore (i n) :precision binary64 (let* ((t_0 (* n (fma 50.0 i 100.0)))) (if (<= n -2.8e-132) t_0 (if (<= n 5.8e-130) (* 100.0 0.0) t_0))))
double code(double i, double n) {
double t_0 = n * fma(50.0, i, 100.0);
double tmp;
if (n <= -2.8e-132) {
tmp = t_0;
} else if (n <= 5.8e-130) {
tmp = 100.0 * 0.0;
} else {
tmp = t_0;
}
return tmp;
}
function code(i, n) t_0 = Float64(n * fma(50.0, i, 100.0)) tmp = 0.0 if (n <= -2.8e-132) tmp = t_0; elseif (n <= 5.8e-130) tmp = Float64(100.0 * 0.0); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(n * N[(50.0 * i + 100.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -2.8e-132], t$95$0, If[LessEqual[n, 5.8e-130], N[(100.0 * 0.0), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \mathsf{fma}\left(50, i, 100\right)\\
\mathbf{if}\;n \leq -2.8 \cdot 10^{-132}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 5.8 \cdot 10^{-130}:\\
\;\;\;\;100 \cdot 0\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -2.80000000000000002e-132 or 5.8e-130 < n Initial program 25.6%
Taylor expanded in n around inf
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6477.9
Applied rewrites77.9%
Taylor expanded in i around 0
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-fma.f6459.7
Applied rewrites59.7%
if -2.80000000000000002e-132 < n < 5.8e-130Initial program 47.5%
lift-/.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift--.f64N/A
*-rgt-identityN/A
div-invN/A
times-fracN/A
div-invN/A
lift--.f64N/A
div-subN/A
sub-divN/A
frac-subN/A
pow2N/A
lower-/.f64N/A
Applied rewrites34.4%
Taylor expanded in i around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6446.2
Applied rewrites46.2%
metadata-evalN/A
frac-timesN/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
div-subN/A
+-inverses61.3
Applied rewrites61.3%
(FPCore (i n) :precision binary64 (if (<= i -3.4e+49) (* 100.0 0.0) (if (<= i 6.6e-46) (* n 100.0) (* 100.0 0.0))))
double code(double i, double n) {
double tmp;
if (i <= -3.4e+49) {
tmp = 100.0 * 0.0;
} else if (i <= 6.6e-46) {
tmp = n * 100.0;
} else {
tmp = 100.0 * 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 <= (-3.4d+49)) then
tmp = 100.0d0 * 0.0d0
else if (i <= 6.6d-46) then
tmp = n * 100.0d0
else
tmp = 100.0d0 * 0.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= -3.4e+49) {
tmp = 100.0 * 0.0;
} else if (i <= 6.6e-46) {
tmp = n * 100.0;
} else {
tmp = 100.0 * 0.0;
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -3.4e+49: tmp = 100.0 * 0.0 elif i <= 6.6e-46: tmp = n * 100.0 else: tmp = 100.0 * 0.0 return tmp
function code(i, n) tmp = 0.0 if (i <= -3.4e+49) tmp = Float64(100.0 * 0.0); elseif (i <= 6.6e-46) tmp = Float64(n * 100.0); else tmp = Float64(100.0 * 0.0); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -3.4e+49) tmp = 100.0 * 0.0; elseif (i <= 6.6e-46) tmp = n * 100.0; else tmp = 100.0 * 0.0; end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -3.4e+49], N[(100.0 * 0.0), $MachinePrecision], If[LessEqual[i, 6.6e-46], N[(n * 100.0), $MachinePrecision], N[(100.0 * 0.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -3.4 \cdot 10^{+49}:\\
\;\;\;\;100 \cdot 0\\
\mathbf{elif}\;i \leq 6.6 \cdot 10^{-46}:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;100 \cdot 0\\
\end{array}
\end{array}
if i < -3.4000000000000001e49 or 6.60000000000000027e-46 < i Initial program 59.2%
lift-/.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift--.f64N/A
*-rgt-identityN/A
div-invN/A
times-fracN/A
div-invN/A
lift--.f64N/A
div-subN/A
sub-divN/A
frac-subN/A
pow2N/A
lower-/.f64N/A
Applied rewrites44.0%
Taylor expanded in i around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6427.5
Applied rewrites27.5%
metadata-evalN/A
frac-timesN/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
div-subN/A
+-inverses28.4
Applied rewrites28.4%
if -3.4000000000000001e49 < i < 6.60000000000000027e-46Initial program 8.6%
Taylor expanded in i around 0
*-commutativeN/A
lower-*.f6477.7
Applied rewrites77.7%
(FPCore (i n) :precision binary64 (* 100.0 0.0))
double code(double i, double n) {
return 100.0 * 0.0;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 100.0d0 * 0.0d0
end function
public static double code(double i, double n) {
return 100.0 * 0.0;
}
def code(i, n): return 100.0 * 0.0
function code(i, n) return Float64(100.0 * 0.0) end
function tmp = code(i, n) tmp = 100.0 * 0.0; end
code[i_, n_] := N[(100.0 * 0.0), $MachinePrecision]
\begin{array}{l}
\\
100 \cdot 0
\end{array}
Initial program 29.9%
lift-/.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift--.f64N/A
*-rgt-identityN/A
div-invN/A
times-fracN/A
div-invN/A
lift--.f64N/A
div-subN/A
sub-divN/A
frac-subN/A
pow2N/A
lower-/.f64N/A
Applied rewrites21.1%
Taylor expanded in i around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6413.3
Applied rewrites13.3%
metadata-evalN/A
frac-timesN/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
div-subN/A
+-inverses16.1
Applied rewrites16.1%
(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 2024219
(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))))