
(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 19 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 -5e-84)
(* (/ 100.0 i) (- (/ t_0 (/ 1.0 n)) n))
(if (<= t_1 2e-281)
(* n (* 100.0 (/ (expm1 (* n (log1p (/ i n)))) i)))
(if (<= t_1 INFINITY)
(/ (+ -100.0 (* t_0 100.0)) (/ i n))
(* n 100.0))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= -5e-84) {
tmp = (100.0 / i) * ((t_0 / (1.0 / n)) - n);
} else if (t_1 <= 2e-281) {
tmp = n * (100.0 * (expm1((n * log1p((i / n)))) / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = (-100.0 + (t_0 * 100.0)) / (i / n);
} 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 <= -5e-84) {
tmp = (100.0 / i) * ((t_0 / (1.0 / n)) - n);
} else if (t_1 <= 2e-281) {
tmp = n * (100.0 * (Math.expm1((n * Math.log1p((i / n)))) / i));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = (-100.0 + (t_0 * 100.0)) / (i / n);
} 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 <= -5e-84: tmp = (100.0 / i) * ((t_0 / (1.0 / n)) - n) elif t_1 <= 2e-281: tmp = n * (100.0 * (math.expm1((n * math.log1p((i / n)))) / i)) elif t_1 <= math.inf: tmp = (-100.0 + (t_0 * 100.0)) / (i / n) else: tmp = n * 100.0 return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_1 <= -5e-84) tmp = Float64(Float64(100.0 / i) * Float64(Float64(t_0 / Float64(1.0 / n)) - n)); elseif (t_1 <= 2e-281) tmp = Float64(n * Float64(100.0 * Float64(expm1(Float64(n * log1p(Float64(i / n)))) / i))); elseif (t_1 <= Inf) tmp = Float64(Float64(-100.0 + Float64(t_0 * 100.0)) / Float64(i / n)); else tmp = Float64(n * 100.0); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-84], N[(N[(100.0 / i), $MachinePrecision] * N[(N[(t$95$0 / N[(1.0 / n), $MachinePrecision]), $MachinePrecision] - n), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-281], 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[(-100.0 + N[(t$95$0 * 100.0), $MachinePrecision]), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t\_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{-84}:\\
\;\;\;\;\frac{100}{i} \cdot \left(\frac{t\_0}{\frac{1}{n}} - n\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-281}:\\
\;\;\;\;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:\\
\;\;\;\;\frac{-100 + t\_0 \cdot 100}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -5.0000000000000002e-84Initial program 99.5%
associate-*r/99.7%
sub-neg99.7%
distribute-lft-in99.7%
metadata-eval99.7%
metadata-eval99.7%
Simplified99.7%
metadata-eval99.7%
metadata-eval99.7%
distribute-lft-in99.7%
sub-neg99.7%
div-inv99.8%
times-frac99.7%
add-exp-log99.7%
expm1-define99.7%
log-pow59.7%
log1p-define59.7%
Applied egg-rr59.7%
expm1-undefine59.7%
*-commutative59.7%
log1p-undefine59.7%
pow-to-exp99.7%
div-sub99.7%
+-commutative99.7%
remove-double-div99.8%
Applied egg-rr99.8%
if -5.0000000000000002e-84 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 2e-281Initial program 19.8%
associate-*r/19.7%
sub-neg19.7%
distribute-lft-in19.8%
metadata-eval19.8%
metadata-eval19.8%
Simplified19.8%
metadata-eval19.8%
metadata-eval19.8%
distribute-lft-in19.7%
sub-neg19.7%
associate-*r/19.8%
associate-/r/19.4%
associate-*r*19.4%
add-exp-log19.4%
expm1-define19.4%
log-pow33.5%
log1p-define98.6%
Applied egg-rr98.6%
if 2e-281 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 99.5%
associate-*r/99.8%
sub-neg99.8%
distribute-lft-in99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
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 70.6%
*-commutative70.6%
Simplified70.6%
Final simplification95.2%
(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 -2e-127)
(* (/ n i) (+ -100.0 (* t_0 100.0)))
(if (<= t_1 0.0)
(* n (* 100.0 (/ (expm1 i) i)))
(if (<= t_1 INFINITY)
(* (/ 100.0 i) (- (/ t_0 (/ 1.0 n)) n))
(* 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 <= -2e-127) {
tmp = (n / i) * (-100.0 + (t_0 * 100.0));
} else if (t_1 <= 0.0) {
tmp = n * (100.0 * (expm1(i) / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = (100.0 / i) * ((t_0 / (1.0 / n)) - n);
} 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 <= -2e-127) {
tmp = (n / i) * (-100.0 + (t_0 * 100.0));
} else if (t_1 <= 0.0) {
tmp = n * (100.0 * (Math.expm1(i) / i));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = (100.0 / i) * ((t_0 / (1.0 / n)) - n);
} 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 <= -2e-127: tmp = (n / i) * (-100.0 + (t_0 * 100.0)) elif t_1 <= 0.0: tmp = n * (100.0 * (math.expm1(i) / i)) elif t_1 <= math.inf: tmp = (100.0 / i) * ((t_0 / (1.0 / n)) - n) 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 <= -2e-127) tmp = Float64(Float64(n / i) * Float64(-100.0 + Float64(t_0 * 100.0))); elseif (t_1 <= 0.0) tmp = Float64(n * Float64(100.0 * Float64(expm1(i) / i))); elseif (t_1 <= Inf) tmp = Float64(Float64(100.0 / i) * Float64(Float64(t_0 / Float64(1.0 / n)) - n)); 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, -2e-127], N[(N[(n / i), $MachinePrecision] * N[(-100.0 + N[(t$95$0 * 100.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(n * N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(100.0 / i), $MachinePrecision] * N[(N[(t$95$0 / N[(1.0 / n), $MachinePrecision]), $MachinePrecision] - n), $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 -2 \cdot 10^{-127}:\\
\;\;\;\;\frac{n}{i} \cdot \left(-100 + t\_0 \cdot 100\right)\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{100}{i} \cdot \left(\frac{t\_0}{\frac{1}{n}} - n\right)\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -2.0000000000000001e-127Initial program 99.1%
associate-*r/99.1%
associate-/r/99.1%
associate-*l/99.5%
associate-/l*99.2%
sub-neg99.2%
distribute-lft-in99.4%
metadata-eval99.4%
metadata-eval99.4%
metadata-eval99.4%
fma-define99.2%
metadata-eval99.2%
Simplified99.2%
fma-define99.4%
*-commutative99.4%
Applied egg-rr99.4%
if -2.0000000000000001e-127 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -0.0Initial program 18.4%
associate-*r/18.4%
sub-neg18.4%
distribute-lft-in18.4%
metadata-eval18.4%
metadata-eval18.4%
Simplified18.4%
metadata-eval18.4%
metadata-eval18.4%
distribute-lft-in18.4%
sub-neg18.4%
associate-*r/18.4%
associate-/r/18.1%
associate-*r*18.1%
add-exp-log18.1%
expm1-define18.1%
log-pow32.1%
log1p-define98.6%
Applied egg-rr98.6%
Taylor expanded in n around inf 79.7%
if -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 96.8%
associate-*r/97.1%
sub-neg97.1%
distribute-lft-in97.1%
metadata-eval97.1%
metadata-eval97.1%
Simplified97.1%
metadata-eval97.1%
metadata-eval97.1%
distribute-lft-in97.1%
sub-neg97.1%
div-inv96.8%
times-frac97.1%
add-exp-log97.1%
expm1-define97.1%
log-pow51.9%
log1p-define51.9%
Applied egg-rr51.9%
expm1-undefine49.3%
*-commutative49.3%
log1p-undefine49.3%
pow-to-exp97.1%
div-sub97.1%
+-commutative97.1%
remove-double-div97.1%
Applied egg-rr97.1%
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 70.6%
*-commutative70.6%
Simplified70.6%
Final simplification81.3%
(FPCore (i n)
:precision binary64
(let* ((t_0 (/ (+ (pow (+ 1.0 (/ i n)) n) -1.0) (/ i n))) (t_1 (* t_0 100.0)))
(if (<= t_0 -2e-127)
t_1
(if (<= t_0 0.0)
(* n (* 100.0 (/ (expm1 i) i)))
(if (<= t_0 INFINITY) t_1 (* n 100.0))))))
double code(double i, double n) {
double t_0 = (pow((1.0 + (i / n)), n) + -1.0) / (i / n);
double t_1 = t_0 * 100.0;
double tmp;
if (t_0 <= -2e-127) {
tmp = t_1;
} else if (t_0 <= 0.0) {
tmp = n * (100.0 * (expm1(i) / i));
} else if (t_0 <= ((double) INFINITY)) {
tmp = t_1;
} 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) + -1.0) / (i / n);
double t_1 = t_0 * 100.0;
double tmp;
if (t_0 <= -2e-127) {
tmp = t_1;
} else if (t_0 <= 0.0) {
tmp = n * (100.0 * (Math.expm1(i) / i));
} else if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = n * 100.0;
}
return tmp;
}
def code(i, n): t_0 = (math.pow((1.0 + (i / n)), n) + -1.0) / (i / n) t_1 = t_0 * 100.0 tmp = 0 if t_0 <= -2e-127: tmp = t_1 elif t_0 <= 0.0: tmp = n * (100.0 * (math.expm1(i) / i)) elif t_0 <= math.inf: tmp = t_1 else: tmp = n * 100.0 return tmp
function code(i, n) t_0 = Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0) / Float64(i / n)) t_1 = Float64(t_0 * 100.0) tmp = 0.0 if (t_0 <= -2e-127) tmp = t_1; elseif (t_0 <= 0.0) tmp = Float64(n * Float64(100.0 * Float64(expm1(i) / i))); elseif (t_0 <= Inf) tmp = t_1; else tmp = Float64(n * 100.0); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * 100.0), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-127], t$95$1, If[LessEqual[t$95$0, 0.0], N[(n * N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], t$95$1, N[(n * 100.0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}}\\
t_1 := t\_0 \cdot 100\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-127}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -2.0000000000000001e-127 or -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 97.6%
if -2.0000000000000001e-127 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -0.0Initial program 18.4%
associate-*r/18.4%
sub-neg18.4%
distribute-lft-in18.4%
metadata-eval18.4%
metadata-eval18.4%
Simplified18.4%
metadata-eval18.4%
metadata-eval18.4%
distribute-lft-in18.4%
sub-neg18.4%
associate-*r/18.4%
associate-/r/18.1%
associate-*r*18.1%
add-exp-log18.1%
expm1-define18.1%
log-pow32.1%
log1p-define98.6%
Applied egg-rr98.6%
Taylor expanded in n around inf 79.7%
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 70.6%
*-commutative70.6%
Simplified70.6%
Final simplification81.2%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n))
(t_1 (/ (+ t_0 -1.0) (/ i n)))
(t_2 (* (/ n i) (+ -100.0 (* t_0 100.0)))))
(if (<= t_1 -2e-127)
t_2
(if (<= t_1 0.0)
(* n (* 100.0 (/ (expm1 i) i)))
(if (<= t_1 INFINITY) t_2 (* n 100.0))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double t_2 = (n / i) * (-100.0 + (t_0 * 100.0));
double tmp;
if (t_1 <= -2e-127) {
tmp = t_2;
} else if (t_1 <= 0.0) {
tmp = n * (100.0 * (expm1(i) / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_2;
} else {
tmp = n * 100.0;
}
return tmp;
}
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 t_2 = (n / i) * (-100.0 + (t_0 * 100.0));
double tmp;
if (t_1 <= -2e-127) {
tmp = t_2;
} else if (t_1 <= 0.0) {
tmp = n * (100.0 * (Math.expm1(i) / i));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_2;
} 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) t_2 = (n / i) * (-100.0 + (t_0 * 100.0)) tmp = 0 if t_1 <= -2e-127: tmp = t_2 elif t_1 <= 0.0: tmp = n * (100.0 * (math.expm1(i) / i)) elif t_1 <= math.inf: tmp = t_2 else: tmp = n * 100.0 return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) t_2 = Float64(Float64(n / i) * Float64(-100.0 + Float64(t_0 * 100.0))) tmp = 0.0 if (t_1 <= -2e-127) tmp = t_2; elseif (t_1 <= 0.0) tmp = Float64(n * Float64(100.0 * Float64(expm1(i) / i))); elseif (t_1 <= Inf) tmp = t_2; else tmp = Float64(n * 100.0); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(n / i), $MachinePrecision] * N[(-100.0 + N[(t$95$0 * 100.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-127], t$95$2, If[LessEqual[t$95$1, 0.0], N[(n * N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$2, N[(n * 100.0), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t\_0 + -1}{\frac{i}{n}}\\
t_2 := \frac{n}{i} \cdot \left(-100 + t\_0 \cdot 100\right)\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-127}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -2.0000000000000001e-127 or -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 97.6%
associate-*r/97.8%
associate-/r/97.8%
associate-*l/97.8%
associate-/l*97.7%
sub-neg97.7%
distribute-lft-in97.8%
metadata-eval97.8%
metadata-eval97.8%
metadata-eval97.8%
fma-define97.7%
metadata-eval97.7%
Simplified97.7%
fma-define97.8%
*-commutative97.8%
Applied egg-rr97.8%
if -2.0000000000000001e-127 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -0.0Initial program 18.4%
associate-*r/18.4%
sub-neg18.4%
distribute-lft-in18.4%
metadata-eval18.4%
metadata-eval18.4%
Simplified18.4%
metadata-eval18.4%
metadata-eval18.4%
distribute-lft-in18.4%
sub-neg18.4%
associate-*r/18.4%
associate-/r/18.1%
associate-*r*18.1%
add-exp-log18.1%
expm1-define18.1%
log-pow32.1%
log1p-define98.6%
Applied egg-rr98.6%
Taylor expanded in n around inf 79.7%
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 70.6%
*-commutative70.6%
Simplified70.6%
Final simplification81.2%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n))
(t_1 (+ -100.0 (* t_0 100.0)))
(t_2 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_2 -2e-127)
(* (/ n i) t_1)
(if (<= t_2 0.0)
(* n (* 100.0 (/ (expm1 i) i)))
(if (<= t_2 INFINITY) (/ t_1 (/ i n)) (* n 100.0))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = -100.0 + (t_0 * 100.0);
double t_2 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_2 <= -2e-127) {
tmp = (n / i) * t_1;
} else if (t_2 <= 0.0) {
tmp = n * (100.0 * (expm1(i) / i));
} else if (t_2 <= ((double) INFINITY)) {
tmp = t_1 / (i / n);
} 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 = -100.0 + (t_0 * 100.0);
double t_2 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_2 <= -2e-127) {
tmp = (n / i) * t_1;
} else if (t_2 <= 0.0) {
tmp = n * (100.0 * (Math.expm1(i) / i));
} else if (t_2 <= Double.POSITIVE_INFINITY) {
tmp = t_1 / (i / n);
} else {
tmp = n * 100.0;
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = -100.0 + (t_0 * 100.0) t_2 = (t_0 + -1.0) / (i / n) tmp = 0 if t_2 <= -2e-127: tmp = (n / i) * t_1 elif t_2 <= 0.0: tmp = n * (100.0 * (math.expm1(i) / i)) elif t_2 <= math.inf: tmp = t_1 / (i / n) else: tmp = n * 100.0 return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(-100.0 + Float64(t_0 * 100.0)) t_2 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_2 <= -2e-127) tmp = Float64(Float64(n / i) * t_1); elseif (t_2 <= 0.0) tmp = Float64(n * Float64(100.0 * Float64(expm1(i) / i))); elseif (t_2 <= Inf) tmp = Float64(t_1 / Float64(i / n)); 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[(-100.0 + N[(t$95$0 * 100.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e-127], N[(N[(n / i), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[t$95$2, 0.0], N[(n * N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[(t$95$1 / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := -100 + t\_0 \cdot 100\\
t_2 := \frac{t\_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{-127}:\\
\;\;\;\;\frac{n}{i} \cdot t\_1\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;\frac{t\_1}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -2.0000000000000001e-127Initial program 99.1%
associate-*r/99.1%
associate-/r/99.1%
associate-*l/99.5%
associate-/l*99.2%
sub-neg99.2%
distribute-lft-in99.4%
metadata-eval99.4%
metadata-eval99.4%
metadata-eval99.4%
fma-define99.2%
metadata-eval99.2%
Simplified99.2%
fma-define99.4%
*-commutative99.4%
Applied egg-rr99.4%
if -2.0000000000000001e-127 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -0.0Initial program 18.4%
associate-*r/18.4%
sub-neg18.4%
distribute-lft-in18.4%
metadata-eval18.4%
metadata-eval18.4%
Simplified18.4%
metadata-eval18.4%
metadata-eval18.4%
distribute-lft-in18.4%
sub-neg18.4%
associate-*r/18.4%
associate-/r/18.1%
associate-*r*18.1%
add-exp-log18.1%
expm1-define18.1%
log-pow32.1%
log1p-define98.6%
Applied egg-rr98.6%
Taylor expanded in n around inf 79.7%
if -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 96.8%
associate-*r/97.1%
sub-neg97.1%
distribute-lft-in97.1%
metadata-eval97.1%
metadata-eval97.1%
Simplified97.1%
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 70.6%
*-commutative70.6%
Simplified70.6%
Final simplification81.3%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 -5e-84)
(* (/ 100.0 i) (- (/ t_0 (/ 1.0 n)) n))
(if (<= t_1 2e-281)
(* (expm1 (* n (log1p (/ i n)))) (* 100.0 (/ n i)))
(if (<= t_1 INFINITY)
(/ (+ -100.0 (* t_0 100.0)) (/ i n))
(* n 100.0))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= -5e-84) {
tmp = (100.0 / i) * ((t_0 / (1.0 / n)) - n);
} else if (t_1 <= 2e-281) {
tmp = expm1((n * log1p((i / n)))) * (100.0 * (n / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = (-100.0 + (t_0 * 100.0)) / (i / n);
} 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 <= -5e-84) {
tmp = (100.0 / i) * ((t_0 / (1.0 / n)) - n);
} else if (t_1 <= 2e-281) {
tmp = Math.expm1((n * Math.log1p((i / n)))) * (100.0 * (n / i));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = (-100.0 + (t_0 * 100.0)) / (i / n);
} 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 <= -5e-84: tmp = (100.0 / i) * ((t_0 / (1.0 / n)) - n) elif t_1 <= 2e-281: tmp = math.expm1((n * math.log1p((i / n)))) * (100.0 * (n / i)) elif t_1 <= math.inf: tmp = (-100.0 + (t_0 * 100.0)) / (i / n) else: tmp = n * 100.0 return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_1 <= -5e-84) tmp = Float64(Float64(100.0 / i) * Float64(Float64(t_0 / Float64(1.0 / n)) - n)); elseif (t_1 <= 2e-281) tmp = Float64(expm1(Float64(n * log1p(Float64(i / n)))) * Float64(100.0 * Float64(n / i))); elseif (t_1 <= Inf) tmp = Float64(Float64(-100.0 + Float64(t_0 * 100.0)) / Float64(i / n)); else tmp = Float64(n * 100.0); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-84], N[(N[(100.0 / i), $MachinePrecision] * N[(N[(t$95$0 / N[(1.0 / n), $MachinePrecision]), $MachinePrecision] - n), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-281], N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] * N[(100.0 * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(-100.0 + N[(t$95$0 * 100.0), $MachinePrecision]), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t\_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{-84}:\\
\;\;\;\;\frac{100}{i} \cdot \left(\frac{t\_0}{\frac{1}{n}} - n\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-281}:\\
\;\;\;\;\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot \left(100 \cdot \frac{n}{i}\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{-100 + t\_0 \cdot 100}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -5.0000000000000002e-84Initial program 99.5%
associate-*r/99.7%
sub-neg99.7%
distribute-lft-in99.7%
metadata-eval99.7%
metadata-eval99.7%
Simplified99.7%
metadata-eval99.7%
metadata-eval99.7%
distribute-lft-in99.7%
sub-neg99.7%
div-inv99.8%
times-frac99.7%
add-exp-log99.7%
expm1-define99.7%
log-pow59.7%
log1p-define59.7%
Applied egg-rr59.7%
expm1-undefine59.7%
*-commutative59.7%
log1p-undefine59.7%
pow-to-exp99.7%
div-sub99.7%
+-commutative99.7%
remove-double-div99.8%
Applied egg-rr99.8%
if -5.0000000000000002e-84 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 2e-281Initial program 19.8%
associate-*r/19.7%
sub-neg19.7%
distribute-lft-in19.8%
metadata-eval19.8%
metadata-eval19.8%
Simplified19.8%
metadata-eval19.8%
metadata-eval19.8%
distribute-lft-in19.7%
sub-neg19.7%
associate-*r/19.8%
*-commutative19.8%
div-inv19.7%
clear-num19.4%
associate-*l*19.4%
add-exp-log19.4%
expm1-define19.4%
log-pow33.6%
log1p-define97.7%
Applied egg-rr97.7%
if 2e-281 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 99.5%
associate-*r/99.8%
sub-neg99.8%
distribute-lft-in99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
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 70.6%
*-commutative70.6%
Simplified70.6%
Final simplification94.6%
(FPCore (i n)
:precision binary64
(let* ((t_0 (/ (expm1 i) i)))
(if (<= n -3.7e-287)
(* 100.0 (* n t_0))
(if (<= n 1.1e-246)
(* n (/ (* 100.0 (* n (log (/ i n)))) i))
(if (<= n 1.95e-26) (* 100.0 (/ i (/ i n))) (* n (* 100.0 t_0)))))))
double code(double i, double n) {
double t_0 = expm1(i) / i;
double tmp;
if (n <= -3.7e-287) {
tmp = 100.0 * (n * t_0);
} else if (n <= 1.1e-246) {
tmp = n * ((100.0 * (n * log((i / n)))) / i);
} else if (n <= 1.95e-26) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = n * (100.0 * t_0);
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.expm1(i) / i;
double tmp;
if (n <= -3.7e-287) {
tmp = 100.0 * (n * t_0);
} else if (n <= 1.1e-246) {
tmp = n * ((100.0 * (n * Math.log((i / n)))) / i);
} else if (n <= 1.95e-26) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = n * (100.0 * t_0);
}
return tmp;
}
def code(i, n): t_0 = math.expm1(i) / i tmp = 0 if n <= -3.7e-287: tmp = 100.0 * (n * t_0) elif n <= 1.1e-246: tmp = n * ((100.0 * (n * math.log((i / n)))) / i) elif n <= 1.95e-26: tmp = 100.0 * (i / (i / n)) else: tmp = n * (100.0 * t_0) return tmp
function code(i, n) t_0 = Float64(expm1(i) / i) tmp = 0.0 if (n <= -3.7e-287) tmp = Float64(100.0 * Float64(n * t_0)); elseif (n <= 1.1e-246) tmp = Float64(n * Float64(Float64(100.0 * Float64(n * log(Float64(i / n)))) / i)); elseif (n <= 1.95e-26) tmp = Float64(100.0 * Float64(i / Float64(i / n))); else tmp = Float64(n * Float64(100.0 * t_0)); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]}, If[LessEqual[n, -3.7e-287], N[(100.0 * N[(n * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.1e-246], N[(n * N[(N[(100.0 * N[(n * N[Log[N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.95e-26], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 * t$95$0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{expm1}\left(i\right)}{i}\\
\mathbf{if}\;n \leq -3.7 \cdot 10^{-287}:\\
\;\;\;\;100 \cdot \left(n \cdot t\_0\right)\\
\mathbf{elif}\;n \leq 1.1 \cdot 10^{-246}:\\
\;\;\;\;n \cdot \frac{100 \cdot \left(n \cdot \log \left(\frac{i}{n}\right)\right)}{i}\\
\mathbf{elif}\;n \leq 1.95 \cdot 10^{-26}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 \cdot t\_0\right)\\
\end{array}
\end{array}
if n < -3.70000000000000027e-287Initial program 38.7%
Taylor expanded in n around inf 32.9%
*-commutative32.9%
associate-/l*32.9%
expm1-define72.3%
Simplified72.3%
if -3.70000000000000027e-287 < n < 1.09999999999999999e-246Initial program 38.7%
associate-*r/38.7%
sub-neg38.7%
distribute-lft-in38.7%
metadata-eval38.7%
metadata-eval38.7%
Simplified38.7%
associate-/r/39.0%
metadata-eval39.0%
metadata-eval39.0%
distribute-lft-in39.0%
sub-neg39.0%
*-commutative39.0%
add-exp-log39.0%
expm1-define39.0%
log-pow82.0%
log1p-define83.3%
Applied egg-rr83.3%
Taylor expanded in n around 0 65.1%
associate-*r/65.1%
mul-1-neg65.1%
unsub-neg65.1%
log-div69.4%
Simplified69.4%
if 1.09999999999999999e-246 < n < 1.94999999999999993e-26Initial program 10.8%
Taylor expanded in i around 0 76.2%
if 1.94999999999999993e-26 < n Initial program 20.4%
associate-*r/20.4%
sub-neg20.4%
distribute-lft-in20.4%
metadata-eval20.4%
metadata-eval20.4%
Simplified20.4%
metadata-eval20.4%
metadata-eval20.4%
distribute-lft-in20.4%
sub-neg20.4%
associate-*r/20.4%
associate-/r/20.6%
associate-*r*20.6%
add-exp-log20.6%
expm1-define20.6%
log-pow16.8%
log1p-define82.3%
Applied egg-rr82.3%
Taylor expanded in n around inf 94.2%
Final simplification80.3%
(FPCore (i n) :precision binary64 (if (or (<= i -8.2e+78) (not (<= i 1e+87))) (* (/ n i) (+ -100.0 (* 100.0 (pow (/ i n) n)))) (* n (* 100.0 (/ (expm1 i) i)))))
double code(double i, double n) {
double tmp;
if ((i <= -8.2e+78) || !(i <= 1e+87)) {
tmp = (n / i) * (-100.0 + (100.0 * pow((i / n), n)));
} else {
tmp = n * (100.0 * (expm1(i) / i));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((i <= -8.2e+78) || !(i <= 1e+87)) {
tmp = (n / i) * (-100.0 + (100.0 * Math.pow((i / n), n)));
} else {
tmp = n * (100.0 * (Math.expm1(i) / i));
}
return tmp;
}
def code(i, n): tmp = 0 if (i <= -8.2e+78) or not (i <= 1e+87): tmp = (n / i) * (-100.0 + (100.0 * math.pow((i / n), n))) else: tmp = n * (100.0 * (math.expm1(i) / i)) return tmp
function code(i, n) tmp = 0.0 if ((i <= -8.2e+78) || !(i <= 1e+87)) tmp = Float64(Float64(n / i) * Float64(-100.0 + Float64(100.0 * (Float64(i / n) ^ n)))); else tmp = Float64(n * Float64(100.0 * Float64(expm1(i) / i))); end return tmp end
code[i_, n_] := If[Or[LessEqual[i, -8.2e+78], N[Not[LessEqual[i, 1e+87]], $MachinePrecision]], N[(N[(n / i), $MachinePrecision] * N[(-100.0 + N[(100.0 * N[Power[N[(i / n), $MachinePrecision], n], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -8.2 \cdot 10^{+78} \lor \neg \left(i \leq 10^{+87}\right):\\
\;\;\;\;\frac{n}{i} \cdot \left(-100 + 100 \cdot {\left(\frac{i}{n}\right)}^{n}\right)\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\end{array}
\end{array}
if i < -8.1999999999999994e78 or 9.9999999999999996e86 < i Initial program 61.6%
associate-*r/61.6%
associate-/r/61.0%
associate-*l/61.0%
associate-/l*60.8%
sub-neg60.8%
distribute-lft-in60.9%
metadata-eval60.9%
metadata-eval60.9%
metadata-eval60.9%
fma-define60.8%
metadata-eval60.8%
Simplified60.8%
fma-define60.9%
*-commutative60.9%
Applied egg-rr60.9%
Taylor expanded in i around inf 70.9%
if -8.1999999999999994e78 < i < 9.9999999999999996e86Initial program 10.8%
associate-*r/10.8%
sub-neg10.8%
distribute-lft-in10.8%
metadata-eval10.8%
metadata-eval10.8%
Simplified10.8%
metadata-eval10.8%
metadata-eval10.8%
distribute-lft-in10.8%
sub-neg10.8%
associate-*r/10.8%
associate-/r/11.1%
associate-*r*11.1%
add-exp-log11.1%
expm1-define11.1%
log-pow22.7%
log1p-define85.0%
Applied egg-rr85.0%
Taylor expanded in n around inf 83.1%
Final simplification79.0%
(FPCore (i n) :precision binary64 (if (or (<= i -1.55e+79) (not (<= i 5.6e+86))) (/ (+ -100.0 (* 100.0 (pow (/ i n) n))) (/ i n)) (* n (* 100.0 (/ (expm1 i) i)))))
double code(double i, double n) {
double tmp;
if ((i <= -1.55e+79) || !(i <= 5.6e+86)) {
tmp = (-100.0 + (100.0 * pow((i / n), n))) / (i / n);
} else {
tmp = n * (100.0 * (expm1(i) / i));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((i <= -1.55e+79) || !(i <= 5.6e+86)) {
tmp = (-100.0 + (100.0 * Math.pow((i / n), n))) / (i / n);
} else {
tmp = n * (100.0 * (Math.expm1(i) / i));
}
return tmp;
}
def code(i, n): tmp = 0 if (i <= -1.55e+79) or not (i <= 5.6e+86): tmp = (-100.0 + (100.0 * math.pow((i / n), n))) / (i / n) else: tmp = n * (100.0 * (math.expm1(i) / i)) return tmp
function code(i, n) tmp = 0.0 if ((i <= -1.55e+79) || !(i <= 5.6e+86)) tmp = Float64(Float64(-100.0 + Float64(100.0 * (Float64(i / n) ^ n))) / Float64(i / n)); else tmp = Float64(n * Float64(100.0 * Float64(expm1(i) / i))); end return tmp end
code[i_, n_] := If[Or[LessEqual[i, -1.55e+79], N[Not[LessEqual[i, 5.6e+86]], $MachinePrecision]], N[(N[(-100.0 + N[(100.0 * N[Power[N[(i / n), $MachinePrecision], n], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -1.55 \cdot 10^{+79} \lor \neg \left(i \leq 5.6 \cdot 10^{+86}\right):\\
\;\;\;\;\frac{-100 + 100 \cdot {\left(\frac{i}{n}\right)}^{n}}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\end{array}
\end{array}
if i < -1.5499999999999999e79 or 5.60000000000000008e86 < i Initial program 61.6%
associate-*r/61.6%
sub-neg61.6%
distribute-lft-in61.7%
metadata-eval61.7%
metadata-eval61.7%
Simplified61.7%
Taylor expanded in i around inf 71.7%
if -1.5499999999999999e79 < i < 5.60000000000000008e86Initial program 10.8%
associate-*r/10.8%
sub-neg10.8%
distribute-lft-in10.8%
metadata-eval10.8%
metadata-eval10.8%
Simplified10.8%
metadata-eval10.8%
metadata-eval10.8%
distribute-lft-in10.8%
sub-neg10.8%
associate-*r/10.8%
associate-/r/11.1%
associate-*r*11.1%
add-exp-log11.1%
expm1-define11.1%
log-pow22.7%
log1p-define85.0%
Applied egg-rr85.0%
Taylor expanded in n around inf 83.1%
Final simplification79.2%
(FPCore (i n) :precision binary64 (if (or (<= i -7.4e-66) (not (<= i 4.3e-196))) (* 100.0 (/ (expm1 i) (/ i n))) (* n (+ 100.0 (* (* i 100.0) (- 0.5 (/ 0.5 n)))))))
double code(double i, double n) {
double tmp;
if ((i <= -7.4e-66) || !(i <= 4.3e-196)) {
tmp = 100.0 * (expm1(i) / (i / n));
} else {
tmp = n * (100.0 + ((i * 100.0) * (0.5 - (0.5 / n))));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((i <= -7.4e-66) || !(i <= 4.3e-196)) {
tmp = 100.0 * (Math.expm1(i) / (i / n));
} else {
tmp = n * (100.0 + ((i * 100.0) * (0.5 - (0.5 / n))));
}
return tmp;
}
def code(i, n): tmp = 0 if (i <= -7.4e-66) or not (i <= 4.3e-196): tmp = 100.0 * (math.expm1(i) / (i / n)) else: tmp = n * (100.0 + ((i * 100.0) * (0.5 - (0.5 / n)))) return tmp
function code(i, n) tmp = 0.0 if ((i <= -7.4e-66) || !(i <= 4.3e-196)) tmp = Float64(100.0 * Float64(expm1(i) / Float64(i / n))); else tmp = Float64(n * Float64(100.0 + Float64(Float64(i * 100.0) * Float64(0.5 - Float64(0.5 / n))))); end return tmp end
code[i_, n_] := If[Or[LessEqual[i, -7.4e-66], N[Not[LessEqual[i, 4.3e-196]], $MachinePrecision]], N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(N[(i * 100.0), $MachinePrecision] * N[(0.5 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -7.4 \cdot 10^{-66} \lor \neg \left(i \leq 4.3 \cdot 10^{-196}\right):\\
\;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + \left(i \cdot 100\right) \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\\
\end{array}
\end{array}
if i < -7.4000000000000004e-66 or 4.29999999999999979e-196 < i Initial program 39.8%
Taylor expanded in n around inf 48.2%
expm1-define68.1%
Simplified68.1%
if -7.4000000000000004e-66 < i < 4.29999999999999979e-196Initial program 4.7%
associate-*r/4.7%
sub-neg4.7%
distribute-lft-in4.7%
metadata-eval4.7%
metadata-eval4.7%
Simplified4.7%
metadata-eval4.7%
metadata-eval4.7%
distribute-lft-in4.7%
sub-neg4.7%
associate-*r/4.7%
associate-/r/5.2%
associate-*r*5.2%
add-exp-log5.2%
expm1-define5.2%
log-pow17.4%
log1p-define73.2%
Applied egg-rr73.2%
Taylor expanded in i around 0 87.8%
associate-*r*87.8%
*-commutative87.8%
associate-*r/87.8%
metadata-eval87.8%
Simplified87.8%
Final simplification74.8%
(FPCore (i n) :precision binary64 (if (or (<= n -3.1e-158) (not (<= n 3.5e-25))) (* n (* 100.0 (/ (expm1 i) i))) (* 100.0 (/ i (/ i n)))))
double code(double i, double n) {
double tmp;
if ((n <= -3.1e-158) || !(n <= 3.5e-25)) {
tmp = n * (100.0 * (expm1(i) / i));
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((n <= -3.1e-158) || !(n <= 3.5e-25)) {
tmp = n * (100.0 * (Math.expm1(i) / i));
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -3.1e-158) or not (n <= 3.5e-25): tmp = n * (100.0 * (math.expm1(i) / i)) else: tmp = 100.0 * (i / (i / n)) return tmp
function code(i, n) tmp = 0.0 if ((n <= -3.1e-158) || !(n <= 3.5e-25)) tmp = Float64(n * Float64(100.0 * Float64(expm1(i) / i))); else tmp = Float64(100.0 * Float64(i / Float64(i / n))); end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -3.1e-158], N[Not[LessEqual[n, 3.5e-25]], $MachinePrecision]], N[(n * N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -3.1 \cdot 10^{-158} \lor \neg \left(n \leq 3.5 \cdot 10^{-25}\right):\\
\;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -3.10000000000000018e-158 or 3.5000000000000002e-25 < n Initial program 27.1%
associate-*r/27.2%
sub-neg27.2%
distribute-lft-in27.2%
metadata-eval27.2%
metadata-eval27.2%
Simplified27.2%
metadata-eval27.2%
metadata-eval27.2%
distribute-lft-in27.2%
sub-neg27.2%
associate-*r/27.1%
associate-/r/27.4%
associate-*r*27.3%
add-exp-log27.3%
expm1-define27.3%
log-pow24.6%
log1p-define78.4%
Applied egg-rr78.4%
Taylor expanded in n around inf 82.6%
if -3.10000000000000018e-158 < n < 3.5000000000000002e-25Initial program 29.7%
Taylor expanded in i around 0 68.6%
Final simplification78.6%
(FPCore (i n)
:precision binary64
(if (<= n -8e+122)
(* (/ 100.0 i) (* i n))
(if (<= n 1.08e-27)
(* 100.0 (/ i (/ i n)))
(fabs (* n (+ 100.0 (* i 50.0)))))))
double code(double i, double n) {
double tmp;
if (n <= -8e+122) {
tmp = (100.0 / i) * (i * n);
} else if (n <= 1.08e-27) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = fabs((n * (100.0 + (i * 50.0))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-8d+122)) then
tmp = (100.0d0 / i) * (i * n)
else if (n <= 1.08d-27) then
tmp = 100.0d0 * (i / (i / n))
else
tmp = abs((n * (100.0d0 + (i * 50.0d0))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -8e+122) {
tmp = (100.0 / i) * (i * n);
} else if (n <= 1.08e-27) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = Math.abs((n * (100.0 + (i * 50.0))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -8e+122: tmp = (100.0 / i) * (i * n) elif n <= 1.08e-27: tmp = 100.0 * (i / (i / n)) else: tmp = math.fabs((n * (100.0 + (i * 50.0)))) return tmp
function code(i, n) tmp = 0.0 if (n <= -8e+122) tmp = Float64(Float64(100.0 / i) * Float64(i * n)); elseif (n <= 1.08e-27) tmp = Float64(100.0 * Float64(i / Float64(i / n))); else tmp = abs(Float64(n * Float64(100.0 + Float64(i * 50.0)))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -8e+122) tmp = (100.0 / i) * (i * n); elseif (n <= 1.08e-27) tmp = 100.0 * (i / (i / n)); else tmp = abs((n * (100.0 + (i * 50.0)))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -8e+122], N[(N[(100.0 / i), $MachinePrecision] * N[(i * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.08e-27], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Abs[N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -8 \cdot 10^{+122}:\\
\;\;\;\;\frac{100}{i} \cdot \left(i \cdot n\right)\\
\mathbf{elif}\;n \leq 1.08 \cdot 10^{-27}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;\left|n \cdot \left(100 + i \cdot 50\right)\right|\\
\end{array}
\end{array}
if n < -8.00000000000000012e122Initial program 21.9%
associate-*r/22.0%
sub-neg22.0%
distribute-lft-in22.0%
metadata-eval22.0%
metadata-eval22.0%
Simplified22.0%
metadata-eval22.0%
metadata-eval22.0%
distribute-lft-in22.0%
sub-neg22.0%
div-inv21.9%
times-frac22.6%
add-exp-log22.6%
expm1-define22.6%
log-pow13.6%
log1p-define55.0%
Applied egg-rr55.0%
Taylor expanded in i around 0 61.9%
if -8.00000000000000012e122 < n < 1.08e-27Initial program 34.1%
Taylor expanded in i around 0 61.1%
if 1.08e-27 < n Initial program 20.4%
Taylor expanded in i around 0 65.6%
associate-*r/65.6%
metadata-eval65.6%
Simplified65.6%
Taylor expanded in n around inf 65.6%
associate-*r*65.6%
*-commutative65.6%
*-commutative65.6%
Simplified65.6%
add-sqr-sqrt64.8%
sqrt-unprod61.7%
pow261.7%
+-commutative61.7%
fma-define61.7%
Applied egg-rr61.7%
unpow261.7%
rem-sqrt-square66.0%
associate-*l*66.0%
fma-undefine66.0%
*-commutative66.0%
+-commutative66.0%
distribute-lft-in66.0%
metadata-eval66.0%
*-commutative66.0%
associate-*r*66.0%
*-commutative66.0%
associate-*l*66.0%
metadata-eval66.0%
Simplified66.0%
Final simplification62.9%
(FPCore (i n)
:precision binary64
(let* ((t_0 (/ (expm1 i) i)))
(if (<= n -2.7e-163)
(* 100.0 (* n t_0))
(if (<= n 3.5e-25) (* 100.0 (/ i (/ i n))) (* n (* 100.0 t_0))))))
double code(double i, double n) {
double t_0 = expm1(i) / i;
double tmp;
if (n <= -2.7e-163) {
tmp = 100.0 * (n * t_0);
} else if (n <= 3.5e-25) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = n * (100.0 * t_0);
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.expm1(i) / i;
double tmp;
if (n <= -2.7e-163) {
tmp = 100.0 * (n * t_0);
} else if (n <= 3.5e-25) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = n * (100.0 * t_0);
}
return tmp;
}
def code(i, n): t_0 = math.expm1(i) / i tmp = 0 if n <= -2.7e-163: tmp = 100.0 * (n * t_0) elif n <= 3.5e-25: tmp = 100.0 * (i / (i / n)) else: tmp = n * (100.0 * t_0) return tmp
function code(i, n) t_0 = Float64(expm1(i) / i) tmp = 0.0 if (n <= -2.7e-163) tmp = Float64(100.0 * Float64(n * t_0)); elseif (n <= 3.5e-25) tmp = Float64(100.0 * Float64(i / Float64(i / n))); else tmp = Float64(n * Float64(100.0 * t_0)); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]}, If[LessEqual[n, -2.7e-163], N[(100.0 * N[(n * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 3.5e-25], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 * t$95$0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{expm1}\left(i\right)}{i}\\
\mathbf{if}\;n \leq -2.7 \cdot 10^{-163}:\\
\;\;\;\;100 \cdot \left(n \cdot t\_0\right)\\
\mathbf{elif}\;n \leq 3.5 \cdot 10^{-25}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 \cdot t\_0\right)\\
\end{array}
\end{array}
if n < -2.70000000000000015e-163Initial program 33.3%
Taylor expanded in n around inf 28.1%
*-commutative28.1%
associate-/l*28.1%
expm1-define72.0%
Simplified72.0%
if -2.70000000000000015e-163 < n < 3.5000000000000002e-25Initial program 29.7%
Taylor expanded in i around 0 68.6%
if 3.5000000000000002e-25 < n Initial program 20.4%
associate-*r/20.4%
sub-neg20.4%
distribute-lft-in20.4%
metadata-eval20.4%
metadata-eval20.4%
Simplified20.4%
metadata-eval20.4%
metadata-eval20.4%
distribute-lft-in20.4%
sub-neg20.4%
associate-*r/20.4%
associate-/r/20.6%
associate-*r*20.6%
add-exp-log20.6%
expm1-define20.6%
log-pow16.8%
log1p-define82.3%
Applied egg-rr82.3%
Taylor expanded in n around inf 94.2%
Final simplification78.6%
(FPCore (i n) :precision binary64 (if (or (<= n -8e+122) (not (<= n 3.5e-25))) (* n (+ 100.0 (* i 50.0))) (* 100.0 (/ i (/ i n)))))
double code(double i, double n) {
double tmp;
if ((n <= -8e+122) || !(n <= 3.5e-25)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-8d+122)) .or. (.not. (n <= 3.5d-25))) then
tmp = n * (100.0d0 + (i * 50.0d0))
else
tmp = 100.0d0 * (i / (i / n))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -8e+122) || !(n <= 3.5e-25)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -8e+122) or not (n <= 3.5e-25): tmp = n * (100.0 + (i * 50.0)) else: tmp = 100.0 * (i / (i / n)) return tmp
function code(i, n) tmp = 0.0 if ((n <= -8e+122) || !(n <= 3.5e-25)) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); else tmp = Float64(100.0 * Float64(i / Float64(i / n))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -8e+122) || ~((n <= 3.5e-25))) tmp = n * (100.0 + (i * 50.0)); else tmp = 100.0 * (i / (i / n)); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -8e+122], N[Not[LessEqual[n, 3.5e-25]], $MachinePrecision]], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -8 \cdot 10^{+122} \lor \neg \left(n \leq 3.5 \cdot 10^{-25}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -8.00000000000000012e122 or 3.5000000000000002e-25 < n Initial program 20.8%
Taylor expanded in i around 0 64.4%
associate-*r/64.4%
metadata-eval64.4%
Simplified64.4%
Taylor expanded in n around inf 64.4%
associate-*r*64.4%
*-commutative64.4%
*-commutative64.4%
Simplified64.4%
Taylor expanded in n around 0 64.4%
associate-*r*64.4%
*-commutative64.4%
distribute-lft-in64.4%
*-rgt-identity64.4%
*-commutative64.4%
associate-*r*64.4%
distribute-lft-out64.4%
associate-*r*64.4%
*-commutative64.4%
associate-*l*64.4%
metadata-eval64.4%
Simplified64.4%
if -8.00000000000000012e122 < n < 3.5000000000000002e-25Initial program 34.1%
Taylor expanded in i around 0 61.1%
Final simplification62.6%
(FPCore (i n) :precision binary64 (if (or (<= n -8.5e+122) (not (<= n 3e-30))) (* (/ 100.0 i) (* i n)) (* 100.0 (/ i (/ i n)))))
double code(double i, double n) {
double tmp;
if ((n <= -8.5e+122) || !(n <= 3e-30)) {
tmp = (100.0 / i) * (i * n);
} 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 <= (-8.5d+122)) .or. (.not. (n <= 3d-30))) then
tmp = (100.0d0 / i) * (i * n)
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 <= -8.5e+122) || !(n <= 3e-30)) {
tmp = (100.0 / i) * (i * n);
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -8.5e+122) or not (n <= 3e-30): tmp = (100.0 / i) * (i * n) else: tmp = 100.0 * (i / (i / n)) return tmp
function code(i, n) tmp = 0.0 if ((n <= -8.5e+122) || !(n <= 3e-30)) tmp = Float64(Float64(100.0 / i) * Float64(i * n)); 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 <= -8.5e+122) || ~((n <= 3e-30))) tmp = (100.0 / i) * (i * n); else tmp = 100.0 * (i / (i / n)); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -8.5e+122], N[Not[LessEqual[n, 3e-30]], $MachinePrecision]], N[(N[(100.0 / i), $MachinePrecision] * N[(i * n), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -8.5 \cdot 10^{+122} \lor \neg \left(n \leq 3 \cdot 10^{-30}\right):\\
\;\;\;\;\frac{100}{i} \cdot \left(i \cdot n\right)\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -8.50000000000000003e122 or 2.9999999999999999e-30 < n Initial program 20.7%
associate-*r/20.7%
sub-neg20.7%
distribute-lft-in20.7%
metadata-eval20.7%
metadata-eval20.7%
Simplified20.7%
metadata-eval20.7%
metadata-eval20.7%
distribute-lft-in20.7%
sub-neg20.7%
div-inv20.7%
times-frac21.0%
add-exp-log21.0%
expm1-define21.0%
log-pow16.6%
log1p-define74.9%
Applied egg-rr74.9%
Taylor expanded in i around 0 64.1%
if -8.50000000000000003e122 < n < 2.9999999999999999e-30Initial program 34.3%
Taylor expanded in i around 0 61.5%
Final simplification62.7%
(FPCore (i n) :precision binary64 (if (<= i -8.8e-66) (* 100.0 (/ i (/ i n))) (if (<= i 0.8) (* 100.0 (+ n (* i -0.5))) (* 50.0 (* i n)))))
double code(double i, double n) {
double tmp;
if (i <= -8.8e-66) {
tmp = 100.0 * (i / (i / n));
} else if (i <= 0.8) {
tmp = 100.0 * (n + (i * -0.5));
} 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 <= (-8.8d-66)) then
tmp = 100.0d0 * (i / (i / n))
else if (i <= 0.8d0) then
tmp = 100.0d0 * (n + (i * (-0.5d0)))
else
tmp = 50.0d0 * (i * n)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= -8.8e-66) {
tmp = 100.0 * (i / (i / n));
} else if (i <= 0.8) {
tmp = 100.0 * (n + (i * -0.5));
} else {
tmp = 50.0 * (i * n);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -8.8e-66: tmp = 100.0 * (i / (i / n)) elif i <= 0.8: tmp = 100.0 * (n + (i * -0.5)) else: tmp = 50.0 * (i * n) return tmp
function code(i, n) tmp = 0.0 if (i <= -8.8e-66) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (i <= 0.8) tmp = Float64(100.0 * Float64(n + Float64(i * -0.5))); else tmp = Float64(50.0 * Float64(i * n)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -8.8e-66) tmp = 100.0 * (i / (i / n)); elseif (i <= 0.8) tmp = 100.0 * (n + (i * -0.5)); else tmp = 50.0 * (i * n); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -8.8e-66], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 0.8], N[(100.0 * N[(n + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -8.8 \cdot 10^{-66}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;i \leq 0.8:\\
\;\;\;\;100 \cdot \left(n + i \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;50 \cdot \left(i \cdot n\right)\\
\end{array}
\end{array}
if i < -8.8000000000000004e-66Initial program 49.8%
Taylor expanded in i around 0 35.3%
if -8.8000000000000004e-66 < i < 0.80000000000000004Initial program 7.4%
Taylor expanded in i around 0 84.8%
associate-*r/84.8%
metadata-eval84.8%
Simplified84.8%
Taylor expanded in n around 0 84.8%
if 0.80000000000000004 < i Initial program 46.0%
Taylor expanded in i around 0 32.2%
associate-*r/32.2%
metadata-eval32.2%
Simplified32.2%
Taylor expanded in n around inf 32.6%
associate-*r*32.6%
*-commutative32.6%
*-commutative32.6%
Simplified32.6%
Taylor expanded in i around inf 32.6%
*-commutative32.6%
Simplified32.6%
Final simplification59.2%
(FPCore (i n) :precision binary64 (if (<= i 32.0) (* n 100.0) (* 50.0 (* i n))))
double code(double i, double n) {
double tmp;
if (i <= 32.0) {
tmp = n * 100.0;
} else {
tmp = 50.0 * (i * n);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= 32.0d0) then
tmp = n * 100.0d0
else
tmp = 50.0d0 * (i * n)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= 32.0) {
tmp = n * 100.0;
} else {
tmp = 50.0 * (i * n);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 32.0: tmp = n * 100.0 else: tmp = 50.0 * (i * n) return tmp
function code(i, n) tmp = 0.0 if (i <= 32.0) tmp = Float64(n * 100.0); else tmp = Float64(50.0 * Float64(i * n)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= 32.0) tmp = n * 100.0; else tmp = 50.0 * (i * n); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, 32.0], N[(n * 100.0), $MachinePrecision], N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 32:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;50 \cdot \left(i \cdot n\right)\\
\end{array}
\end{array}
if i < 32Initial program 22.7%
Taylor expanded in i around 0 60.3%
*-commutative60.3%
Simplified60.3%
if 32 < i Initial program 45.1%
Taylor expanded in i around 0 32.7%
associate-*r/32.7%
metadata-eval32.7%
Simplified32.7%
Taylor expanded in n around inf 33.1%
associate-*r*33.1%
*-commutative33.1%
*-commutative33.1%
Simplified33.1%
Taylor expanded in i around inf 33.1%
*-commutative33.1%
Simplified33.1%
Final simplification54.1%
(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.9%
Taylor expanded in i around 0 53.2%
associate-*r/53.2%
metadata-eval53.2%
Simplified53.2%
Taylor expanded in n around 0 3.0%
*-commutative3.0%
Simplified3.0%
Final simplification3.0%
(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.9%
Taylor expanded in i around 0 48.0%
*-commutative48.0%
Simplified48.0%
Final simplification48.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 2024047
(FPCore (i n)
:name "Compound Interest"
:precision binary64
:alt
(* 100.0 (/ (- (exp (* n (if (== (+ 1.0 (/ i n)) 1.0) (/ i n) (/ (* (/ i n) (log (+ 1.0 (/ i n)))) (- (+ (/ i n) 1.0) 1.0))))) 1.0) (/ i n)))
(* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))