
(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 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (i n) :precision binary64 (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))
double code(double i, double n) {
return 100.0 * ((pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 100.0d0 * ((((1.0d0 + (i / n)) ** n) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
return 100.0 * ((Math.pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
def code(i, n): return 100.0 * ((math.pow((1.0 + (i / n)), n) - 1.0) / (i / n))
function code(i, n) return Float64(100.0 * Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) - 1.0) / Float64(i / n))) end
function tmp = code(i, n) tmp = 100.0 * ((((1.0 + (i / n)) ^ n) - 1.0) / (i / n)); end
code[i_, n_] := N[(100.0 * N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}
\end{array}
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 0.0)
(/ (* (expm1 (* n (log1p (/ i n)))) 100.0) (/ i n))
(if (<= t_1 INFINITY) (/ (* n (fma 100.0 t_0 -100.0)) 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 <= 0.0) {
tmp = (expm1((n * log1p((i / n)))) * 100.0) / (i / n);
} else if (t_1 <= ((double) INFINITY)) {
tmp = (n * fma(100.0, t_0, -100.0)) / 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 <= 0.0) tmp = Float64(Float64(expm1(Float64(n * log1p(Float64(i / n)))) * 100.0) / Float64(i / n)); elseif (t_1 <= Inf) tmp = Float64(Float64(n * fma(100.0, t_0, -100.0)) / 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, 0.0], N[(N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] * 100.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(n * N[(100.0 * t$95$0 + -100.0), $MachinePrecision]), $MachinePrecision] / i), $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 0:\\
\;\;\;\;\frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot 100}{\frac{i}{n}}\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;\frac{n \cdot \mathsf{fma}\left(100, t_0, -100\right)}{i}\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 0.0Initial program 25.3%
associate-*r/25.3%
sub-neg25.3%
distribute-lft-in25.3%
fma-def25.3%
metadata-eval25.3%
metadata-eval25.3%
Simplified25.3%
fma-udef25.3%
metadata-eval25.3%
metadata-eval25.3%
distribute-lft-in25.3%
sub-neg25.3%
*-commutative25.3%
pow-to-exp24.2%
expm1-def36.4%
*-commutative36.4%
log1p-udef98.6%
Applied egg-rr98.6%
if 0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 98.2%
associate-*r/98.4%
sub-neg98.4%
distribute-lft-in98.4%
metadata-eval98.4%
metadata-eval98.4%
fma-udef98.4%
associate-/r/98.6%
associate-*l/98.6%
*-commutative98.6%
Applied egg-rr98.6%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
Taylor expanded in i around 0 76.5%
*-commutative76.5%
Simplified76.5%
Final simplification94.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 0.0)
(/ (* (expm1 (* n (log1p (/ i n)))) 100.0) (/ i n))
(if (<= t_1 INFINITY) (* n (/ (fma 100.0 t_0 -100.0) 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 <= 0.0) {
tmp = (expm1((n * log1p((i / n)))) * 100.0) / (i / n);
} else if (t_1 <= ((double) INFINITY)) {
tmp = n * (fma(100.0, t_0, -100.0) / 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 <= 0.0) tmp = Float64(Float64(expm1(Float64(n * log1p(Float64(i / n)))) * 100.0) / Float64(i / n)); elseif (t_1 <= Inf) tmp = Float64(n * Float64(fma(100.0, t_0, -100.0) / 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, 0.0], N[(N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] * 100.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(n * N[(N[(100.0 * t$95$0 + -100.0), $MachinePrecision] / 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 := \frac{t_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t_1 \leq 0:\\
\;\;\;\;\frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot 100}{\frac{i}{n}}\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;n \cdot \frac{\mathsf{fma}\left(100, t_0, -100\right)}{i}\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 0.0Initial program 25.3%
associate-*r/25.3%
sub-neg25.3%
distribute-lft-in25.3%
fma-def25.3%
metadata-eval25.3%
metadata-eval25.3%
Simplified25.3%
fma-udef25.3%
metadata-eval25.3%
metadata-eval25.3%
distribute-lft-in25.3%
sub-neg25.3%
*-commutative25.3%
pow-to-exp24.2%
expm1-def36.4%
*-commutative36.4%
log1p-udef98.6%
Applied egg-rr98.6%
if 0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 98.2%
associate-/r/98.1%
associate-*r*98.3%
*-commutative98.3%
associate-*r/98.6%
sub-neg98.6%
distribute-lft-in98.5%
fma-def98.6%
metadata-eval98.6%
metadata-eval98.6%
Simplified98.6%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
Taylor expanded in i around 0 76.5%
*-commutative76.5%
Simplified76.5%
Final simplification94.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 0.0)
(* n (* 100.0 (/ (expm1 (* n (log1p (/ i n)))) i)))
(if (<= t_1 INFINITY) (* n (/ (+ -100.0 (* t_0 100.0)) 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 <= 0.0) {
tmp = n * (100.0 * (expm1((n * log1p((i / n)))) / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = n * ((-100.0 + (t_0 * 100.0)) / i);
} else {
tmp = n * 100.0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 0.0) {
tmp = n * (100.0 * (Math.expm1((n * Math.log1p((i / n)))) / i));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = n * ((-100.0 + (t_0 * 100.0)) / i);
} else {
tmp = n * 100.0;
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = (t_0 + -1.0) / (i / n) tmp = 0 if t_1 <= 0.0: tmp = n * (100.0 * (math.expm1((n * math.log1p((i / n)))) / i)) elif t_1 <= math.inf: tmp = n * ((-100.0 + (t_0 * 100.0)) / 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 <= 0.0) tmp = Float64(n * Float64(100.0 * Float64(expm1(Float64(n * log1p(Float64(i / n)))) / i))); elseif (t_1 <= Inf) tmp = Float64(n * Float64(Float64(-100.0 + Float64(t_0 * 100.0)) / 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, 0.0], N[(n * N[(100.0 * N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(n * N[(N[(-100.0 + N[(t$95$0 * 100.0), $MachinePrecision]), $MachinePrecision] / 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 := \frac{t_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t_1 \leq 0:\\
\;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{i}\right)\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;n \cdot \frac{-100 + t_0 \cdot 100}{i}\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 0.0Initial program 25.3%
associate-*r/25.3%
sub-neg25.3%
distribute-lft-in25.3%
fma-def25.3%
metadata-eval25.3%
metadata-eval25.3%
Simplified25.3%
fma-udef25.3%
metadata-eval25.3%
metadata-eval25.3%
distribute-lft-in25.3%
sub-neg25.3%
associate-*r/25.3%
associate-/r/25.3%
associate-*r*25.3%
pow-to-exp24.3%
expm1-def36.5%
*-commutative36.5%
log1p-udef97.8%
Applied egg-rr97.8%
if 0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 98.2%
associate-/r/98.1%
associate-*r*98.3%
*-commutative98.3%
associate-*r/98.6%
sub-neg98.6%
distribute-lft-in98.5%
fma-def98.6%
metadata-eval98.6%
metadata-eval98.6%
Simplified98.6%
fma-udef98.4%
*-commutative98.4%
Applied egg-rr98.5%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
Taylor expanded in i around 0 76.5%
*-commutative76.5%
Simplified76.5%
Final simplification93.9%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 0.0)
(/ (* (expm1 (* n (log1p (/ i n)))) 100.0) (/ i n))
(if (<= t_1 INFINITY) (* n (/ (+ -100.0 (* t_0 100.0)) 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 <= 0.0) {
tmp = (expm1((n * log1p((i / n)))) * 100.0) / (i / n);
} else if (t_1 <= ((double) INFINITY)) {
tmp = n * ((-100.0 + (t_0 * 100.0)) / i);
} else {
tmp = n * 100.0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 0.0) {
tmp = (Math.expm1((n * Math.log1p((i / n)))) * 100.0) / (i / n);
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = n * ((-100.0 + (t_0 * 100.0)) / i);
} else {
tmp = n * 100.0;
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = (t_0 + -1.0) / (i / n) tmp = 0 if t_1 <= 0.0: tmp = (math.expm1((n * math.log1p((i / n)))) * 100.0) / (i / n) elif t_1 <= math.inf: tmp = n * ((-100.0 + (t_0 * 100.0)) / 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 <= 0.0) tmp = Float64(Float64(expm1(Float64(n * log1p(Float64(i / n)))) * 100.0) / Float64(i / n)); elseif (t_1 <= Inf) tmp = Float64(n * Float64(Float64(-100.0 + Float64(t_0 * 100.0)) / 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, 0.0], N[(N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] * 100.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(n * N[(N[(-100.0 + N[(t$95$0 * 100.0), $MachinePrecision]), $MachinePrecision] / 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 := \frac{t_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t_1 \leq 0:\\
\;\;\;\;\frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot 100}{\frac{i}{n}}\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;n \cdot \frac{-100 + t_0 \cdot 100}{i}\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 0.0Initial program 25.3%
associate-*r/25.3%
sub-neg25.3%
distribute-lft-in25.3%
fma-def25.3%
metadata-eval25.3%
metadata-eval25.3%
Simplified25.3%
fma-udef25.3%
metadata-eval25.3%
metadata-eval25.3%
distribute-lft-in25.3%
sub-neg25.3%
*-commutative25.3%
pow-to-exp24.2%
expm1-def36.4%
*-commutative36.4%
log1p-udef98.6%
Applied egg-rr98.6%
if 0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 98.2%
associate-/r/98.1%
associate-*r*98.3%
*-commutative98.3%
associate-*r/98.6%
sub-neg98.6%
distribute-lft-in98.5%
fma-def98.6%
metadata-eval98.6%
metadata-eval98.6%
Simplified98.6%
fma-udef98.4%
*-commutative98.4%
Applied egg-rr98.5%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
Taylor expanded in i around 0 76.5%
*-commutative76.5%
Simplified76.5%
Final simplification94.4%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (/ (expm1 i) (/ i n)))))
(if (<= i -2e-8)
t_0
(if (<= i 24000000.0)
(+ (* n 100.0) (* 50.0 (* i n)))
(if (<= i 6.5e+187)
t_0
(if (<= i 9e+248) (/ 0.0 (/ i n)) (/ (* 100.0 (* i n)) i)))))))
double code(double i, double n) {
double t_0 = 100.0 * (expm1(i) / (i / n));
double tmp;
if (i <= -2e-8) {
tmp = t_0;
} else if (i <= 24000000.0) {
tmp = (n * 100.0) + (50.0 * (i * n));
} else if (i <= 6.5e+187) {
tmp = t_0;
} else if (i <= 9e+248) {
tmp = 0.0 / (i / n);
} else {
tmp = (100.0 * (i * n)) / i;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = 100.0 * (Math.expm1(i) / (i / n));
double tmp;
if (i <= -2e-8) {
tmp = t_0;
} else if (i <= 24000000.0) {
tmp = (n * 100.0) + (50.0 * (i * n));
} else if (i <= 6.5e+187) {
tmp = t_0;
} else if (i <= 9e+248) {
tmp = 0.0 / (i / n);
} else {
tmp = (100.0 * (i * n)) / i;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (math.expm1(i) / (i / n)) tmp = 0 if i <= -2e-8: tmp = t_0 elif i <= 24000000.0: tmp = (n * 100.0) + (50.0 * (i * n)) elif i <= 6.5e+187: tmp = t_0 elif i <= 9e+248: tmp = 0.0 / (i / n) else: tmp = (100.0 * (i * n)) / i return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(expm1(i) / Float64(i / n))) tmp = 0.0 if (i <= -2e-8) tmp = t_0; elseif (i <= 24000000.0) tmp = Float64(Float64(n * 100.0) + Float64(50.0 * Float64(i * n))); elseif (i <= 6.5e+187) tmp = t_0; elseif (i <= 9e+248) tmp = Float64(0.0 / Float64(i / n)); else tmp = Float64(Float64(100.0 * Float64(i * n)) / i); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[i, -2e-8], t$95$0, If[LessEqual[i, 24000000.0], N[(N[(n * 100.0), $MachinePrecision] + N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 6.5e+187], t$95$0, If[LessEqual[i, 9e+248], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(N[(100.0 * N[(i * n), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\
\mathbf{if}\;i \leq -2 \cdot 10^{-8}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;i \leq 24000000:\\
\;\;\;\;n \cdot 100 + 50 \cdot \left(i \cdot n\right)\\
\mathbf{elif}\;i \leq 6.5 \cdot 10^{+187}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;i \leq 9 \cdot 10^{+248}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;\frac{100 \cdot \left(i \cdot n\right)}{i}\\
\end{array}
\end{array}
if i < -2e-8 or 2.4e7 < i < 6.49999999999999969e187Initial program 48.0%
Taylor expanded in n around inf 69.0%
expm1-def69.4%
Simplified69.4%
if -2e-8 < i < 2.4e7Initial program 9.3%
Taylor expanded in i around 0 82.3%
associate-*r*82.2%
*-commutative82.2%
associate-*r/82.2%
metadata-eval82.2%
Simplified82.2%
Taylor expanded in n around inf 82.7%
Taylor expanded in i around 0 82.7%
if 6.49999999999999969e187 < i < 8.9999999999999993e248Initial program 27.0%
associate-*r/27.0%
sub-neg27.0%
distribute-lft-in27.0%
fma-def27.0%
metadata-eval27.0%
metadata-eval27.0%
Simplified27.0%
fma-udef27.0%
*-commutative27.0%
Applied egg-rr27.0%
Taylor expanded in i around 0 72.6%
if 8.9999999999999993e248 < i Initial program 86.3%
associate-/r/86.4%
associate-*r*86.6%
*-commutative86.6%
associate-*r/86.8%
sub-neg86.8%
distribute-lft-in86.8%
fma-def86.8%
metadata-eval86.8%
metadata-eval86.8%
Simplified86.8%
Taylor expanded in n around inf 40.7%
Taylor expanded in i around 0 41.1%
Final simplification75.5%
(FPCore (i n) :precision binary64 (if (or (<= n -2.1e-174) (not (<= n 8.5e-108))) (* n (* 100.0 (/ (expm1 i) i))) (/ 0.0 (/ i n))))
double code(double i, double n) {
double tmp;
if ((n <= -2.1e-174) || !(n <= 8.5e-108)) {
tmp = n * (100.0 * (expm1(i) / i));
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((n <= -2.1e-174) || !(n <= 8.5e-108)) {
tmp = n * (100.0 * (Math.expm1(i) / i));
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -2.1e-174) or not (n <= 8.5e-108): tmp = n * (100.0 * (math.expm1(i) / i)) else: tmp = 0.0 / (i / n) return tmp
function code(i, n) tmp = 0.0 if ((n <= -2.1e-174) || !(n <= 8.5e-108)) tmp = Float64(n * Float64(100.0 * Float64(expm1(i) / i))); else tmp = Float64(0.0 / Float64(i / n)); end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -2.1e-174], N[Not[LessEqual[n, 8.5e-108]], $MachinePrecision]], N[(n * N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.1 \cdot 10^{-174} \lor \neg \left(n \leq 8.5 \cdot 10^{-108}\right):\\
\;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -2.1000000000000001e-174 or 8.49999999999999986e-108 < n Initial program 21.9%
associate-*r/21.9%
sub-neg21.9%
distribute-lft-in21.8%
fma-def21.9%
metadata-eval21.9%
metadata-eval21.9%
Simplified21.9%
fma-udef21.8%
metadata-eval21.8%
metadata-eval21.8%
distribute-lft-in21.9%
sub-neg21.9%
associate-*r/21.9%
associate-/r/22.2%
associate-*r*22.2%
pow-to-exp15.6%
expm1-def21.5%
*-commutative21.5%
log1p-udef74.4%
Applied egg-rr74.4%
Taylor expanded in n around inf 30.7%
expm1-def84.5%
Simplified84.5%
if -2.1000000000000001e-174 < n < 8.49999999999999986e-108Initial program 44.7%
associate-*r/44.7%
sub-neg44.7%
distribute-lft-in44.7%
fma-def44.7%
metadata-eval44.7%
metadata-eval44.7%
Simplified44.7%
fma-udef44.7%
*-commutative44.7%
Applied egg-rr44.7%
Taylor expanded in i around 0 65.0%
Final simplification80.0%
(FPCore (i n)
:precision binary64
(if (<= n -2.8e-97)
(*
100.0
(+
n
(*
n
(*
i
(+
(- 0.5 (/ 0.5 n))
(*
i
(-
(+ 0.16666666666666666 (/ (/ 0.3333333333333333 n) n))
(/ 0.5 n))))))))
(if (<= n 1.85e-107)
(/ 0.0 (/ i n))
(* n (+ 100.0 (+ (* (* i i) 16.666666666666668) (* i 50.0)))))))
double code(double i, double n) {
double tmp;
if (n <= -2.8e-97) {
tmp = 100.0 * (n + (n * (i * ((0.5 - (0.5 / n)) + (i * ((0.16666666666666666 + ((0.3333333333333333 / n) / n)) - (0.5 / n)))))));
} else if (n <= 1.85e-107) {
tmp = 0.0 / (i / n);
} else {
tmp = n * (100.0 + (((i * i) * 16.666666666666668) + (i * 50.0)));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-2.8d-97)) then
tmp = 100.0d0 * (n + (n * (i * ((0.5d0 - (0.5d0 / n)) + (i * ((0.16666666666666666d0 + ((0.3333333333333333d0 / n) / n)) - (0.5d0 / n)))))))
else if (n <= 1.85d-107) then
tmp = 0.0d0 / (i / n)
else
tmp = n * (100.0d0 + (((i * i) * 16.666666666666668d0) + (i * 50.0d0)))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -2.8e-97) {
tmp = 100.0 * (n + (n * (i * ((0.5 - (0.5 / n)) + (i * ((0.16666666666666666 + ((0.3333333333333333 / n) / n)) - (0.5 / n)))))));
} else if (n <= 1.85e-107) {
tmp = 0.0 / (i / n);
} else {
tmp = n * (100.0 + (((i * i) * 16.666666666666668) + (i * 50.0)));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -2.8e-97: tmp = 100.0 * (n + (n * (i * ((0.5 - (0.5 / n)) + (i * ((0.16666666666666666 + ((0.3333333333333333 / n) / n)) - (0.5 / n))))))) elif n <= 1.85e-107: tmp = 0.0 / (i / n) else: tmp = n * (100.0 + (((i * i) * 16.666666666666668) + (i * 50.0))) return tmp
function code(i, n) tmp = 0.0 if (n <= -2.8e-97) tmp = Float64(100.0 * Float64(n + Float64(n * Float64(i * Float64(Float64(0.5 - Float64(0.5 / n)) + Float64(i * Float64(Float64(0.16666666666666666 + Float64(Float64(0.3333333333333333 / n) / n)) - Float64(0.5 / n)))))))); elseif (n <= 1.85e-107) tmp = Float64(0.0 / Float64(i / n)); else tmp = Float64(n * Float64(100.0 + Float64(Float64(Float64(i * i) * 16.666666666666668) + Float64(i * 50.0)))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -2.8e-97) tmp = 100.0 * (n + (n * (i * ((0.5 - (0.5 / n)) + (i * ((0.16666666666666666 + ((0.3333333333333333 / n) / n)) - (0.5 / n))))))); elseif (n <= 1.85e-107) tmp = 0.0 / (i / n); else tmp = n * (100.0 + (((i * i) * 16.666666666666668) + (i * 50.0))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -2.8e-97], N[(100.0 * N[(n + N[(n * N[(i * N[(N[(0.5 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] + N[(i * N[(N[(0.16666666666666666 + N[(N[(0.3333333333333333 / n), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.85e-107], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(N[(N[(i * i), $MachinePrecision] * 16.666666666666668), $MachinePrecision] + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.8 \cdot 10^{-97}:\\
\;\;\;\;100 \cdot \left(n + n \cdot \left(i \cdot \left(\left(0.5 - \frac{0.5}{n}\right) + i \cdot \left(\left(0.16666666666666666 + \frac{\frac{0.3333333333333333}{n}}{n}\right) - \frac{0.5}{n}\right)\right)\right)\right)\\
\mathbf{elif}\;n \leq 1.85 \cdot 10^{-107}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + \left(\left(i \cdot i\right) \cdot 16.666666666666668 + i \cdot 50\right)\right)\\
\end{array}
\end{array}
if n < -2.8000000000000002e-97Initial program 26.5%
associate-*r/26.5%
sub-neg26.5%
distribute-lft-in26.4%
fma-def26.5%
metadata-eval26.5%
metadata-eval26.5%
Simplified26.5%
fma-udef26.4%
metadata-eval26.4%
metadata-eval26.4%
distribute-lft-in26.5%
sub-neg26.5%
*-commutative26.5%
pow-to-exp14.1%
expm1-def17.2%
*-commutative17.2%
log1p-udef70.2%
Applied egg-rr70.2%
Taylor expanded in i around 0 60.8%
Simplified61.0%
if -2.8000000000000002e-97 < n < 1.8500000000000001e-107Initial program 43.5%
associate-*r/43.5%
sub-neg43.5%
distribute-lft-in43.5%
fma-def43.5%
metadata-eval43.5%
metadata-eval43.5%
Simplified43.5%
fma-udef43.5%
*-commutative43.5%
Applied egg-rr43.5%
Taylor expanded in i around 0 61.7%
if 1.8500000000000001e-107 < n Initial program 17.1%
associate-/r/17.5%
associate-*r*17.5%
*-commutative17.5%
associate-*r/17.5%
sub-neg17.5%
distribute-lft-in17.5%
fma-def17.5%
metadata-eval17.5%
metadata-eval17.5%
Simplified17.5%
Taylor expanded in i around 0 77.8%
distribute-lft-out77.8%
associate-*r/77.8%
metadata-eval77.8%
unpow277.8%
associate--l+77.8%
associate-*r/77.8%
metadata-eval77.8%
unpow277.8%
associate-*r/77.8%
metadata-eval77.8%
Simplified77.8%
Taylor expanded in n around inf 77.9%
distribute-rgt-in77.9%
*-commutative77.9%
associate-*l*77.9%
unpow277.9%
metadata-eval77.9%
*-commutative77.9%
associate-*l*77.9%
metadata-eval77.9%
Simplified77.9%
Final simplification67.9%
(FPCore (i n) :precision binary64 (if (or (<= n -8e-134) (not (<= n 8.5e-108))) (* 100.0 (+ n (* n (* i (+ 0.5 (* i 0.16666666666666666)))))) (/ 0.0 (/ i n))))
double code(double i, double n) {
double tmp;
if ((n <= -8e-134) || !(n <= 8.5e-108)) {
tmp = 100.0 * (n + (n * (i * (0.5 + (i * 0.16666666666666666)))));
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-8d-134)) .or. (.not. (n <= 8.5d-108))) then
tmp = 100.0d0 * (n + (n * (i * (0.5d0 + (i * 0.16666666666666666d0)))))
else
tmp = 0.0d0 / (i / n)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -8e-134) || !(n <= 8.5e-108)) {
tmp = 100.0 * (n + (n * (i * (0.5 + (i * 0.16666666666666666)))));
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -8e-134) or not (n <= 8.5e-108): tmp = 100.0 * (n + (n * (i * (0.5 + (i * 0.16666666666666666))))) else: tmp = 0.0 / (i / n) return tmp
function code(i, n) tmp = 0.0 if ((n <= -8e-134) || !(n <= 8.5e-108)) tmp = Float64(100.0 * Float64(n + Float64(n * Float64(i * Float64(0.5 + Float64(i * 0.16666666666666666)))))); else tmp = Float64(0.0 / Float64(i / n)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -8e-134) || ~((n <= 8.5e-108))) tmp = 100.0 * (n + (n * (i * (0.5 + (i * 0.16666666666666666))))); else tmp = 0.0 / (i / n); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -8e-134], N[Not[LessEqual[n, 8.5e-108]], $MachinePrecision]], N[(100.0 * N[(n + N[(n * N[(i * N[(0.5 + N[(i * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -8 \cdot 10^{-134} \lor \neg \left(n \leq 8.5 \cdot 10^{-108}\right):\\
\;\;\;\;100 \cdot \left(n + n \cdot \left(i \cdot \left(0.5 + i \cdot 0.16666666666666666\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -8.00000000000000032e-134 or 8.49999999999999986e-108 < n Initial program 21.6%
associate-*r/21.6%
sub-neg21.6%
distribute-lft-in21.5%
fma-def21.6%
metadata-eval21.6%
metadata-eval21.6%
Simplified21.6%
fma-udef21.5%
metadata-eval21.5%
metadata-eval21.5%
distribute-lft-in21.6%
sub-neg21.6%
*-commutative21.6%
pow-to-exp14.9%
expm1-def20.8%
*-commutative20.8%
log1p-udef74.5%
Applied egg-rr74.5%
Taylor expanded in i around 0 68.6%
Simplified68.9%
Taylor expanded in n around inf 68.9%
if -8.00000000000000032e-134 < n < 8.49999999999999986e-108Initial program 44.9%
associate-*r/44.9%
sub-neg44.9%
distribute-lft-in44.9%
fma-def44.9%
metadata-eval44.9%
metadata-eval44.9%
Simplified44.9%
fma-udef44.9%
*-commutative44.9%
Applied egg-rr44.9%
Taylor expanded in i around 0 64.6%
Final simplification67.9%
(FPCore (i n)
:precision binary64
(if (<= n -2.4e-129)
(* 100.0 (+ n (* n (* i (+ 0.5 (* i 0.16666666666666666))))))
(if (<= n 1.86e-106)
(/ 0.0 (/ i n))
(* n (+ 100.0 (+ (* (* i i) 16.666666666666668) (* i 50.0)))))))
double code(double i, double n) {
double tmp;
if (n <= -2.4e-129) {
tmp = 100.0 * (n + (n * (i * (0.5 + (i * 0.16666666666666666)))));
} else if (n <= 1.86e-106) {
tmp = 0.0 / (i / n);
} else {
tmp = n * (100.0 + (((i * i) * 16.666666666666668) + (i * 50.0)));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-2.4d-129)) then
tmp = 100.0d0 * (n + (n * (i * (0.5d0 + (i * 0.16666666666666666d0)))))
else if (n <= 1.86d-106) then
tmp = 0.0d0 / (i / n)
else
tmp = n * (100.0d0 + (((i * i) * 16.666666666666668d0) + (i * 50.0d0)))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -2.4e-129) {
tmp = 100.0 * (n + (n * (i * (0.5 + (i * 0.16666666666666666)))));
} else if (n <= 1.86e-106) {
tmp = 0.0 / (i / n);
} else {
tmp = n * (100.0 + (((i * i) * 16.666666666666668) + (i * 50.0)));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -2.4e-129: tmp = 100.0 * (n + (n * (i * (0.5 + (i * 0.16666666666666666))))) elif n <= 1.86e-106: tmp = 0.0 / (i / n) else: tmp = n * (100.0 + (((i * i) * 16.666666666666668) + (i * 50.0))) return tmp
function code(i, n) tmp = 0.0 if (n <= -2.4e-129) tmp = Float64(100.0 * Float64(n + Float64(n * Float64(i * Float64(0.5 + Float64(i * 0.16666666666666666)))))); elseif (n <= 1.86e-106) tmp = Float64(0.0 / Float64(i / n)); else tmp = Float64(n * Float64(100.0 + Float64(Float64(Float64(i * i) * 16.666666666666668) + Float64(i * 50.0)))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -2.4e-129) tmp = 100.0 * (n + (n * (i * (0.5 + (i * 0.16666666666666666))))); elseif (n <= 1.86e-106) tmp = 0.0 / (i / n); else tmp = n * (100.0 + (((i * i) * 16.666666666666668) + (i * 50.0))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -2.4e-129], N[(100.0 * N[(n + N[(n * N[(i * N[(0.5 + N[(i * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.86e-106], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(N[(N[(i * i), $MachinePrecision] * 16.666666666666668), $MachinePrecision] + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.4 \cdot 10^{-129}:\\
\;\;\;\;100 \cdot \left(n + n \cdot \left(i \cdot \left(0.5 + i \cdot 0.16666666666666666\right)\right)\right)\\
\mathbf{elif}\;n \leq 1.86 \cdot 10^{-106}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + \left(\left(i \cdot i\right) \cdot 16.666666666666668 + i \cdot 50\right)\right)\\
\end{array}
\end{array}
if n < -2.39999999999999989e-129Initial program 26.4%
associate-*r/26.5%
sub-neg26.5%
distribute-lft-in26.4%
fma-def26.5%
metadata-eval26.5%
metadata-eval26.5%
Simplified26.5%
fma-udef26.4%
metadata-eval26.4%
metadata-eval26.4%
distribute-lft-in26.5%
sub-neg26.5%
*-commutative26.5%
pow-to-exp14.7%
expm1-def20.6%
*-commutative20.6%
log1p-udef71.8%
Applied egg-rr71.8%
Taylor expanded in i around 0 58.8%
Simplified59.0%
Taylor expanded in n around inf 59.1%
if -2.39999999999999989e-129 < n < 1.86e-106Initial program 44.9%
associate-*r/44.9%
sub-neg44.9%
distribute-lft-in44.9%
fma-def44.9%
metadata-eval44.9%
metadata-eval44.9%
Simplified44.9%
fma-udef44.9%
*-commutative44.9%
Applied egg-rr44.9%
Taylor expanded in i around 0 64.6%
if 1.86e-106 < n Initial program 17.1%
associate-/r/17.5%
associate-*r*17.5%
*-commutative17.5%
associate-*r/17.5%
sub-neg17.5%
distribute-lft-in17.5%
fma-def17.5%
metadata-eval17.5%
metadata-eval17.5%
Simplified17.5%
Taylor expanded in i around 0 77.8%
distribute-lft-out77.8%
associate-*r/77.8%
metadata-eval77.8%
unpow277.8%
associate--l+77.8%
associate-*r/77.8%
metadata-eval77.8%
unpow277.8%
associate-*r/77.8%
metadata-eval77.8%
Simplified77.8%
Taylor expanded in n around inf 77.9%
distribute-rgt-in77.9%
*-commutative77.9%
associate-*l*77.9%
unpow277.9%
metadata-eval77.9%
*-commutative77.9%
associate-*l*77.9%
metadata-eval77.9%
Simplified77.9%
Final simplification67.9%
(FPCore (i n)
:precision binary64
(if (<= n -1.05e-96)
(/ (* n (* i 100.0)) i)
(if (<= n 1.42e-154)
(/ 0.0 (/ i n))
(if (<= n 3.5e+67) (* 100.0 (/ i (/ i n))) (/ (* 100.0 (* i n)) i)))))
double code(double i, double n) {
double tmp;
if (n <= -1.05e-96) {
tmp = (n * (i * 100.0)) / i;
} else if (n <= 1.42e-154) {
tmp = 0.0 / (i / n);
} else if (n <= 3.5e+67) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = (100.0 * (i * n)) / i;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-1.05d-96)) then
tmp = (n * (i * 100.0d0)) / i
else if (n <= 1.42d-154) then
tmp = 0.0d0 / (i / n)
else if (n <= 3.5d+67) then
tmp = 100.0d0 * (i / (i / n))
else
tmp = (100.0d0 * (i * n)) / i
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -1.05e-96) {
tmp = (n * (i * 100.0)) / i;
} else if (n <= 1.42e-154) {
tmp = 0.0 / (i / n);
} else if (n <= 3.5e+67) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = (100.0 * (i * n)) / i;
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -1.05e-96: tmp = (n * (i * 100.0)) / i elif n <= 1.42e-154: tmp = 0.0 / (i / n) elif n <= 3.5e+67: tmp = 100.0 * (i / (i / n)) else: tmp = (100.0 * (i * n)) / i return tmp
function code(i, n) tmp = 0.0 if (n <= -1.05e-96) tmp = Float64(Float64(n * Float64(i * 100.0)) / i); elseif (n <= 1.42e-154) tmp = Float64(0.0 / Float64(i / n)); elseif (n <= 3.5e+67) tmp = Float64(100.0 * Float64(i / Float64(i / n))); else tmp = Float64(Float64(100.0 * Float64(i * n)) / i); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -1.05e-96) tmp = (n * (i * 100.0)) / i; elseif (n <= 1.42e-154) tmp = 0.0 / (i / n); elseif (n <= 3.5e+67) tmp = 100.0 * (i / (i / n)); else tmp = (100.0 * (i * n)) / i; end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -1.05e-96], N[(N[(n * N[(i * 100.0), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision], If[LessEqual[n, 1.42e-154], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 3.5e+67], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(100.0 * N[(i * n), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.05 \cdot 10^{-96}:\\
\;\;\;\;\frac{n \cdot \left(i \cdot 100\right)}{i}\\
\mathbf{elif}\;n \leq 1.42 \cdot 10^{-154}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 3.5 \cdot 10^{+67}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;\frac{100 \cdot \left(i \cdot n\right)}{i}\\
\end{array}
\end{array}
if n < -1.05000000000000001e-96Initial program 26.5%
associate-/r/26.8%
associate-*r*26.8%
*-commutative26.8%
associate-*r/26.9%
sub-neg26.9%
distribute-lft-in26.8%
fma-def26.9%
metadata-eval26.9%
metadata-eval26.9%
Simplified26.9%
Taylor expanded in n around inf 33.7%
Taylor expanded in i around 0 58.1%
*-commutative58.1%
associate-*l*58.3%
*-commutative58.3%
Simplified58.3%
if -1.05000000000000001e-96 < n < 1.42e-154Initial program 47.9%
associate-*r/47.9%
sub-neg47.9%
distribute-lft-in47.9%
fma-def47.9%
metadata-eval47.9%
metadata-eval47.9%
Simplified47.9%
fma-udef47.9%
*-commutative47.9%
Applied egg-rr47.9%
Taylor expanded in i around 0 63.4%
if 1.42e-154 < n < 3.5e67Initial program 16.1%
Taylor expanded in i around 0 72.2%
if 3.5e67 < n Initial program 17.2%
associate-/r/17.8%
associate-*r*17.8%
*-commutative17.8%
associate-*r/17.8%
sub-neg17.8%
distribute-lft-in17.8%
fma-def17.8%
metadata-eval17.8%
metadata-eval17.8%
Simplified17.8%
Taylor expanded in n around inf 45.5%
Taylor expanded in i around 0 72.6%
Final simplification65.5%
(FPCore (i n) :precision binary64 (if (or (<= n -7.6e-125) (not (<= n 1.22e-107))) (* 100.0 (* n (+ 1.0 (* i 0.5)))) (/ 0.0 (/ i n))))
double code(double i, double n) {
double tmp;
if ((n <= -7.6e-125) || !(n <= 1.22e-107)) {
tmp = 100.0 * (n * (1.0 + (i * 0.5)));
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-7.6d-125)) .or. (.not. (n <= 1.22d-107))) then
tmp = 100.0d0 * (n * (1.0d0 + (i * 0.5d0)))
else
tmp = 0.0d0 / (i / n)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -7.6e-125) || !(n <= 1.22e-107)) {
tmp = 100.0 * (n * (1.0 + (i * 0.5)));
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -7.6e-125) or not (n <= 1.22e-107): tmp = 100.0 * (n * (1.0 + (i * 0.5))) else: tmp = 0.0 / (i / n) return tmp
function code(i, n) tmp = 0.0 if ((n <= -7.6e-125) || !(n <= 1.22e-107)) tmp = Float64(100.0 * Float64(n * Float64(1.0 + Float64(i * 0.5)))); else tmp = Float64(0.0 / Float64(i / n)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -7.6e-125) || ~((n <= 1.22e-107))) tmp = 100.0 * (n * (1.0 + (i * 0.5))); else tmp = 0.0 / (i / n); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -7.6e-125], N[Not[LessEqual[n, 1.22e-107]], $MachinePrecision]], N[(100.0 * N[(n * N[(1.0 + N[(i * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -7.6 \cdot 10^{-125} \lor \neg \left(n \leq 1.22 \cdot 10^{-107}\right):\\
\;\;\;\;100 \cdot \left(n \cdot \left(1 + i \cdot 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -7.6000000000000002e-125 or 1.22000000000000001e-107 < n Initial program 21.6%
Taylor expanded in i around 0 65.8%
associate-*r*65.8%
*-commutative65.8%
associate-*r/65.8%
metadata-eval65.8%
Simplified65.8%
Taylor expanded in n around inf 66.1%
if -7.6000000000000002e-125 < n < 1.22000000000000001e-107Initial program 44.9%
associate-*r/44.9%
sub-neg44.9%
distribute-lft-in44.9%
fma-def44.9%
metadata-eval44.9%
metadata-eval44.9%
Simplified44.9%
fma-udef44.9%
*-commutative44.9%
Applied egg-rr44.9%
Taylor expanded in i around 0 64.6%
Final simplification65.8%
(FPCore (i n) :precision binary64 (if (<= n -1.05e-132) (* 100.0 (* n (+ 1.0 (* i 0.5)))) (if (<= n 8.5e-108) (/ 0.0 (/ i n)) (+ (* n 100.0) (* 50.0 (* i n))))))
double code(double i, double n) {
double tmp;
if (n <= -1.05e-132) {
tmp = 100.0 * (n * (1.0 + (i * 0.5)));
} else if (n <= 8.5e-108) {
tmp = 0.0 / (i / n);
} else {
tmp = (n * 100.0) + (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 (n <= (-1.05d-132)) then
tmp = 100.0d0 * (n * (1.0d0 + (i * 0.5d0)))
else if (n <= 8.5d-108) then
tmp = 0.0d0 / (i / n)
else
tmp = (n * 100.0d0) + (50.0d0 * (i * n))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -1.05e-132) {
tmp = 100.0 * (n * (1.0 + (i * 0.5)));
} else if (n <= 8.5e-108) {
tmp = 0.0 / (i / n);
} else {
tmp = (n * 100.0) + (50.0 * (i * n));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -1.05e-132: tmp = 100.0 * (n * (1.0 + (i * 0.5))) elif n <= 8.5e-108: tmp = 0.0 / (i / n) else: tmp = (n * 100.0) + (50.0 * (i * n)) return tmp
function code(i, n) tmp = 0.0 if (n <= -1.05e-132) tmp = Float64(100.0 * Float64(n * Float64(1.0 + Float64(i * 0.5)))); elseif (n <= 8.5e-108) tmp = Float64(0.0 / Float64(i / n)); else tmp = Float64(Float64(n * 100.0) + Float64(50.0 * Float64(i * n))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -1.05e-132) tmp = 100.0 * (n * (1.0 + (i * 0.5))); elseif (n <= 8.5e-108) tmp = 0.0 / (i / n); else tmp = (n * 100.0) + (50.0 * (i * n)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -1.05e-132], N[(100.0 * N[(n * N[(1.0 + N[(i * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 8.5e-108], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(N[(n * 100.0), $MachinePrecision] + N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.05 \cdot 10^{-132}:\\
\;\;\;\;100 \cdot \left(n \cdot \left(1 + i \cdot 0.5\right)\right)\\
\mathbf{elif}\;n \leq 8.5 \cdot 10^{-108}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100 + 50 \cdot \left(i \cdot n\right)\\
\end{array}
\end{array}
if n < -1.05e-132Initial program 26.4%
Taylor expanded in i around 0 57.2%
associate-*r*57.2%
*-commutative57.2%
associate-*r/57.2%
metadata-eval57.2%
Simplified57.2%
Taylor expanded in n around inf 57.5%
if -1.05e-132 < n < 8.49999999999999986e-108Initial program 44.9%
associate-*r/44.9%
sub-neg44.9%
distribute-lft-in44.9%
fma-def44.9%
metadata-eval44.9%
metadata-eval44.9%
Simplified44.9%
fma-udef44.9%
*-commutative44.9%
Applied egg-rr44.9%
Taylor expanded in i around 0 64.6%
if 8.49999999999999986e-108 < n Initial program 17.1%
Taylor expanded in i around 0 73.7%
associate-*r*73.7%
*-commutative73.7%
associate-*r/73.7%
metadata-eval73.7%
Simplified73.7%
Taylor expanded in n around inf 74.0%
Taylor expanded in i around 0 74.0%
Final simplification65.8%
(FPCore (i n) :precision binary64 (if (or (<= n -2e+25) (not (<= n 3.5e+67))) (/ (* 100.0 (* i n)) i) (* 100.0 (/ i (/ i n)))))
double code(double i, double n) {
double tmp;
if ((n <= -2e+25) || !(n <= 3.5e+67)) {
tmp = (100.0 * (i * n)) / i;
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-2d+25)) .or. (.not. (n <= 3.5d+67))) then
tmp = (100.0d0 * (i * n)) / i
else
tmp = 100.0d0 * (i / (i / n))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -2e+25) || !(n <= 3.5e+67)) {
tmp = (100.0 * (i * n)) / i;
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -2e+25) or not (n <= 3.5e+67): tmp = (100.0 * (i * n)) / i else: tmp = 100.0 * (i / (i / n)) return tmp
function code(i, n) tmp = 0.0 if ((n <= -2e+25) || !(n <= 3.5e+67)) tmp = Float64(Float64(100.0 * Float64(i * n)) / i); else tmp = Float64(100.0 * Float64(i / Float64(i / n))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -2e+25) || ~((n <= 3.5e+67))) tmp = (100.0 * (i * n)) / i; else tmp = 100.0 * (i / (i / n)); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -2e+25], N[Not[LessEqual[n, 3.5e+67]], $MachinePrecision]], N[(N[(100.0 * N[(i * n), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2 \cdot 10^{+25} \lor \neg \left(n \leq 3.5 \cdot 10^{+67}\right):\\
\;\;\;\;\frac{100 \cdot \left(i \cdot n\right)}{i}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -2.00000000000000018e25 or 3.5e67 < n Initial program 21.4%
associate-/r/22.0%
associate-*r*22.0%
*-commutative22.0%
associate-*r/22.1%
sub-neg22.1%
distribute-lft-in22.1%
fma-def22.1%
metadata-eval22.1%
metadata-eval22.1%
Simplified22.1%
Taylor expanded in n around inf 41.7%
Taylor expanded in i around 0 65.3%
if -2.00000000000000018e25 < n < 3.5e67Initial program 32.7%
Taylor expanded in i around 0 61.2%
Final simplification63.2%
(FPCore (i n) :precision binary64 (if (<= i -4e+134) (* 100.0 (/ i (/ i n))) (if (<= i 26500000.0) (* n 100.0) (* n (* i 50.0)))))
double code(double i, double n) {
double tmp;
if (i <= -4e+134) {
tmp = 100.0 * (i / (i / n));
} else if (i <= 26500000.0) {
tmp = n * 100.0;
} else {
tmp = n * (i * 50.0);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= (-4d+134)) then
tmp = 100.0d0 * (i / (i / n))
else if (i <= 26500000.0d0) then
tmp = n * 100.0d0
else
tmp = n * (i * 50.0d0)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= -4e+134) {
tmp = 100.0 * (i / (i / n));
} else if (i <= 26500000.0) {
tmp = n * 100.0;
} else {
tmp = n * (i * 50.0);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -4e+134: tmp = 100.0 * (i / (i / n)) elif i <= 26500000.0: tmp = n * 100.0 else: tmp = n * (i * 50.0) return tmp
function code(i, n) tmp = 0.0 if (i <= -4e+134) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (i <= 26500000.0) tmp = Float64(n * 100.0); else tmp = Float64(n * Float64(i * 50.0)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -4e+134) tmp = 100.0 * (i / (i / n)); elseif (i <= 26500000.0) tmp = n * 100.0; else tmp = n * (i * 50.0); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -4e+134], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 26500000.0], N[(n * 100.0), $MachinePrecision], N[(n * N[(i * 50.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -4 \cdot 10^{+134}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;i \leq 26500000:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(i \cdot 50\right)\\
\end{array}
\end{array}
if i < -3.99999999999999969e134Initial program 73.2%
Taylor expanded in i around 0 39.8%
if -3.99999999999999969e134 < i < 2.65e7Initial program 12.4%
Taylor expanded in i around 0 73.0%
*-commutative73.0%
Simplified73.0%
if 2.65e7 < i Initial program 49.1%
Taylor expanded in i around 0 28.0%
associate-*r*28.0%
*-commutative28.0%
associate-*r/28.0%
metadata-eval28.0%
Simplified28.0%
Taylor expanded in n around inf 28.5%
Taylor expanded in i around inf 28.5%
*-commutative28.5%
associate-*l*28.5%
Simplified28.5%
Final simplification59.0%
(FPCore (i n) :precision binary64 (if (<= i 29500000.0) (* n 100.0) (* n (* i 50.0))))
double code(double i, double n) {
double tmp;
if (i <= 29500000.0) {
tmp = n * 100.0;
} else {
tmp = n * (i * 50.0);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= 29500000.0d0) then
tmp = n * 100.0d0
else
tmp = n * (i * 50.0d0)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= 29500000.0) {
tmp = n * 100.0;
} else {
tmp = n * (i * 50.0);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 29500000.0: tmp = n * 100.0 else: tmp = n * (i * 50.0) return tmp
function code(i, n) tmp = 0.0 if (i <= 29500000.0) tmp = Float64(n * 100.0); else tmp = Float64(n * Float64(i * 50.0)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= 29500000.0) tmp = n * 100.0; else tmp = n * (i * 50.0); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, 29500000.0], N[(n * 100.0), $MachinePrecision], N[(n * N[(i * 50.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 29500000:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(i \cdot 50\right)\\
\end{array}
\end{array}
if i < 2.95e7Initial program 20.0%
Taylor expanded in i around 0 64.6%
*-commutative64.6%
Simplified64.6%
if 2.95e7 < i Initial program 49.1%
Taylor expanded in i around 0 28.0%
associate-*r*28.0%
*-commutative28.0%
associate-*r/28.0%
metadata-eval28.0%
Simplified28.0%
Taylor expanded in n around inf 28.5%
Taylor expanded in i around inf 28.5%
*-commutative28.5%
associate-*l*28.5%
Simplified28.5%
Final simplification55.8%
(FPCore (i n) :precision binary64 (* i -50.0))
double code(double i, double n) {
return i * -50.0;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = i * (-50.0d0)
end function
public static double code(double i, double n) {
return i * -50.0;
}
def code(i, n): return i * -50.0
function code(i, n) return Float64(i * -50.0) end
function tmp = code(i, n) tmp = i * -50.0; end
code[i_, n_] := N[(i * -50.0), $MachinePrecision]
\begin{array}{l}
\\
i \cdot -50
\end{array}
Initial program 27.1%
Taylor expanded in i around 0 55.3%
associate-*r*55.3%
*-commutative55.3%
associate-*r/55.3%
metadata-eval55.3%
Simplified55.3%
Taylor expanded in n around 0 2.9%
*-commutative2.9%
Simplified2.9%
Final simplification2.9%
(FPCore (i n) :precision binary64 (* n 100.0))
double code(double i, double n) {
return n * 100.0;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = n * 100.0d0
end function
public static double code(double i, double n) {
return n * 100.0;
}
def code(i, n): return n * 100.0
function code(i, n) return Float64(n * 100.0) end
function tmp = code(i, n) tmp = n * 100.0; end
code[i_, n_] := N[(n * 100.0), $MachinePrecision]
\begin{array}{l}
\\
n \cdot 100
\end{array}
Initial program 27.1%
Taylor expanded in i around 0 50.0%
*-commutative50.0%
Simplified50.0%
Final simplification50.0%
(FPCore (i n)
:precision binary64
(let* ((t_0 (+ 1.0 (/ i n))))
(*
100.0
(/
(-
(exp
(*
n
(if (== t_0 1.0)
(/ i n)
(/ (* (/ i n) (log t_0)) (- (+ (/ i n) 1.0) 1.0)))))
1.0)
(/ i n)))))
double code(double i, double n) {
double t_0 = 1.0 + (i / n);
double tmp;
if (t_0 == 1.0) {
tmp = i / n;
} else {
tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0) - 1.0);
}
return 100.0 * ((exp((n * tmp)) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + (i / n)
if (t_0 == 1.0d0) then
tmp = i / n
else
tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0d0) - 1.0d0)
end if
code = 100.0d0 * ((exp((n * tmp)) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
double t_0 = 1.0 + (i / n);
double tmp;
if (t_0 == 1.0) {
tmp = i / n;
} else {
tmp = ((i / n) * Math.log(t_0)) / (((i / n) + 1.0) - 1.0);
}
return 100.0 * ((Math.exp((n * tmp)) - 1.0) / (i / n));
}
def code(i, n): t_0 = 1.0 + (i / n) tmp = 0 if t_0 == 1.0: tmp = i / n else: tmp = ((i / n) * math.log(t_0)) / (((i / n) + 1.0) - 1.0) return 100.0 * ((math.exp((n * tmp)) - 1.0) / (i / n))
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) tmp = 0.0 if (t_0 == 1.0) tmp = Float64(i / n); else tmp = Float64(Float64(Float64(i / n) * log(t_0)) / Float64(Float64(Float64(i / n) + 1.0) - 1.0)); end return Float64(100.0 * Float64(Float64(exp(Float64(n * tmp)) - 1.0) / Float64(i / n))) end
function tmp_2 = code(i, n) t_0 = 1.0 + (i / n); tmp = 0.0; if (t_0 == 1.0) tmp = i / n; else tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0) - 1.0); end tmp_2 = 100.0 * ((exp((n * tmp)) - 1.0) / (i / n)); end
code[i_, n_] := Block[{t$95$0 = N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision]}, N[(100.0 * N[(N[(N[Exp[N[(n * If[Equal[t$95$0, 1.0], N[(i / n), $MachinePrecision], N[(N[(N[(i / n), $MachinePrecision] * N[Log[t$95$0], $MachinePrecision]), $MachinePrecision] / N[(N[(N[(i / n), $MachinePrecision] + 1.0), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{i}{n}\\
100 \cdot \frac{e^{n \cdot \begin{array}{l}
\mathbf{if}\;t_0 = 1:\\
\;\;\;\;\frac{i}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{i}{n} \cdot \log t_0}{\left(\frac{i}{n} + 1\right) - 1}\\
\end{array}} - 1}{\frac{i}{n}}
\end{array}
\end{array}
herbie shell --seed 2023238
(FPCore (i n)
:name "Compound Interest"
:precision binary64
:herbie-target
(* 100.0 (/ (- (exp (* n (if (== (+ 1.0 (/ i n)) 1.0) (/ i n) (/ (* (/ i n) (log (+ 1.0 (/ i n)))) (- (+ (/ i n) 1.0) 1.0))))) 1.0) (/ i n)))
(* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))