
(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 (+ (/ i n) 1.0) n)) (t_1 (/ (- t_0 1.0) (/ i n))))
(if (<= t_1 0.0)
(* (/ (expm1 (* (log1p (/ i n)) n)) (/ i n)) 100.0)
(if (<= t_1 INFINITY)
(fma -100.0 (/ n i) (* (* 100.0 n) (/ t_0 i)))
(* 100.0 n)))))
double code(double i, double n) {
double t_0 = pow(((i / n) + 1.0), n);
double t_1 = (t_0 - 1.0) / (i / n);
double tmp;
if (t_1 <= 0.0) {
tmp = (expm1((log1p((i / n)) * n)) / (i / n)) * 100.0;
} else if (t_1 <= ((double) INFINITY)) {
tmp = fma(-100.0, (n / i), ((100.0 * n) * (t_0 / i)));
} else {
tmp = 100.0 * n;
}
return tmp;
}
function code(i, n) t_0 = Float64(Float64(i / n) + 1.0) ^ n t_1 = Float64(Float64(t_0 - 1.0) / Float64(i / n)) tmp = 0.0 if (t_1 <= 0.0) tmp = Float64(Float64(expm1(Float64(log1p(Float64(i / n)) * n)) / Float64(i / n)) * 100.0); elseif (t_1 <= Inf) tmp = fma(-100.0, Float64(n / i), Float64(Float64(100.0 * n) * Float64(t_0 / i))); else tmp = Float64(100.0 * n); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(N[(i / n), $MachinePrecision] + 1.0), $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[(N[(N[(Exp[N[(N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision] * n), $MachinePrecision]] - 1), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision] * 100.0), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(-100.0 * N[(n / i), $MachinePrecision] + N[(N[(100.0 * n), $MachinePrecision] * N[(t$95$0 / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * n), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\frac{i}{n} + 1\right)}^{n}\\
t_1 := \frac{t\_0 - 1}{\frac{i}{n}}\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;\frac{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{i}{n}\right) \cdot n\right)}{\frac{i}{n}} \cdot 100\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(-100, \frac{n}{i}, \left(100 \cdot n\right) \cdot \frac{t\_0}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;100 \cdot n\\
\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.1%
lift--.f64N/A
lift-pow.f64N/A
pow-to-expN/A
lower-expm1.f64N/A
lower-*.f64N/A
lift-+.f64N/A
lower-log1p.f6499.1
Applied rewrites99.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 96.9%
lift--.f64N/A
lift-pow.f64N/A
pow-to-expN/A
lower-expm1.f64N/A
lower-*.f64N/A
lift-+.f64N/A
lower-log1p.f6466.2
Applied rewrites66.2%
Applied rewrites80.5%
lift-fma.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/r/N/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f6452.5
lift-neg.f64N/A
lift-/.f64N/A
distribute-neg-fracN/A
Applied rewrites52.5%
lift-*.f64N/A
lift-fma.f64N/A
+-commutativeN/A
distribute-lft-inN/A
lift-/.f64N/A
lift-neg.f64N/A
distribute-frac-negN/A
distribute-frac-neg2N/A
associate-*r/N/A
neg-mul-1N/A
metadata-evalN/A
times-fracN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites97.2%
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
lower-*.f6480.8
Applied rewrites80.8%
Final simplification96.2%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* (* (/ (expm1 i) i) n) 100.0)))
(if (<= n -8.2e-126)
t_0
(if (<= n 1e-271)
(/ 0.0 i)
(if (<= n 1.08e-72)
(* (/ (* 1.0 i) (/ i n)) 100.0)
(if (<= n 4.7e-28)
(/ (* (- (log i) (log n)) (* (* n n) 100.0)) i)
t_0))))))
double code(double i, double n) {
double t_0 = ((expm1(i) / i) * n) * 100.0;
double tmp;
if (n <= -8.2e-126) {
tmp = t_0;
} else if (n <= 1e-271) {
tmp = 0.0 / i;
} else if (n <= 1.08e-72) {
tmp = ((1.0 * i) / (i / n)) * 100.0;
} else if (n <= 4.7e-28) {
tmp = ((log(i) - log(n)) * ((n * n) * 100.0)) / i;
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = ((Math.expm1(i) / i) * n) * 100.0;
double tmp;
if (n <= -8.2e-126) {
tmp = t_0;
} else if (n <= 1e-271) {
tmp = 0.0 / i;
} else if (n <= 1.08e-72) {
tmp = ((1.0 * i) / (i / n)) * 100.0;
} else if (n <= 4.7e-28) {
tmp = ((Math.log(i) - Math.log(n)) * ((n * n) * 100.0)) / i;
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = ((math.expm1(i) / i) * n) * 100.0 tmp = 0 if n <= -8.2e-126: tmp = t_0 elif n <= 1e-271: tmp = 0.0 / i elif n <= 1.08e-72: tmp = ((1.0 * i) / (i / n)) * 100.0 elif n <= 4.7e-28: tmp = ((math.log(i) - math.log(n)) * ((n * n) * 100.0)) / i else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(Float64(Float64(expm1(i) / i) * n) * 100.0) tmp = 0.0 if (n <= -8.2e-126) tmp = t_0; elseif (n <= 1e-271) tmp = Float64(0.0 / i); elseif (n <= 1.08e-72) tmp = Float64(Float64(Float64(1.0 * i) / Float64(i / n)) * 100.0); elseif (n <= 4.7e-28) tmp = Float64(Float64(Float64(log(i) - log(n)) * Float64(Float64(n * n) * 100.0)) / i); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[(N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision] * n), $MachinePrecision] * 100.0), $MachinePrecision]}, If[LessEqual[n, -8.2e-126], t$95$0, If[LessEqual[n, 1e-271], N[(0.0 / i), $MachinePrecision], If[LessEqual[n, 1.08e-72], N[(N[(N[(1.0 * i), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision] * 100.0), $MachinePrecision], If[LessEqual[n, 4.7e-28], N[(N[(N[(N[Log[i], $MachinePrecision] - N[Log[n], $MachinePrecision]), $MachinePrecision] * N[(N[(n * n), $MachinePrecision] * 100.0), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\frac{\mathsf{expm1}\left(i\right)}{i} \cdot n\right) \cdot 100\\
\mathbf{if}\;n \leq -8.2 \cdot 10^{-126}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 10^{-271}:\\
\;\;\;\;\frac{0}{i}\\
\mathbf{elif}\;n \leq 1.08 \cdot 10^{-72}:\\
\;\;\;\;\frac{1 \cdot i}{\frac{i}{n}} \cdot 100\\
\mathbf{elif}\;n \leq 4.7 \cdot 10^{-28}:\\
\;\;\;\;\frac{\left(\log i - \log n\right) \cdot \left(\left(n \cdot n\right) \cdot 100\right)}{i}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -8.1999999999999995e-126 or 4.6999999999999996e-28 < n Initial program 21.6%
Taylor expanded in n around inf
associate-/l*N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-expm1.f6491.9
Applied rewrites91.9%
Applied rewrites91.9%
if -8.1999999999999995e-126 < n < 9.99999999999999963e-272Initial program 65.5%
lift--.f64N/A
lift-pow.f64N/A
pow-to-expN/A
lower-expm1.f64N/A
lower-*.f64N/A
lift-+.f64N/A
lower-log1p.f6493.3
Applied rewrites93.3%
Applied rewrites31.1%
lift-fma.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/r/N/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f6430.9
lift-neg.f64N/A
lift-/.f64N/A
distribute-neg-fracN/A
Applied rewrites30.9%
Taylor expanded in i around 0
associate-*r/N/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
metadata-evalN/A
lower-/.f6471.8
Applied rewrites71.8%
if 9.99999999999999963e-272 < n < 1.07999999999999998e-72Initial program 13.0%
Taylor expanded in i around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites35.5%
Taylor expanded in i around 0
Applied rewrites74.0%
if 1.07999999999999998e-72 < n < 4.6999999999999996e-28Initial program 4.8%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
associate-*l*N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f644.8
Applied rewrites4.8%
Taylor expanded in n around 0
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.f6485.7
Applied rewrites85.7%
Final simplification87.0%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* (* (/ (expm1 i) i) n) 100.0)))
(if (<= n -8.2e-126)
t_0
(if (<= n 1e-271)
(/ 0.0 i)
(if (<= n 1.08e-72)
(* (/ (* 1.0 i) (/ i n)) 100.0)
(if (<= n 4.7e-28)
(* (/ (- (log i) (log n)) i) (* (* n n) 100.0))
t_0))))))
double code(double i, double n) {
double t_0 = ((expm1(i) / i) * n) * 100.0;
double tmp;
if (n <= -8.2e-126) {
tmp = t_0;
} else if (n <= 1e-271) {
tmp = 0.0 / i;
} else if (n <= 1.08e-72) {
tmp = ((1.0 * i) / (i / n)) * 100.0;
} else if (n <= 4.7e-28) {
tmp = ((log(i) - log(n)) / i) * ((n * n) * 100.0);
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = ((Math.expm1(i) / i) * n) * 100.0;
double tmp;
if (n <= -8.2e-126) {
tmp = t_0;
} else if (n <= 1e-271) {
tmp = 0.0 / i;
} else if (n <= 1.08e-72) {
tmp = ((1.0 * i) / (i / n)) * 100.0;
} else if (n <= 4.7e-28) {
tmp = ((Math.log(i) - Math.log(n)) / i) * ((n * n) * 100.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = ((math.expm1(i) / i) * n) * 100.0 tmp = 0 if n <= -8.2e-126: tmp = t_0 elif n <= 1e-271: tmp = 0.0 / i elif n <= 1.08e-72: tmp = ((1.0 * i) / (i / n)) * 100.0 elif n <= 4.7e-28: tmp = ((math.log(i) - math.log(n)) / i) * ((n * n) * 100.0) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(Float64(Float64(expm1(i) / i) * n) * 100.0) tmp = 0.0 if (n <= -8.2e-126) tmp = t_0; elseif (n <= 1e-271) tmp = Float64(0.0 / i); elseif (n <= 1.08e-72) tmp = Float64(Float64(Float64(1.0 * i) / Float64(i / n)) * 100.0); elseif (n <= 4.7e-28) tmp = Float64(Float64(Float64(log(i) - log(n)) / i) * Float64(Float64(n * n) * 100.0)); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[(N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision] * n), $MachinePrecision] * 100.0), $MachinePrecision]}, If[LessEqual[n, -8.2e-126], t$95$0, If[LessEqual[n, 1e-271], N[(0.0 / i), $MachinePrecision], If[LessEqual[n, 1.08e-72], N[(N[(N[(1.0 * i), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision] * 100.0), $MachinePrecision], If[LessEqual[n, 4.7e-28], N[(N[(N[(N[Log[i], $MachinePrecision] - N[Log[n], $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision] * N[(N[(n * n), $MachinePrecision] * 100.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\frac{\mathsf{expm1}\left(i\right)}{i} \cdot n\right) \cdot 100\\
\mathbf{if}\;n \leq -8.2 \cdot 10^{-126}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 10^{-271}:\\
\;\;\;\;\frac{0}{i}\\
\mathbf{elif}\;n \leq 1.08 \cdot 10^{-72}:\\
\;\;\;\;\frac{1 \cdot i}{\frac{i}{n}} \cdot 100\\
\mathbf{elif}\;n \leq 4.7 \cdot 10^{-28}:\\
\;\;\;\;\frac{\log i - \log n}{i} \cdot \left(\left(n \cdot n\right) \cdot 100\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -8.1999999999999995e-126 or 4.6999999999999996e-28 < n Initial program 21.6%
Taylor expanded in n around inf
associate-/l*N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-expm1.f6491.9
Applied rewrites91.9%
Applied rewrites91.9%
if -8.1999999999999995e-126 < n < 9.99999999999999963e-272Initial program 65.5%
lift--.f64N/A
lift-pow.f64N/A
pow-to-expN/A
lower-expm1.f64N/A
lower-*.f64N/A
lift-+.f64N/A
lower-log1p.f6493.3
Applied rewrites93.3%
Applied rewrites31.1%
lift-fma.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/r/N/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f6430.9
lift-neg.f64N/A
lift-/.f64N/A
distribute-neg-fracN/A
Applied rewrites30.9%
Taylor expanded in i around 0
associate-*r/N/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
metadata-evalN/A
lower-/.f6471.8
Applied rewrites71.8%
if 9.99999999999999963e-272 < n < 1.07999999999999998e-72Initial program 13.0%
Taylor expanded in i around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites35.5%
Taylor expanded in i around 0
Applied rewrites74.0%
if 1.07999999999999998e-72 < n < 4.6999999999999996e-28Initial program 4.8%
Taylor expanded in n around 0
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-log.f64N/A
lower-log.f6485.5
Applied rewrites85.5%
Final simplification87.0%
(FPCore (i n)
:precision binary64
(let* ((t_0 (/ (* (* 100.0 n) (expm1 (* (log1p (/ i n)) n))) i)))
(if (<= i -1.05e-52)
t_0
(if (<= i 1.85e-159)
(fma (* (* (- 0.5 (/ 0.5 n)) n) 100.0) i (* 100.0 n))
t_0))))
double code(double i, double n) {
double t_0 = ((100.0 * n) * expm1((log1p((i / n)) * n))) / i;
double tmp;
if (i <= -1.05e-52) {
tmp = t_0;
} else if (i <= 1.85e-159) {
tmp = fma((((0.5 - (0.5 / n)) * n) * 100.0), i, (100.0 * n));
} else {
tmp = t_0;
}
return tmp;
}
function code(i, n) t_0 = Float64(Float64(Float64(100.0 * n) * expm1(Float64(log1p(Float64(i / n)) * n))) / i) tmp = 0.0 if (i <= -1.05e-52) tmp = t_0; elseif (i <= 1.85e-159) tmp = fma(Float64(Float64(Float64(0.5 - Float64(0.5 / n)) * n) * 100.0), i, Float64(100.0 * n)); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[(N[(100.0 * n), $MachinePrecision] * N[(Exp[N[(N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision] * n), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]}, If[LessEqual[i, -1.05e-52], t$95$0, If[LessEqual[i, 1.85e-159], N[(N[(N[(N[(0.5 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] * n), $MachinePrecision] * 100.0), $MachinePrecision] * i + N[(100.0 * n), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\left(100 \cdot n\right) \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{i}{n}\right) \cdot n\right)}{i}\\
\mathbf{if}\;i \leq -1.05 \cdot 10^{-52}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;i \leq 1.85 \cdot 10^{-159}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(0.5 - \frac{0.5}{n}\right) \cdot n\right) \cdot 100, i, 100 \cdot n\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if i < -1.0499999999999999e-52 or 1.8499999999999999e-159 < i Initial program 38.0%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
associate-*l*N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6438.1
Applied rewrites38.1%
lift--.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
+-commutativeN/A
pow-to-expN/A
lift-log1p.f64N/A
lift-*.f64N/A
lift-expm1.f6488.9
Applied rewrites88.9%
if -1.0499999999999999e-52 < i < 1.8499999999999999e-159Initial program 6.8%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
associate-*l*N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f647.4
Applied rewrites7.4%
Taylor expanded in i around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites81.4%
Taylor expanded in i around 0
Applied rewrites91.6%
Final simplification89.9%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* (* (/ (expm1 i) i) n) 100.0)))
(if (<= n -8.2e-126)
t_0
(if (<= n 2.3e-211) (* (/ (- 1.0 1.0) (/ i n)) 100.0) t_0))))
double code(double i, double n) {
double t_0 = ((expm1(i) / i) * n) * 100.0;
double tmp;
if (n <= -8.2e-126) {
tmp = t_0;
} else if (n <= 2.3e-211) {
tmp = ((1.0 - 1.0) / (i / n)) * 100.0;
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = ((Math.expm1(i) / i) * n) * 100.0;
double tmp;
if (n <= -8.2e-126) {
tmp = t_0;
} else if (n <= 2.3e-211) {
tmp = ((1.0 - 1.0) / (i / n)) * 100.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = ((math.expm1(i) / i) * n) * 100.0 tmp = 0 if n <= -8.2e-126: tmp = t_0 elif n <= 2.3e-211: tmp = ((1.0 - 1.0) / (i / n)) * 100.0 else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(Float64(Float64(expm1(i) / i) * n) * 100.0) tmp = 0.0 if (n <= -8.2e-126) tmp = t_0; elseif (n <= 2.3e-211) tmp = Float64(Float64(Float64(1.0 - 1.0) / Float64(i / n)) * 100.0); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[(N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision] * n), $MachinePrecision] * 100.0), $MachinePrecision]}, If[LessEqual[n, -8.2e-126], t$95$0, If[LessEqual[n, 2.3e-211], N[(N[(N[(1.0 - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision] * 100.0), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\frac{\mathsf{expm1}\left(i\right)}{i} \cdot n\right) \cdot 100\\
\mathbf{if}\;n \leq -8.2 \cdot 10^{-126}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 2.3 \cdot 10^{-211}:\\
\;\;\;\;\frac{1 - 1}{\frac{i}{n}} \cdot 100\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -8.1999999999999995e-126 or 2.29999999999999988e-211 < n Initial program 19.8%
Taylor expanded in n around inf
associate-/l*N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-expm1.f6485.8
Applied rewrites85.8%
Applied rewrites85.9%
if -8.1999999999999995e-126 < n < 2.29999999999999988e-211Initial program 58.2%
Taylor expanded in i around 0
Applied rewrites71.3%
Final simplification83.7%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* (* (/ (expm1 i) i) 100.0) n)))
(if (<= n -8.2e-126)
t_0
(if (<= n 2.3e-211) (* (/ (- 1.0 1.0) (/ i n)) 100.0) t_0))))
double code(double i, double n) {
double t_0 = ((expm1(i) / i) * 100.0) * n;
double tmp;
if (n <= -8.2e-126) {
tmp = t_0;
} else if (n <= 2.3e-211) {
tmp = ((1.0 - 1.0) / (i / n)) * 100.0;
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = ((Math.expm1(i) / i) * 100.0) * n;
double tmp;
if (n <= -8.2e-126) {
tmp = t_0;
} else if (n <= 2.3e-211) {
tmp = ((1.0 - 1.0) / (i / n)) * 100.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = ((math.expm1(i) / i) * 100.0) * n tmp = 0 if n <= -8.2e-126: tmp = t_0 elif n <= 2.3e-211: tmp = ((1.0 - 1.0) / (i / n)) * 100.0 else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(Float64(Float64(expm1(i) / i) * 100.0) * n) tmp = 0.0 if (n <= -8.2e-126) tmp = t_0; elseif (n <= 2.3e-211) tmp = Float64(Float64(Float64(1.0 - 1.0) / Float64(i / n)) * 100.0); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[(N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision] * 100.0), $MachinePrecision] * n), $MachinePrecision]}, If[LessEqual[n, -8.2e-126], t$95$0, If[LessEqual[n, 2.3e-211], N[(N[(N[(1.0 - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision] * 100.0), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\frac{\mathsf{expm1}\left(i\right)}{i} \cdot 100\right) \cdot n\\
\mathbf{if}\;n \leq -8.2 \cdot 10^{-126}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 2.3 \cdot 10^{-211}:\\
\;\;\;\;\frac{1 - 1}{\frac{i}{n}} \cdot 100\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -8.1999999999999995e-126 or 2.29999999999999988e-211 < n Initial program 19.8%
Taylor expanded in n around inf
associate-/l*N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-expm1.f6485.8
Applied rewrites85.8%
if -8.1999999999999995e-126 < n < 2.29999999999999988e-211Initial program 58.2%
Taylor expanded in i around 0
Applied rewrites71.3%
Final simplification83.7%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* (* (/ 100.0 i) (expm1 i)) n)))
(if (<= n -8.2e-126)
t_0
(if (<= n 2.3e-211) (* (/ (- 1.0 1.0) (/ i n)) 100.0) t_0))))
double code(double i, double n) {
double t_0 = ((100.0 / i) * expm1(i)) * n;
double tmp;
if (n <= -8.2e-126) {
tmp = t_0;
} else if (n <= 2.3e-211) {
tmp = ((1.0 - 1.0) / (i / n)) * 100.0;
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = ((100.0 / i) * Math.expm1(i)) * n;
double tmp;
if (n <= -8.2e-126) {
tmp = t_0;
} else if (n <= 2.3e-211) {
tmp = ((1.0 - 1.0) / (i / n)) * 100.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = ((100.0 / i) * math.expm1(i)) * n tmp = 0 if n <= -8.2e-126: tmp = t_0 elif n <= 2.3e-211: tmp = ((1.0 - 1.0) / (i / n)) * 100.0 else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(Float64(Float64(100.0 / i) * expm1(i)) * n) tmp = 0.0 if (n <= -8.2e-126) tmp = t_0; elseif (n <= 2.3e-211) tmp = Float64(Float64(Float64(1.0 - 1.0) / Float64(i / n)) * 100.0); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[(N[(100.0 / i), $MachinePrecision] * N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] * n), $MachinePrecision]}, If[LessEqual[n, -8.2e-126], t$95$0, If[LessEqual[n, 2.3e-211], N[(N[(N[(1.0 - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision] * 100.0), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\frac{100}{i} \cdot \mathsf{expm1}\left(i\right)\right) \cdot n\\
\mathbf{if}\;n \leq -8.2 \cdot 10^{-126}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 2.3 \cdot 10^{-211}:\\
\;\;\;\;\frac{1 - 1}{\frac{i}{n}} \cdot 100\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -8.1999999999999995e-126 or 2.29999999999999988e-211 < n Initial program 19.8%
Taylor expanded in n around inf
associate-/l*N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-expm1.f6485.8
Applied rewrites85.8%
Applied rewrites85.8%
if -8.1999999999999995e-126 < n < 2.29999999999999988e-211Initial program 58.2%
Taylor expanded in i around 0
Applied rewrites71.3%
Final simplification83.6%
(FPCore (i n)
:precision binary64
(if (<= i -2.8)
(* (fma i (/ n (* i i)) (/ (- n) i)) 100.0)
(if (<= i 2.2e-195)
(fma
(fma (* (fma 4.166666666666667 i 16.666666666666668) n) i (* 50.0 n))
i
(* 100.0 n))
(/
(*
(*
(fma
(fma (fma 0.041666666666666664 i 0.16666666666666666) i 0.5)
i
1.0)
i)
(* 100.0 n))
i))))
double code(double i, double n) {
double tmp;
if (i <= -2.8) {
tmp = fma(i, (n / (i * i)), (-n / i)) * 100.0;
} else if (i <= 2.2e-195) {
tmp = fma(fma((fma(4.166666666666667, i, 16.666666666666668) * n), i, (50.0 * n)), i, (100.0 * n));
} else {
tmp = ((fma(fma(fma(0.041666666666666664, i, 0.16666666666666666), i, 0.5), i, 1.0) * i) * (100.0 * n)) / i;
}
return tmp;
}
function code(i, n) tmp = 0.0 if (i <= -2.8) tmp = Float64(fma(i, Float64(n / Float64(i * i)), Float64(Float64(-n) / i)) * 100.0); elseif (i <= 2.2e-195) tmp = fma(fma(Float64(fma(4.166666666666667, i, 16.666666666666668) * n), i, Float64(50.0 * n)), i, Float64(100.0 * n)); else tmp = Float64(Float64(Float64(fma(fma(fma(0.041666666666666664, i, 0.16666666666666666), i, 0.5), i, 1.0) * i) * Float64(100.0 * n)) / i); end return tmp end
code[i_, n_] := If[LessEqual[i, -2.8], N[(N[(i * N[(n / N[(i * i), $MachinePrecision]), $MachinePrecision] + N[((-n) / i), $MachinePrecision]), $MachinePrecision] * 100.0), $MachinePrecision], If[LessEqual[i, 2.2e-195], N[(N[(N[(N[(4.166666666666667 * i + 16.666666666666668), $MachinePrecision] * n), $MachinePrecision] * i + N[(50.0 * n), $MachinePrecision]), $MachinePrecision] * i + N[(100.0 * n), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(N[(0.041666666666666664 * i + 0.16666666666666666), $MachinePrecision] * i + 0.5), $MachinePrecision] * i + 1.0), $MachinePrecision] * i), $MachinePrecision] * N[(100.0 * n), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -2.8:\\
\;\;\;\;\mathsf{fma}\left(i, \frac{n}{i \cdot i}, \frac{-n}{i}\right) \cdot 100\\
\mathbf{elif}\;i \leq 2.2 \cdot 10^{-195}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(4.166666666666667, i, 16.666666666666668\right) \cdot n, i, 50 \cdot n\right), i, 100 \cdot n\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664, i, 0.16666666666666666\right), i, 0.5\right), i, 1\right) \cdot i\right) \cdot \left(100 \cdot n\right)}{i}\\
\end{array}
\end{array}
if i < -2.7999999999999998Initial program 63.9%
lift--.f64N/A
lift-pow.f64N/A
pow-to-expN/A
lower-expm1.f64N/A
lower-*.f64N/A
lift-+.f64N/A
lower-log1p.f6497.3
Applied rewrites97.3%
Applied rewrites58.5%
Taylor expanded in i around 0
lower-/.f64N/A
unpow2N/A
lower-*.f6452.8
Applied rewrites52.8%
if -2.7999999999999998 < i < 2.20000000000000005e-195Initial program 8.4%
Taylor expanded in n around inf
associate-/l*N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-expm1.f6487.4
Applied rewrites87.4%
Taylor expanded in i around 0
Applied rewrites86.9%
if 2.20000000000000005e-195 < i Initial program 25.0%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
associate-*l*N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6425.2
Applied rewrites25.2%
Taylor expanded in n around inf
lower-expm1.f6469.4
Applied rewrites69.4%
Taylor expanded in i around 0
Applied rewrites67.7%
Final simplification73.0%
(FPCore (i n)
:precision binary64
(if (<= i -2.8)
(* (fma i (/ n (* i i)) (/ (- n) i)) 100.0)
(fma
(fma (* (fma 4.166666666666667 i 16.666666666666668) n) i (* 50.0 n))
i
(* 100.0 n))))
double code(double i, double n) {
double tmp;
if (i <= -2.8) {
tmp = fma(i, (n / (i * i)), (-n / i)) * 100.0;
} else {
tmp = fma(fma((fma(4.166666666666667, i, 16.666666666666668) * n), i, (50.0 * n)), i, (100.0 * n));
}
return tmp;
}
function code(i, n) tmp = 0.0 if (i <= -2.8) tmp = Float64(fma(i, Float64(n / Float64(i * i)), Float64(Float64(-n) / i)) * 100.0); else tmp = fma(fma(Float64(fma(4.166666666666667, i, 16.666666666666668) * n), i, Float64(50.0 * n)), i, Float64(100.0 * n)); end return tmp end
code[i_, n_] := If[LessEqual[i, -2.8], N[(N[(i * N[(n / N[(i * i), $MachinePrecision]), $MachinePrecision] + N[((-n) / i), $MachinePrecision]), $MachinePrecision] * 100.0), $MachinePrecision], N[(N[(N[(N[(4.166666666666667 * i + 16.666666666666668), $MachinePrecision] * n), $MachinePrecision] * i + N[(50.0 * n), $MachinePrecision]), $MachinePrecision] * i + N[(100.0 * n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -2.8:\\
\;\;\;\;\mathsf{fma}\left(i, \frac{n}{i \cdot i}, \frac{-n}{i}\right) \cdot 100\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(4.166666666666667, i, 16.666666666666668\right) \cdot n, i, 50 \cdot n\right), i, 100 \cdot n\right)\\
\end{array}
\end{array}
if i < -2.7999999999999998Initial program 63.9%
lift--.f64N/A
lift-pow.f64N/A
pow-to-expN/A
lower-expm1.f64N/A
lower-*.f64N/A
lift-+.f64N/A
lower-log1p.f6497.3
Applied rewrites97.3%
Applied rewrites58.5%
Taylor expanded in i around 0
lower-/.f64N/A
unpow2N/A
lower-*.f6452.8
Applied rewrites52.8%
if -2.7999999999999998 < i Initial program 16.2%
Taylor expanded in n around inf
associate-/l*N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-expm1.f6478.1
Applied rewrites78.1%
Taylor expanded in i around 0
Applied rewrites75.7%
Final simplification71.2%
(FPCore (i n)
:precision binary64
(if (<= n -2.95e-120)
(*
(*
(fma (fma (fma 0.041666666666666664 i 0.16666666666666666) i 0.5) i 1.0)
n)
100.0)
(if (<= n 2.3e-211)
(* (/ (- 1.0 1.0) (/ i n)) 100.0)
(*
(fma (fma (fma 4.166666666666667 i 16.666666666666668) i 50.0) i 100.0)
n))))
double code(double i, double n) {
double tmp;
if (n <= -2.95e-120) {
tmp = (fma(fma(fma(0.041666666666666664, i, 0.16666666666666666), i, 0.5), i, 1.0) * n) * 100.0;
} else if (n <= 2.3e-211) {
tmp = ((1.0 - 1.0) / (i / n)) * 100.0;
} else {
tmp = fma(fma(fma(4.166666666666667, i, 16.666666666666668), i, 50.0), i, 100.0) * n;
}
return tmp;
}
function code(i, n) tmp = 0.0 if (n <= -2.95e-120) tmp = Float64(Float64(fma(fma(fma(0.041666666666666664, i, 0.16666666666666666), i, 0.5), i, 1.0) * n) * 100.0); elseif (n <= 2.3e-211) tmp = Float64(Float64(Float64(1.0 - 1.0) / Float64(i / n)) * 100.0); else tmp = Float64(fma(fma(fma(4.166666666666667, i, 16.666666666666668), i, 50.0), i, 100.0) * n); end return tmp end
code[i_, n_] := If[LessEqual[n, -2.95e-120], N[(N[(N[(N[(N[(0.041666666666666664 * i + 0.16666666666666666), $MachinePrecision] * i + 0.5), $MachinePrecision] * i + 1.0), $MachinePrecision] * n), $MachinePrecision] * 100.0), $MachinePrecision], If[LessEqual[n, 2.3e-211], N[(N[(N[(1.0 - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision] * 100.0), $MachinePrecision], N[(N[(N[(N[(4.166666666666667 * i + 16.666666666666668), $MachinePrecision] * i + 50.0), $MachinePrecision] * i + 100.0), $MachinePrecision] * n), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.95 \cdot 10^{-120}:\\
\;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664, i, 0.16666666666666666\right), i, 0.5\right), i, 1\right) \cdot n\right) \cdot 100\\
\mathbf{elif}\;n \leq 2.3 \cdot 10^{-211}:\\
\;\;\;\;\frac{1 - 1}{\frac{i}{n}} \cdot 100\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(4.166666666666667, i, 16.666666666666668\right), i, 50\right), i, 100\right) \cdot n\\
\end{array}
\end{array}
if n < -2.94999999999999989e-120Initial program 23.3%
Taylor expanded in n around inf
associate-/l*N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-expm1.f6489.4
Applied rewrites89.4%
Applied rewrites89.4%
Taylor expanded in i around 0
Applied rewrites68.6%
if -2.94999999999999989e-120 < n < 2.29999999999999988e-211Initial program 58.2%
Taylor expanded in i around 0
Applied rewrites71.3%
if 2.29999999999999988e-211 < n Initial program 16.1%
Taylor expanded in n around inf
associate-/l*N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-expm1.f6482.0
Applied rewrites82.0%
Taylor expanded in i around 0
Applied rewrites70.3%
Final simplification69.7%
(FPCore (i n)
:precision binary64
(if (<= n -2.95e-120)
(*
(*
(fma (fma (fma 0.041666666666666664 i 0.16666666666666666) i 0.5) i 1.0)
n)
100.0)
(if (<= n 2.3e-211)
(/ 0.0 i)
(*
(fma (fma (fma 4.166666666666667 i 16.666666666666668) i 50.0) i 100.0)
n))))
double code(double i, double n) {
double tmp;
if (n <= -2.95e-120) {
tmp = (fma(fma(fma(0.041666666666666664, i, 0.16666666666666666), i, 0.5), i, 1.0) * n) * 100.0;
} else if (n <= 2.3e-211) {
tmp = 0.0 / i;
} else {
tmp = fma(fma(fma(4.166666666666667, i, 16.666666666666668), i, 50.0), i, 100.0) * n;
}
return tmp;
}
function code(i, n) tmp = 0.0 if (n <= -2.95e-120) tmp = Float64(Float64(fma(fma(fma(0.041666666666666664, i, 0.16666666666666666), i, 0.5), i, 1.0) * n) * 100.0); elseif (n <= 2.3e-211) tmp = Float64(0.0 / i); else tmp = Float64(fma(fma(fma(4.166666666666667, i, 16.666666666666668), i, 50.0), i, 100.0) * n); end return tmp end
code[i_, n_] := If[LessEqual[n, -2.95e-120], N[(N[(N[(N[(N[(0.041666666666666664 * i + 0.16666666666666666), $MachinePrecision] * i + 0.5), $MachinePrecision] * i + 1.0), $MachinePrecision] * n), $MachinePrecision] * 100.0), $MachinePrecision], If[LessEqual[n, 2.3e-211], N[(0.0 / i), $MachinePrecision], N[(N[(N[(N[(4.166666666666667 * i + 16.666666666666668), $MachinePrecision] * i + 50.0), $MachinePrecision] * i + 100.0), $MachinePrecision] * n), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.95 \cdot 10^{-120}:\\
\;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664, i, 0.16666666666666666\right), i, 0.5\right), i, 1\right) \cdot n\right) \cdot 100\\
\mathbf{elif}\;n \leq 2.3 \cdot 10^{-211}:\\
\;\;\;\;\frac{0}{i}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(4.166666666666667, i, 16.666666666666668\right), i, 50\right), i, 100\right) \cdot n\\
\end{array}
\end{array}
if n < -2.94999999999999989e-120Initial program 23.3%
Taylor expanded in n around inf
associate-/l*N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-expm1.f6489.4
Applied rewrites89.4%
Applied rewrites89.4%
Taylor expanded in i around 0
Applied rewrites68.6%
if -2.94999999999999989e-120 < n < 2.29999999999999988e-211Initial program 58.2%
lift--.f64N/A
lift-pow.f64N/A
pow-to-expN/A
lower-expm1.f64N/A
lower-*.f64N/A
lift-+.f64N/A
lower-log1p.f6486.5
Applied rewrites86.5%
Applied rewrites26.5%
lift-fma.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/r/N/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f6426.3
lift-neg.f64N/A
lift-/.f64N/A
distribute-neg-fracN/A
Applied rewrites26.3%
Taylor expanded in i around 0
associate-*r/N/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
metadata-evalN/A
lower-/.f6471.3
Applied rewrites71.3%
if 2.29999999999999988e-211 < n Initial program 16.1%
Taylor expanded in n around inf
associate-/l*N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-expm1.f6482.0
Applied rewrites82.0%
Taylor expanded in i around 0
Applied rewrites70.3%
(FPCore (i n)
:precision binary64
(let* ((t_0
(*
(fma
(fma (fma 4.166666666666667 i 16.666666666666668) i 50.0)
i
100.0)
n)))
(if (<= n -2.95e-120) t_0 (if (<= n 2.3e-211) (/ 0.0 i) t_0))))
double code(double i, double n) {
double t_0 = fma(fma(fma(4.166666666666667, i, 16.666666666666668), i, 50.0), i, 100.0) * n;
double tmp;
if (n <= -2.95e-120) {
tmp = t_0;
} else if (n <= 2.3e-211) {
tmp = 0.0 / i;
} else {
tmp = t_0;
}
return tmp;
}
function code(i, n) t_0 = Float64(fma(fma(fma(4.166666666666667, i, 16.666666666666668), i, 50.0), i, 100.0) * n) tmp = 0.0 if (n <= -2.95e-120) tmp = t_0; elseif (n <= 2.3e-211) tmp = Float64(0.0 / i); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[(N[(N[(4.166666666666667 * i + 16.666666666666668), $MachinePrecision] * i + 50.0), $MachinePrecision] * i + 100.0), $MachinePrecision] * n), $MachinePrecision]}, If[LessEqual[n, -2.95e-120], t$95$0, If[LessEqual[n, 2.3e-211], N[(0.0 / i), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(4.166666666666667, i, 16.666666666666668\right), i, 50\right), i, 100\right) \cdot n\\
\mathbf{if}\;n \leq -2.95 \cdot 10^{-120}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 2.3 \cdot 10^{-211}:\\
\;\;\;\;\frac{0}{i}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -2.94999999999999989e-120 or 2.29999999999999988e-211 < n Initial program 19.8%
Taylor expanded in n around inf
associate-/l*N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-expm1.f6485.8
Applied rewrites85.8%
Taylor expanded in i around 0
Applied rewrites69.4%
if -2.94999999999999989e-120 < n < 2.29999999999999988e-211Initial program 58.2%
lift--.f64N/A
lift-pow.f64N/A
pow-to-expN/A
lower-expm1.f64N/A
lower-*.f64N/A
lift-+.f64N/A
lower-log1p.f6486.5
Applied rewrites86.5%
Applied rewrites26.5%
lift-fma.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/r/N/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f6426.3
lift-neg.f64N/A
lift-/.f64N/A
distribute-neg-fracN/A
Applied rewrites26.3%
Taylor expanded in i around 0
associate-*r/N/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
metadata-evalN/A
lower-/.f6471.3
Applied rewrites71.3%
(FPCore (i n)
:precision binary64
(if (<= n -2.95e-120)
(* (* (fma (fma 0.16666666666666666 i 0.5) i 1.0) 100.0) n)
(if (<= n 2.3e-211)
(/ 0.0 i)
(* (fma (fma 16.666666666666668 i 50.0) i 100.0) n))))
double code(double i, double n) {
double tmp;
if (n <= -2.95e-120) {
tmp = (fma(fma(0.16666666666666666, i, 0.5), i, 1.0) * 100.0) * n;
} else if (n <= 2.3e-211) {
tmp = 0.0 / i;
} else {
tmp = fma(fma(16.666666666666668, i, 50.0), i, 100.0) * n;
}
return tmp;
}
function code(i, n) tmp = 0.0 if (n <= -2.95e-120) tmp = Float64(Float64(fma(fma(0.16666666666666666, i, 0.5), i, 1.0) * 100.0) * n); elseif (n <= 2.3e-211) tmp = Float64(0.0 / i); else tmp = Float64(fma(fma(16.666666666666668, i, 50.0), i, 100.0) * n); end return tmp end
code[i_, n_] := If[LessEqual[n, -2.95e-120], N[(N[(N[(N[(0.16666666666666666 * i + 0.5), $MachinePrecision] * i + 1.0), $MachinePrecision] * 100.0), $MachinePrecision] * n), $MachinePrecision], If[LessEqual[n, 2.3e-211], N[(0.0 / i), $MachinePrecision], N[(N[(N[(16.666666666666668 * i + 50.0), $MachinePrecision] * i + 100.0), $MachinePrecision] * n), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.95 \cdot 10^{-120}:\\
\;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, i, 0.5\right), i, 1\right) \cdot 100\right) \cdot n\\
\mathbf{elif}\;n \leq 2.3 \cdot 10^{-211}:\\
\;\;\;\;\frac{0}{i}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(16.666666666666668, i, 50\right), i, 100\right) \cdot n\\
\end{array}
\end{array}
if n < -2.94999999999999989e-120Initial program 23.3%
Taylor expanded in n around inf
associate-/l*N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-expm1.f6489.4
Applied rewrites89.4%
Taylor expanded in i around 0
Applied rewrites67.4%
if -2.94999999999999989e-120 < n < 2.29999999999999988e-211Initial program 58.2%
lift--.f64N/A
lift-pow.f64N/A
pow-to-expN/A
lower-expm1.f64N/A
lower-*.f64N/A
lift-+.f64N/A
lower-log1p.f6486.5
Applied rewrites86.5%
Applied rewrites26.5%
lift-fma.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/r/N/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f6426.3
lift-neg.f64N/A
lift-/.f64N/A
distribute-neg-fracN/A
Applied rewrites26.3%
Taylor expanded in i around 0
associate-*r/N/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
metadata-evalN/A
lower-/.f6471.3
Applied rewrites71.3%
if 2.29999999999999988e-211 < n Initial program 16.1%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
associate-*l*N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6416.4
Applied rewrites16.4%
Taylor expanded in i around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites64.0%
Taylor expanded in n around inf
Applied rewrites68.5%
(FPCore (i n) :precision binary64 (let* ((t_0 (* (fma (fma 16.666666666666668 i 50.0) i 100.0) n))) (if (<= n -2.95e-120) t_0 (if (<= n 2.3e-211) (/ 0.0 i) t_0))))
double code(double i, double n) {
double t_0 = fma(fma(16.666666666666668, i, 50.0), i, 100.0) * n;
double tmp;
if (n <= -2.95e-120) {
tmp = t_0;
} else if (n <= 2.3e-211) {
tmp = 0.0 / i;
} else {
tmp = t_0;
}
return tmp;
}
function code(i, n) t_0 = Float64(fma(fma(16.666666666666668, i, 50.0), i, 100.0) * n) tmp = 0.0 if (n <= -2.95e-120) tmp = t_0; elseif (n <= 2.3e-211) tmp = Float64(0.0 / i); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[(N[(16.666666666666668 * i + 50.0), $MachinePrecision] * i + 100.0), $MachinePrecision] * n), $MachinePrecision]}, If[LessEqual[n, -2.95e-120], t$95$0, If[LessEqual[n, 2.3e-211], N[(0.0 / i), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\mathsf{fma}\left(16.666666666666668, i, 50\right), i, 100\right) \cdot n\\
\mathbf{if}\;n \leq -2.95 \cdot 10^{-120}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 2.3 \cdot 10^{-211}:\\
\;\;\;\;\frac{0}{i}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -2.94999999999999989e-120 or 2.29999999999999988e-211 < n Initial program 19.8%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
associate-*l*N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6420.2
Applied rewrites20.2%
Taylor expanded in i around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites65.9%
Taylor expanded in n around inf
Applied rewrites67.9%
if -2.94999999999999989e-120 < n < 2.29999999999999988e-211Initial program 58.2%
lift--.f64N/A
lift-pow.f64N/A
pow-to-expN/A
lower-expm1.f64N/A
lower-*.f64N/A
lift-+.f64N/A
lower-log1p.f6486.5
Applied rewrites86.5%
Applied rewrites26.5%
lift-fma.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/r/N/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f6426.3
lift-neg.f64N/A
lift-/.f64N/A
distribute-neg-fracN/A
Applied rewrites26.3%
Taylor expanded in i around 0
associate-*r/N/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
metadata-evalN/A
lower-/.f6471.3
Applied rewrites71.3%
(FPCore (i n) :precision binary64 (let* ((t_0 (* (fma 50.0 i 100.0) n))) (if (<= n -2.95e-120) t_0 (if (<= n 2.3e-211) (/ 0.0 i) t_0))))
double code(double i, double n) {
double t_0 = fma(50.0, i, 100.0) * n;
double tmp;
if (n <= -2.95e-120) {
tmp = t_0;
} else if (n <= 2.3e-211) {
tmp = 0.0 / i;
} else {
tmp = t_0;
}
return tmp;
}
function code(i, n) t_0 = Float64(fma(50.0, i, 100.0) * n) tmp = 0.0 if (n <= -2.95e-120) tmp = t_0; elseif (n <= 2.3e-211) tmp = Float64(0.0 / i); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[(50.0 * i + 100.0), $MachinePrecision] * n), $MachinePrecision]}, If[LessEqual[n, -2.95e-120], t$95$0, If[LessEqual[n, 2.3e-211], N[(0.0 / i), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(50, i, 100\right) \cdot n\\
\mathbf{if}\;n \leq -2.95 \cdot 10^{-120}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 2.3 \cdot 10^{-211}:\\
\;\;\;\;\frac{0}{i}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -2.94999999999999989e-120 or 2.29999999999999988e-211 < n Initial program 19.8%
Taylor expanded in n around inf
associate-/l*N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-expm1.f6485.8
Applied rewrites85.8%
Taylor expanded in i around 0
Applied rewrites65.5%
if -2.94999999999999989e-120 < n < 2.29999999999999988e-211Initial program 58.2%
lift--.f64N/A
lift-pow.f64N/A
pow-to-expN/A
lower-expm1.f64N/A
lower-*.f64N/A
lift-+.f64N/A
lower-log1p.f6486.5
Applied rewrites86.5%
Applied rewrites26.5%
lift-fma.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/r/N/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f6426.3
lift-neg.f64N/A
lift-/.f64N/A
distribute-neg-fracN/A
Applied rewrites26.3%
Taylor expanded in i around 0
associate-*r/N/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
metadata-evalN/A
lower-/.f6471.3
Applied rewrites71.3%
(FPCore (i n) :precision binary64 (if (<= i -2e+84) (/ 0.0 i) (if (<= i 5e+45) (* 100.0 n) (* (* 50.0 i) n))))
double code(double i, double n) {
double tmp;
if (i <= -2e+84) {
tmp = 0.0 / i;
} else if (i <= 5e+45) {
tmp = 100.0 * n;
} 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 <= (-2d+84)) then
tmp = 0.0d0 / i
else if (i <= 5d+45) then
tmp = 100.0d0 * n
else
tmp = (50.0d0 * i) * n
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= -2e+84) {
tmp = 0.0 / i;
} else if (i <= 5e+45) {
tmp = 100.0 * n;
} else {
tmp = (50.0 * i) * n;
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -2e+84: tmp = 0.0 / i elif i <= 5e+45: tmp = 100.0 * n else: tmp = (50.0 * i) * n return tmp
function code(i, n) tmp = 0.0 if (i <= -2e+84) tmp = Float64(0.0 / i); elseif (i <= 5e+45) tmp = Float64(100.0 * n); else tmp = Float64(Float64(50.0 * i) * n); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -2e+84) tmp = 0.0 / i; elseif (i <= 5e+45) tmp = 100.0 * n; else tmp = (50.0 * i) * n; end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -2e+84], N[(0.0 / i), $MachinePrecision], If[LessEqual[i, 5e+45], N[(100.0 * n), $MachinePrecision], N[(N[(50.0 * i), $MachinePrecision] * n), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -2 \cdot 10^{+84}:\\
\;\;\;\;\frac{0}{i}\\
\mathbf{elif}\;i \leq 5 \cdot 10^{+45}:\\
\;\;\;\;100 \cdot n\\
\mathbf{else}:\\
\;\;\;\;\left(50 \cdot i\right) \cdot n\\
\end{array}
\end{array}
if i < -2.00000000000000012e84Initial program 75.6%
lift--.f64N/A
lift-pow.f64N/A
pow-to-expN/A
lower-expm1.f64N/A
lower-*.f64N/A
lift-+.f64N/A
lower-log1p.f6496.7
Applied rewrites96.7%
Applied rewrites67.8%
lift-fma.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/r/N/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f6475.1
lift-neg.f64N/A
lift-/.f64N/A
distribute-neg-fracN/A
Applied rewrites75.1%
Taylor expanded in i around 0
associate-*r/N/A
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lftN/A
metadata-evalN/A
lower-/.f6442.7
Applied rewrites42.7%
if -2.00000000000000012e84 < i < 5e45Initial program 10.6%
Taylor expanded in i around 0
lower-*.f6474.8
Applied rewrites74.8%
if 5e45 < i Initial program 43.5%
Taylor expanded in n around inf
associate-/l*N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-expm1.f6454.3
Applied rewrites54.3%
Taylor expanded in i around 0
Applied rewrites34.5%
Taylor expanded in i around inf
Applied rewrites34.5%
(FPCore (i n) :precision binary64 (if (<= i 5e+45) (* 100.0 n) (* (* 50.0 i) n)))
double code(double i, double n) {
double tmp;
if (i <= 5e+45) {
tmp = 100.0 * n;
} 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+45) then
tmp = 100.0d0 * n
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+45) {
tmp = 100.0 * n;
} else {
tmp = (50.0 * i) * n;
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 5e+45: tmp = 100.0 * n else: tmp = (50.0 * i) * n return tmp
function code(i, n) tmp = 0.0 if (i <= 5e+45) tmp = Float64(100.0 * n); else tmp = Float64(Float64(50.0 * i) * n); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= 5e+45) tmp = 100.0 * n; else tmp = (50.0 * i) * n; end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, 5e+45], N[(100.0 * n), $MachinePrecision], N[(N[(50.0 * i), $MachinePrecision] * n), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 5 \cdot 10^{+45}:\\
\;\;\;\;100 \cdot n\\
\mathbf{else}:\\
\;\;\;\;\left(50 \cdot i\right) \cdot n\\
\end{array}
\end{array}
if i < 5e45Initial program 22.1%
Taylor expanded in i around 0
lower-*.f6462.4
Applied rewrites62.4%
if 5e45 < i Initial program 43.5%
Taylor expanded in n around inf
associate-/l*N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-expm1.f6454.3
Applied rewrites54.3%
Taylor expanded in i around 0
Applied rewrites34.5%
Taylor expanded in i around inf
Applied rewrites34.5%
(FPCore (i n) :precision binary64 (* 100.0 n))
double code(double i, double n) {
return 100.0 * n;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 100.0d0 * n
end function
public static double code(double i, double n) {
return 100.0 * n;
}
def code(i, n): return 100.0 * n
function code(i, n) return Float64(100.0 * n) end
function tmp = code(i, n) tmp = 100.0 * n; end
code[i_, n_] := N[(100.0 * n), $MachinePrecision]
\begin{array}{l}
\\
100 \cdot n
\end{array}
Initial program 25.5%
Taylor expanded in i around 0
lower-*.f6453.2
Applied rewrites53.2%
(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 2024235
(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))))