
(FPCore (i n) :precision binary64 (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))
double code(double i, double n) {
return 100.0 * ((pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 100.0d0 * ((((1.0d0 + (i / n)) ** n) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
return 100.0 * ((Math.pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
def code(i, n): return 100.0 * ((math.pow((1.0 + (i / n)), n) - 1.0) / (i / n))
function code(i, n) return Float64(100.0 * Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) - 1.0) / Float64(i / n))) end
function tmp = code(i, n) tmp = 100.0 * ((((1.0 + (i / n)) ^ n) - 1.0) / (i / n)); end
code[i_, n_] := N[(100.0 * N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (i n) :precision binary64 (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))
double code(double i, double n) {
return 100.0 * ((pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 100.0d0 * ((((1.0d0 + (i / n)) ** n) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
return 100.0 * ((Math.pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
def code(i, n): return 100.0 * ((math.pow((1.0 + (i / n)), n) - 1.0) / (i / n))
function code(i, n) return Float64(100.0 * Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) - 1.0) / Float64(i / n))) end
function tmp = code(i, n) tmp = 100.0 * ((((1.0 + (i / n)) ^ n) - 1.0) / (i / n)); end
code[i_, n_] := N[(100.0 * N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}
\end{array}
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 2e-173)
(/ n (/ i (* (expm1 (* n (log1p (/ i n)))) 100.0)))
(if (<= t_1 INFINITY)
(* n (/ (+ (* t_0 100.0) -100.0) i))
(/ 1.0 (/ (fma (* i 0.01) (+ -0.5 (/ 0.5 n)) 0.01) n))))))
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-173) {
tmp = n / (i / (expm1((n * log1p((i / n)))) * 100.0));
} else if (t_1 <= ((double) INFINITY)) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else {
tmp = 1.0 / (fma((i * 0.01), (-0.5 + (0.5 / n)), 0.01) / n);
}
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-173) tmp = Float64(n / Float64(i / Float64(expm1(Float64(n * log1p(Float64(i / n)))) * 100.0))); elseif (t_1 <= Inf) tmp = Float64(n * Float64(Float64(Float64(t_0 * 100.0) + -100.0) / i)); else tmp = Float64(1.0 / Float64(fma(Float64(i * 0.01), Float64(-0.5 + Float64(0.5 / n)), 0.01) / n)); 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-173], N[(n / N[(i / N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] * 100.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(n * N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(N[(i * 0.01), $MachinePrecision] * N[(-0.5 + N[(0.5 / n), $MachinePrecision]), $MachinePrecision] + 0.01), $MachinePrecision] / n), $MachinePrecision]), $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^{-173}:\\
\;\;\;\;\frac{n}{\frac{i}{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot 100}}\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;n \cdot \frac{t_0 \cdot 100 + -100}{i}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\mathsf{fma}\left(i \cdot 0.01, -0.5 + \frac{0.5}{n}, 0.01\right)}{n}}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 2.0000000000000001e-173Initial program 25.5%
associate-*r/25.5%
sub-neg25.5%
distribute-lft-in25.5%
metadata-eval25.5%
metadata-eval25.5%
fma-udef25.5%
associate-/r/25.5%
*-commutative25.5%
clear-num25.5%
un-div-inv25.5%
fma-udef25.5%
metadata-eval25.5%
metadata-eval25.5%
distribute-lft-in25.5%
sub-neg25.5%
*-commutative25.5%
Applied egg-rr97.6%
if 2.0000000000000001e-173 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 99.7%
associate-/r/99.8%
associate-*r*100.0%
*-commutative100.0%
associate-*r/100.0%
sub-neg100.0%
distribute-lft-in100.0%
fma-def100.0%
metadata-eval100.0%
metadata-eval100.0%
Simplified100.0%
fma-udef100.0%
*-commutative100.0%
Applied egg-rr100.0%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
associate-*r/0.0%
sub-neg0.0%
distribute-lft-in0.0%
metadata-eval0.0%
metadata-eval0.0%
fma-udef0.0%
associate-/r/1.9%
*-commutative1.9%
clear-num1.9%
un-div-inv1.9%
fma-udef1.9%
metadata-eval1.9%
metadata-eval1.9%
distribute-lft-in1.9%
sub-neg1.9%
*-commutative1.9%
Applied egg-rr1.9%
Taylor expanded in i around 0 99.9%
+-commutative99.9%
fma-def99.9%
sub-neg99.9%
associate-*r/99.9%
metadata-eval99.9%
metadata-eval99.9%
Simplified99.9%
clear-num99.9%
inv-pow99.9%
Applied egg-rr99.9%
unpow-199.9%
fma-def99.9%
metadata-eval99.9%
associate-*r/99.9%
metadata-eval99.9%
sub-neg99.9%
associate-*r*99.9%
*-commutative99.9%
fma-def99.9%
sub-neg99.9%
associate-*r/99.9%
metadata-eval99.9%
metadata-eval99.9%
+-commutative99.9%
Simplified99.9%
Final simplification98.1%
(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-173)
(* (expm1 (* n (log1p (/ i n)))) (* 100.0 (/ n i)))
(if (<= t_1 INFINITY)
(* n (/ (+ (* t_0 100.0) -100.0) i))
(/ 1.0 (/ (fma (* i 0.01) (+ -0.5 (/ 0.5 n)) 0.01) n))))))
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-173) {
tmp = expm1((n * log1p((i / n)))) * (100.0 * (n / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else {
tmp = 1.0 / (fma((i * 0.01), (-0.5 + (0.5 / n)), 0.01) / n);
}
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-173) tmp = Float64(expm1(Float64(n * log1p(Float64(i / n)))) * Float64(100.0 * Float64(n / i))); elseif (t_1 <= Inf) tmp = Float64(n * Float64(Float64(Float64(t_0 * 100.0) + -100.0) / i)); else tmp = Float64(1.0 / Float64(fma(Float64(i * 0.01), Float64(-0.5 + Float64(0.5 / n)), 0.01) / n)); 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-173], 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 * N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(N[(i * 0.01), $MachinePrecision] * N[(-0.5 + N[(0.5 / n), $MachinePrecision]), $MachinePrecision] + 0.01), $MachinePrecision] / n), $MachinePrecision]), $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^{-173}:\\
\;\;\;\;\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:\\
\;\;\;\;n \cdot \frac{t_0 \cdot 100 + -100}{i}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\mathsf{fma}\left(i \cdot 0.01, -0.5 + \frac{0.5}{n}, 0.01\right)}{n}}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 2.0000000000000001e-173Initial program 25.5%
associate-*r/25.5%
sub-neg25.5%
distribute-lft-in25.5%
metadata-eval25.5%
metadata-eval25.5%
fma-udef25.5%
associate-/r/25.5%
*-commutative25.5%
expm1-log1p-u23.0%
expm1-udef17.8%
Applied egg-rr37.7%
expm1-def68.7%
expm1-log1p95.7%
*-commutative95.7%
Simplified95.7%
if 2.0000000000000001e-173 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 99.7%
associate-/r/99.8%
associate-*r*100.0%
*-commutative100.0%
associate-*r/100.0%
sub-neg100.0%
distribute-lft-in100.0%
fma-def100.0%
metadata-eval100.0%
metadata-eval100.0%
Simplified100.0%
fma-udef100.0%
*-commutative100.0%
Applied egg-rr100.0%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
associate-*r/0.0%
sub-neg0.0%
distribute-lft-in0.0%
metadata-eval0.0%
metadata-eval0.0%
fma-udef0.0%
associate-/r/1.9%
*-commutative1.9%
clear-num1.9%
un-div-inv1.9%
fma-udef1.9%
metadata-eval1.9%
metadata-eval1.9%
distribute-lft-in1.9%
sub-neg1.9%
*-commutative1.9%
Applied egg-rr1.9%
Taylor expanded in i around 0 99.9%
+-commutative99.9%
fma-def99.9%
sub-neg99.9%
associate-*r/99.9%
metadata-eval99.9%
metadata-eval99.9%
Simplified99.9%
clear-num99.9%
inv-pow99.9%
Applied egg-rr99.9%
unpow-199.9%
fma-def99.9%
metadata-eval99.9%
associate-*r/99.9%
metadata-eval99.9%
sub-neg99.9%
associate-*r*99.9%
*-commutative99.9%
fma-def99.9%
sub-neg99.9%
associate-*r/99.9%
metadata-eval99.9%
metadata-eval99.9%
+-commutative99.9%
Simplified99.9%
Final simplification96.6%
(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-173)
(* (expm1 (* n (log1p (/ i n)))) (/ (* n 100.0) i))
(if (<= t_1 INFINITY)
(* n (/ (+ (* t_0 100.0) -100.0) i))
(/ 1.0 (/ (fma (* i 0.01) (+ -0.5 (/ 0.5 n)) 0.01) n))))))
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-173) {
tmp = expm1((n * log1p((i / n)))) * ((n * 100.0) / i);
} else if (t_1 <= ((double) INFINITY)) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else {
tmp = 1.0 / (fma((i * 0.01), (-0.5 + (0.5 / n)), 0.01) / n);
}
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-173) tmp = Float64(expm1(Float64(n * log1p(Float64(i / n)))) * Float64(Float64(n * 100.0) / i)); elseif (t_1 <= Inf) tmp = Float64(n * Float64(Float64(Float64(t_0 * 100.0) + -100.0) / i)); else tmp = Float64(1.0 / Float64(fma(Float64(i * 0.01), Float64(-0.5 + Float64(0.5 / n)), 0.01) / n)); 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-173], N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] * N[(N[(n * 100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(n * N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(N[(i * 0.01), $MachinePrecision] * N[(-0.5 + N[(0.5 / n), $MachinePrecision]), $MachinePrecision] + 0.01), $MachinePrecision] / n), $MachinePrecision]), $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^{-173}:\\
\;\;\;\;\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot \frac{n \cdot 100}{i}\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;n \cdot \frac{t_0 \cdot 100 + -100}{i}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\mathsf{fma}\left(i \cdot 0.01, -0.5 + \frac{0.5}{n}, 0.01\right)}{n}}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 2.0000000000000001e-173Initial program 25.5%
associate-*r/25.5%
sub-neg25.5%
distribute-lft-in25.5%
metadata-eval25.5%
metadata-eval25.5%
fma-udef25.5%
associate-/r/25.5%
*-commutative25.5%
expm1-log1p-u23.0%
expm1-udef17.8%
Applied egg-rr37.7%
expm1-def68.7%
expm1-log1p95.7%
associate-*l/95.9%
Simplified95.9%
if 2.0000000000000001e-173 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 99.7%
associate-/r/99.8%
associate-*r*100.0%
*-commutative100.0%
associate-*r/100.0%
sub-neg100.0%
distribute-lft-in100.0%
fma-def100.0%
metadata-eval100.0%
metadata-eval100.0%
Simplified100.0%
fma-udef100.0%
*-commutative100.0%
Applied egg-rr100.0%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
associate-*r/0.0%
sub-neg0.0%
distribute-lft-in0.0%
metadata-eval0.0%
metadata-eval0.0%
fma-udef0.0%
associate-/r/1.9%
*-commutative1.9%
clear-num1.9%
un-div-inv1.9%
fma-udef1.9%
metadata-eval1.9%
metadata-eval1.9%
distribute-lft-in1.9%
sub-neg1.9%
*-commutative1.9%
Applied egg-rr1.9%
Taylor expanded in i around 0 99.9%
+-commutative99.9%
fma-def99.9%
sub-neg99.9%
associate-*r/99.9%
metadata-eval99.9%
metadata-eval99.9%
Simplified99.9%
clear-num99.9%
inv-pow99.9%
Applied egg-rr99.9%
unpow-199.9%
fma-def99.9%
metadata-eval99.9%
associate-*r/99.9%
metadata-eval99.9%
sub-neg99.9%
associate-*r*99.9%
*-commutative99.9%
fma-def99.9%
sub-neg99.9%
associate-*r/99.9%
metadata-eval99.9%
metadata-eval99.9%
+-commutative99.9%
Simplified99.9%
Final simplification96.8%
(FPCore (i n) :precision binary64 (if (or (<= i -5e-5) (not (<= i 1.5e-7))) (* 100.0 (/ (expm1 i) (/ i n))) (/ n (- (+ 0.01 (+ (* (/ i n) 0.005) (* i -0.01))) (* i -0.005)))))
double code(double i, double n) {
double tmp;
if ((i <= -5e-5) || !(i <= 1.5e-7)) {
tmp = 100.0 * (expm1(i) / (i / n));
} else {
tmp = n / ((0.01 + (((i / n) * 0.005) + (i * -0.01))) - (i * -0.005));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((i <= -5e-5) || !(i <= 1.5e-7)) {
tmp = 100.0 * (Math.expm1(i) / (i / n));
} else {
tmp = n / ((0.01 + (((i / n) * 0.005) + (i * -0.01))) - (i * -0.005));
}
return tmp;
}
def code(i, n): tmp = 0 if (i <= -5e-5) or not (i <= 1.5e-7): tmp = 100.0 * (math.expm1(i) / (i / n)) else: tmp = n / ((0.01 + (((i / n) * 0.005) + (i * -0.01))) - (i * -0.005)) return tmp
function code(i, n) tmp = 0.0 if ((i <= -5e-5) || !(i <= 1.5e-7)) tmp = Float64(100.0 * Float64(expm1(i) / Float64(i / n))); else tmp = Float64(n / Float64(Float64(0.01 + Float64(Float64(Float64(i / n) * 0.005) + Float64(i * -0.01))) - Float64(i * -0.005))); end return tmp end
code[i_, n_] := If[Or[LessEqual[i, -5e-5], N[Not[LessEqual[i, 1.5e-7]], $MachinePrecision]], N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n / N[(N[(0.01 + N[(N[(N[(i / n), $MachinePrecision] * 0.005), $MachinePrecision] + N[(i * -0.01), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -5 \cdot 10^{-5} \lor \neg \left(i \leq 1.5 \cdot 10^{-7}\right):\\
\;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{\left(0.01 + \left(\frac{i}{n} \cdot 0.005 + i \cdot -0.01\right)\right) - i \cdot -0.005}\\
\end{array}
\end{array}
if i < -5.00000000000000024e-5 or 1.4999999999999999e-7 < i Initial program 48.3%
Taylor expanded in n around inf 72.8%
expm1-def73.2%
Simplified73.2%
if -5.00000000000000024e-5 < i < 1.4999999999999999e-7Initial program 11.6%
associate-*r/11.6%
sub-neg11.6%
distribute-lft-in11.6%
metadata-eval11.6%
metadata-eval11.6%
fma-udef11.6%
associate-/r/11.9%
*-commutative11.9%
clear-num11.9%
un-div-inv11.9%
fma-udef11.9%
metadata-eval11.9%
metadata-eval11.9%
distribute-lft-in11.9%
sub-neg11.9%
*-commutative11.9%
Applied egg-rr81.3%
Taylor expanded in i around 0 93.7%
+-commutative93.7%
fma-def93.7%
sub-neg93.7%
associate-*r/93.7%
metadata-eval93.7%
metadata-eval93.7%
Simplified93.7%
fma-udef93.7%
flip-+93.7%
metadata-eval93.7%
Applied egg-rr93.7%
Taylor expanded in n around 0 93.7%
Final simplification84.8%
(FPCore (i n) :precision binary64 (if (or (<= i -3.5e-5) (not (<= i 6.2e-7))) (* (/ (* n 100.0) i) (expm1 i)) (/ n (- (+ 0.01 (+ (* (/ i n) 0.005) (* i -0.01))) (* i -0.005)))))
double code(double i, double n) {
double tmp;
if ((i <= -3.5e-5) || !(i <= 6.2e-7)) {
tmp = ((n * 100.0) / i) * expm1(i);
} else {
tmp = n / ((0.01 + (((i / n) * 0.005) + (i * -0.01))) - (i * -0.005));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((i <= -3.5e-5) || !(i <= 6.2e-7)) {
tmp = ((n * 100.0) / i) * Math.expm1(i);
} else {
tmp = n / ((0.01 + (((i / n) * 0.005) + (i * -0.01))) - (i * -0.005));
}
return tmp;
}
def code(i, n): tmp = 0 if (i <= -3.5e-5) or not (i <= 6.2e-7): tmp = ((n * 100.0) / i) * math.expm1(i) else: tmp = n / ((0.01 + (((i / n) * 0.005) + (i * -0.01))) - (i * -0.005)) return tmp
function code(i, n) tmp = 0.0 if ((i <= -3.5e-5) || !(i <= 6.2e-7)) tmp = Float64(Float64(Float64(n * 100.0) / i) * expm1(i)); else tmp = Float64(n / Float64(Float64(0.01 + Float64(Float64(Float64(i / n) * 0.005) + Float64(i * -0.01))) - Float64(i * -0.005))); end return tmp end
code[i_, n_] := If[Or[LessEqual[i, -3.5e-5], N[Not[LessEqual[i, 6.2e-7]], $MachinePrecision]], N[(N[(N[(n * 100.0), $MachinePrecision] / i), $MachinePrecision] * N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision], N[(n / N[(N[(0.01 + N[(N[(N[(i / n), $MachinePrecision] * 0.005), $MachinePrecision] + N[(i * -0.01), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -3.5 \cdot 10^{-5} \lor \neg \left(i \leq 6.2 \cdot 10^{-7}\right):\\
\;\;\;\;\frac{n \cdot 100}{i} \cdot \mathsf{expm1}\left(i\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{\left(0.01 + \left(\frac{i}{n} \cdot 0.005 + i \cdot -0.01\right)\right) - i \cdot -0.005}\\
\end{array}
\end{array}
if i < -3.4999999999999997e-5 or 6.1999999999999999e-7 < i Initial program 48.3%
associate-*r/48.4%
sub-neg48.4%
distribute-lft-in48.3%
metadata-eval48.3%
metadata-eval48.3%
fma-udef48.4%
associate-/r/48.5%
*-commutative48.5%
expm1-log1p-u44.0%
expm1-udef29.7%
Applied egg-rr44.4%
expm1-def59.5%
expm1-log1p83.7%
associate-*l/83.7%
Simplified83.7%
Taylor expanded in n around inf 73.4%
if -3.4999999999999997e-5 < i < 6.1999999999999999e-7Initial program 11.6%
associate-*r/11.6%
sub-neg11.6%
distribute-lft-in11.6%
metadata-eval11.6%
metadata-eval11.6%
fma-udef11.6%
associate-/r/11.9%
*-commutative11.9%
clear-num11.9%
un-div-inv11.9%
fma-udef11.9%
metadata-eval11.9%
metadata-eval11.9%
distribute-lft-in11.9%
sub-neg11.9%
*-commutative11.9%
Applied egg-rr81.3%
Taylor expanded in i around 0 93.7%
+-commutative93.7%
fma-def93.7%
sub-neg93.7%
associate-*r/93.7%
metadata-eval93.7%
metadata-eval93.7%
Simplified93.7%
fma-udef93.7%
flip-+93.7%
metadata-eval93.7%
Applied egg-rr93.7%
Taylor expanded in n around 0 93.7%
Final simplification84.9%
(FPCore (i n) :precision binary64 (if (or (<= n -2.85e-5) (not (<= n 1.62))) (* 100.0 (/ n (/ i (expm1 i)))) (/ n (+ 0.01 (* 0.01 (* i (+ -0.5 (/ 0.5 n))))))))
double code(double i, double n) {
double tmp;
if ((n <= -2.85e-5) || !(n <= 1.62)) {
tmp = 100.0 * (n / (i / expm1(i)));
} else {
tmp = n / (0.01 + (0.01 * (i * (-0.5 + (0.5 / n)))));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((n <= -2.85e-5) || !(n <= 1.62)) {
tmp = 100.0 * (n / (i / Math.expm1(i)));
} else {
tmp = n / (0.01 + (0.01 * (i * (-0.5 + (0.5 / n)))));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -2.85e-5) or not (n <= 1.62): tmp = 100.0 * (n / (i / math.expm1(i))) else: tmp = n / (0.01 + (0.01 * (i * (-0.5 + (0.5 / n))))) return tmp
function code(i, n) tmp = 0.0 if ((n <= -2.85e-5) || !(n <= 1.62)) tmp = Float64(100.0 * Float64(n / Float64(i / expm1(i)))); else tmp = Float64(n / Float64(0.01 + Float64(0.01 * Float64(i * Float64(-0.5 + Float64(0.5 / n)))))); end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -2.85e-5], N[Not[LessEqual[n, 1.62]], $MachinePrecision]], N[(100.0 * N[(n / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n / N[(0.01 + N[(0.01 * N[(i * N[(-0.5 + N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.85 \cdot 10^{-5} \lor \neg \left(n \leq 1.62\right):\\
\;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + 0.01 \cdot \left(i \cdot \left(-0.5 + \frac{0.5}{n}\right)\right)}\\
\end{array}
\end{array}
if n < -2.8500000000000002e-5 or 1.6200000000000001 < n Initial program 23.5%
Taylor expanded in n around inf 45.0%
*-commutative45.0%
associate-/l*45.0%
expm1-def94.9%
Simplified94.9%
if -2.8500000000000002e-5 < n < 1.6200000000000001Initial program 34.0%
associate-*r/34.0%
sub-neg34.0%
distribute-lft-in34.0%
metadata-eval34.0%
metadata-eval34.0%
fma-udef34.0%
associate-/r/34.2%
*-commutative34.2%
clear-num34.2%
un-div-inv34.2%
fma-udef34.1%
metadata-eval34.1%
metadata-eval34.1%
distribute-lft-in34.2%
sub-neg34.2%
*-commutative34.2%
Applied egg-rr89.7%
Taylor expanded in i around 0 83.9%
sub-neg83.9%
associate-*r/83.9%
metadata-eval83.9%
metadata-eval83.9%
Simplified83.9%
Final simplification90.7%
(FPCore (i n)
:precision binary64
(if (or (<= n -1.25e+131) (not (<= n 2.0)))
(*
n
(+
100.0
(*
100.0
(+
(*
(* i i)
(+ (/ 0.3333333333333333 (* n n)) (+ 0.16666666666666666 (/ -0.5 n))))
(* i (- 0.5 (/ 0.5 n)))))))
(/ n (+ 0.01 (* 0.01 (* i (+ -0.5 (/ 0.5 n))))))))
double code(double i, double n) {
double tmp;
if ((n <= -1.25e+131) || !(n <= 2.0)) {
tmp = n * (100.0 + (100.0 * (((i * i) * ((0.3333333333333333 / (n * n)) + (0.16666666666666666 + (-0.5 / n)))) + (i * (0.5 - (0.5 / n))))));
} else {
tmp = n / (0.01 + (0.01 * (i * (-0.5 + (0.5 / 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.25d+131)) .or. (.not. (n <= 2.0d0))) then
tmp = n * (100.0d0 + (100.0d0 * (((i * i) * ((0.3333333333333333d0 / (n * n)) + (0.16666666666666666d0 + ((-0.5d0) / n)))) + (i * (0.5d0 - (0.5d0 / n))))))
else
tmp = n / (0.01d0 + (0.01d0 * (i * ((-0.5d0) + (0.5d0 / n)))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -1.25e+131) || !(n <= 2.0)) {
tmp = n * (100.0 + (100.0 * (((i * i) * ((0.3333333333333333 / (n * n)) + (0.16666666666666666 + (-0.5 / n)))) + (i * (0.5 - (0.5 / n))))));
} else {
tmp = n / (0.01 + (0.01 * (i * (-0.5 + (0.5 / n)))));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -1.25e+131) or not (n <= 2.0): tmp = n * (100.0 + (100.0 * (((i * i) * ((0.3333333333333333 / (n * n)) + (0.16666666666666666 + (-0.5 / n)))) + (i * (0.5 - (0.5 / n)))))) else: tmp = n / (0.01 + (0.01 * (i * (-0.5 + (0.5 / n))))) return tmp
function code(i, n) tmp = 0.0 if ((n <= -1.25e+131) || !(n <= 2.0)) tmp = Float64(n * Float64(100.0 + Float64(100.0 * Float64(Float64(Float64(i * i) * Float64(Float64(0.3333333333333333 / Float64(n * n)) + Float64(0.16666666666666666 + Float64(-0.5 / n)))) + Float64(i * Float64(0.5 - Float64(0.5 / n))))))); else tmp = Float64(n / Float64(0.01 + Float64(0.01 * Float64(i * Float64(-0.5 + Float64(0.5 / n)))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -1.25e+131) || ~((n <= 2.0))) tmp = n * (100.0 + (100.0 * (((i * i) * ((0.3333333333333333 / (n * n)) + (0.16666666666666666 + (-0.5 / n)))) + (i * (0.5 - (0.5 / n)))))); else tmp = n / (0.01 + (0.01 * (i * (-0.5 + (0.5 / n))))); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -1.25e+131], N[Not[LessEqual[n, 2.0]], $MachinePrecision]], N[(n * N[(100.0 + N[(100.0 * N[(N[(N[(i * i), $MachinePrecision] * N[(N[(0.3333333333333333 / N[(n * n), $MachinePrecision]), $MachinePrecision] + N[(0.16666666666666666 + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(i * N[(0.5 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n / N[(0.01 + N[(0.01 * N[(i * N[(-0.5 + N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.25 \cdot 10^{+131} \lor \neg \left(n \leq 2\right):\\
\;\;\;\;n \cdot \left(100 + 100 \cdot \left(\left(i \cdot i\right) \cdot \left(\frac{0.3333333333333333}{n \cdot n} + \left(0.16666666666666666 + \frac{-0.5}{n}\right)\right) + i \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + 0.01 \cdot \left(i \cdot \left(-0.5 + \frac{0.5}{n}\right)\right)}\\
\end{array}
\end{array}
if n < -1.24999999999999999e131 or 2 < n Initial program 22.3%
associate-/r/22.6%
associate-*r*22.7%
*-commutative22.7%
associate-*r/22.7%
sub-neg22.7%
distribute-lft-in22.7%
fma-def22.7%
metadata-eval22.7%
metadata-eval22.7%
Simplified22.7%
Taylor expanded in i around 0 67.2%
+-commutative67.2%
distribute-lft-out67.2%
Simplified67.2%
if -1.24999999999999999e131 < n < 2Initial program 32.0%
associate-*r/32.1%
sub-neg32.1%
distribute-lft-in32.0%
metadata-eval32.0%
metadata-eval32.0%
fma-udef32.1%
associate-/r/32.3%
*-commutative32.3%
clear-num32.3%
un-div-inv32.3%
fma-udef32.3%
metadata-eval32.3%
metadata-eval32.3%
distribute-lft-in32.3%
sub-neg32.3%
*-commutative32.3%
Applied egg-rr86.5%
Taylor expanded in i around 0 80.3%
sub-neg80.3%
associate-*r/80.3%
metadata-eval80.3%
metadata-eval80.3%
Simplified80.3%
Final simplification74.2%
(FPCore (i n) :precision binary64 (if (<= i 7500000000000.0) (/ n (- (+ 0.01 (+ (* (/ i n) 0.005) (* i -0.01))) (* i -0.005))) (* 200.0 (/ (* n n) i))))
double code(double i, double n) {
double tmp;
if (i <= 7500000000000.0) {
tmp = n / ((0.01 + (((i / n) * 0.005) + (i * -0.01))) - (i * -0.005));
} else {
tmp = 200.0 * ((n * n) / i);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= 7500000000000.0d0) then
tmp = n / ((0.01d0 + (((i / n) * 0.005d0) + (i * (-0.01d0)))) - (i * (-0.005d0)))
else
tmp = 200.0d0 * ((n * n) / i)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= 7500000000000.0) {
tmp = n / ((0.01 + (((i / n) * 0.005) + (i * -0.01))) - (i * -0.005));
} else {
tmp = 200.0 * ((n * n) / i);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 7500000000000.0: tmp = n / ((0.01 + (((i / n) * 0.005) + (i * -0.01))) - (i * -0.005)) else: tmp = 200.0 * ((n * n) / i) return tmp
function code(i, n) tmp = 0.0 if (i <= 7500000000000.0) tmp = Float64(n / Float64(Float64(0.01 + Float64(Float64(Float64(i / n) * 0.005) + Float64(i * -0.01))) - Float64(i * -0.005))); else tmp = Float64(200.0 * Float64(Float64(n * n) / i)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= 7500000000000.0) tmp = n / ((0.01 + (((i / n) * 0.005) + (i * -0.01))) - (i * -0.005)); else tmp = 200.0 * ((n * n) / i); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, 7500000000000.0], N[(n / N[(N[(0.01 + N[(N[(N[(i / n), $MachinePrecision] * 0.005), $MachinePrecision] + N[(i * -0.01), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(200.0 * N[(N[(n * n), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 7500000000000:\\
\;\;\;\;\frac{n}{\left(0.01 + \left(\frac{i}{n} \cdot 0.005 + i \cdot -0.01\right)\right) - i \cdot -0.005}\\
\mathbf{else}:\\
\;\;\;\;200 \cdot \frac{n \cdot n}{i}\\
\end{array}
\end{array}
if i < 7.5e12Initial program 23.6%
associate-*r/23.6%
sub-neg23.6%
distribute-lft-in23.6%
metadata-eval23.6%
metadata-eval23.6%
fma-udef23.6%
associate-/r/23.9%
*-commutative23.9%
clear-num23.9%
un-div-inv23.9%
fma-udef23.9%
metadata-eval23.9%
metadata-eval23.9%
distribute-lft-in23.9%
sub-neg23.9%
*-commutative23.9%
Applied egg-rr85.7%
Taylor expanded in i around 0 77.4%
+-commutative77.4%
fma-def77.4%
sub-neg77.4%
associate-*r/77.4%
metadata-eval77.4%
metadata-eval77.4%
Simplified77.4%
fma-udef77.4%
flip-+70.4%
metadata-eval70.4%
Applied egg-rr70.4%
Taylor expanded in n around 0 77.4%
if 7.5e12 < i Initial program 43.0%
associate-*r/43.1%
sub-neg43.1%
distribute-lft-in43.1%
metadata-eval43.1%
metadata-eval43.1%
fma-udef43.1%
associate-/r/43.4%
*-commutative43.4%
clear-num43.4%
un-div-inv43.4%
fma-udef43.3%
metadata-eval43.3%
metadata-eval43.3%
distribute-lft-in43.4%
sub-neg43.4%
*-commutative43.4%
Applied egg-rr68.9%
Taylor expanded in i around 0 27.2%
+-commutative27.2%
fma-def27.2%
sub-neg27.2%
associate-*r/27.2%
metadata-eval27.2%
metadata-eval27.2%
Simplified27.2%
Taylor expanded in n around 0 43.5%
unpow243.5%
Simplified43.5%
Final simplification70.7%
(FPCore (i n) :precision binary64 (if (<= i 7500000000000.0) (/ n (+ 0.01 (* 0.01 (* i (+ -0.5 (/ 0.5 n)))))) (* 200.0 (/ (* n n) i))))
double code(double i, double n) {
double tmp;
if (i <= 7500000000000.0) {
tmp = n / (0.01 + (0.01 * (i * (-0.5 + (0.5 / n)))));
} else {
tmp = 200.0 * ((n * n) / i);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= 7500000000000.0d0) then
tmp = n / (0.01d0 + (0.01d0 * (i * ((-0.5d0) + (0.5d0 / n)))))
else
tmp = 200.0d0 * ((n * n) / i)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= 7500000000000.0) {
tmp = n / (0.01 + (0.01 * (i * (-0.5 + (0.5 / n)))));
} else {
tmp = 200.0 * ((n * n) / i);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 7500000000000.0: tmp = n / (0.01 + (0.01 * (i * (-0.5 + (0.5 / n))))) else: tmp = 200.0 * ((n * n) / i) return tmp
function code(i, n) tmp = 0.0 if (i <= 7500000000000.0) tmp = Float64(n / Float64(0.01 + Float64(0.01 * Float64(i * Float64(-0.5 + Float64(0.5 / n)))))); else tmp = Float64(200.0 * Float64(Float64(n * n) / i)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= 7500000000000.0) tmp = n / (0.01 + (0.01 * (i * (-0.5 + (0.5 / n))))); else tmp = 200.0 * ((n * n) / i); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, 7500000000000.0], N[(n / N[(0.01 + N[(0.01 * N[(i * N[(-0.5 + N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(200.0 * N[(N[(n * n), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 7500000000000:\\
\;\;\;\;\frac{n}{0.01 + 0.01 \cdot \left(i \cdot \left(-0.5 + \frac{0.5}{n}\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;200 \cdot \frac{n \cdot n}{i}\\
\end{array}
\end{array}
if i < 7.5e12Initial program 23.6%
associate-*r/23.6%
sub-neg23.6%
distribute-lft-in23.6%
metadata-eval23.6%
metadata-eval23.6%
fma-udef23.6%
associate-/r/23.9%
*-commutative23.9%
clear-num23.9%
un-div-inv23.9%
fma-udef23.9%
metadata-eval23.9%
metadata-eval23.9%
distribute-lft-in23.9%
sub-neg23.9%
*-commutative23.9%
Applied egg-rr85.7%
Taylor expanded in i around 0 77.4%
sub-neg77.4%
associate-*r/77.4%
metadata-eval77.4%
metadata-eval77.4%
Simplified77.4%
if 7.5e12 < i Initial program 43.0%
associate-*r/43.1%
sub-neg43.1%
distribute-lft-in43.1%
metadata-eval43.1%
metadata-eval43.1%
fma-udef43.1%
associate-/r/43.4%
*-commutative43.4%
clear-num43.4%
un-div-inv43.4%
fma-udef43.3%
metadata-eval43.3%
metadata-eval43.3%
distribute-lft-in43.4%
sub-neg43.4%
*-commutative43.4%
Applied egg-rr68.9%
Taylor expanded in i around 0 27.2%
+-commutative27.2%
fma-def27.2%
sub-neg27.2%
associate-*r/27.2%
metadata-eval27.2%
metadata-eval27.2%
Simplified27.2%
Taylor expanded in n around 0 43.5%
unpow243.5%
Simplified43.5%
Final simplification70.6%
(FPCore (i n) :precision binary64 (if (or (<= i -1.05e+20) (not (<= i 92000.0))) (* 200.0 (/ n (/ i n))) (* n 100.0)))
double code(double i, double n) {
double tmp;
if ((i <= -1.05e+20) || !(i <= 92000.0)) {
tmp = 200.0 * (n / (i / n));
} else {
tmp = n * 100.0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((i <= (-1.05d+20)) .or. (.not. (i <= 92000.0d0))) then
tmp = 200.0d0 * (n / (i / n))
else
tmp = n * 100.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((i <= -1.05e+20) || !(i <= 92000.0)) {
tmp = 200.0 * (n / (i / n));
} else {
tmp = n * 100.0;
}
return tmp;
}
def code(i, n): tmp = 0 if (i <= -1.05e+20) or not (i <= 92000.0): tmp = 200.0 * (n / (i / n)) else: tmp = n * 100.0 return tmp
function code(i, n) tmp = 0.0 if ((i <= -1.05e+20) || !(i <= 92000.0)) tmp = Float64(200.0 * Float64(n / Float64(i / n))); else tmp = Float64(n * 100.0); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((i <= -1.05e+20) || ~((i <= 92000.0))) tmp = 200.0 * (n / (i / n)); else tmp = n * 100.0; end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[i, -1.05e+20], N[Not[LessEqual[i, 92000.0]], $MachinePrecision]], N[(200.0 * N[(n / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -1.05 \cdot 10^{+20} \lor \neg \left(i \leq 92000\right):\\
\;\;\;\;200 \cdot \frac{n}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if i < -1.05e20 or 92000 < i Initial program 52.4%
associate-*r/52.5%
sub-neg52.5%
distribute-lft-in52.4%
metadata-eval52.4%
metadata-eval52.4%
fma-udef52.5%
associate-/r/52.7%
*-commutative52.7%
clear-num52.7%
un-div-inv52.7%
fma-udef52.6%
metadata-eval52.6%
metadata-eval52.6%
distribute-lft-in52.7%
sub-neg52.7%
*-commutative52.7%
Applied egg-rr82.4%
Taylor expanded in i around 0 33.4%
+-commutative33.4%
fma-def33.4%
sub-neg33.4%
associate-*r/33.4%
metadata-eval33.4%
metadata-eval33.4%
Simplified33.4%
Taylor expanded in n around 0 32.8%
*-commutative32.8%
Simplified32.8%
expm1-log1p-u32.0%
expm1-udef31.0%
Applied egg-rr31.0%
expm1-def32.0%
expm1-log1p32.8%
*-lft-identity32.8%
*-commutative32.8%
times-frac32.8%
metadata-eval32.8%
Simplified32.8%
if -1.05e20 < i < 92000Initial program 11.0%
Taylor expanded in i around 0 80.5%
*-commutative80.5%
Simplified80.5%
Final simplification61.5%
(FPCore (i n) :precision binary64 (if (or (<= n -1.1e-105) (not (<= n 2.8e-132))) (* n (+ 100.0 (* i 50.0))) (* 200.0 (/ n (/ i n)))))
double code(double i, double n) {
double tmp;
if ((n <= -1.1e-105) || !(n <= 2.8e-132)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 200.0 * (n / (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.1d-105)) .or. (.not. (n <= 2.8d-132))) then
tmp = n * (100.0d0 + (i * 50.0d0))
else
tmp = 200.0d0 * (n / (i / n))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -1.1e-105) || !(n <= 2.8e-132)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 200.0 * (n / (i / n));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -1.1e-105) or not (n <= 2.8e-132): tmp = n * (100.0 + (i * 50.0)) else: tmp = 200.0 * (n / (i / n)) return tmp
function code(i, n) tmp = 0.0 if ((n <= -1.1e-105) || !(n <= 2.8e-132)) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); else tmp = Float64(200.0 * Float64(n / Float64(i / n))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -1.1e-105) || ~((n <= 2.8e-132))) tmp = n * (100.0 + (i * 50.0)); else tmp = 200.0 * (n / (i / n)); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -1.1e-105], N[Not[LessEqual[n, 2.8e-132]], $MachinePrecision]], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(200.0 * N[(n / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.1 \cdot 10^{-105} \lor \neg \left(n \leq 2.8 \cdot 10^{-132}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;200 \cdot \frac{n}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -1.10000000000000002e-105 or 2.80000000000000002e-132 < n Initial program 20.6%
associate-/r/20.9%
associate-*r*20.9%
*-commutative20.9%
associate-*r/20.9%
sub-neg20.9%
distribute-lft-in20.9%
fma-def20.9%
metadata-eval20.9%
metadata-eval20.9%
Simplified20.9%
Taylor expanded in i around 0 63.6%
associate-*r*63.6%
*-commutative63.6%
associate-*r/63.6%
metadata-eval63.6%
Simplified63.6%
Taylor expanded in n around inf 63.5%
*-commutative63.5%
Simplified63.5%
if -1.10000000000000002e-105 < n < 2.80000000000000002e-132Initial program 52.1%
associate-*r/52.1%
sub-neg52.1%
distribute-lft-in52.1%
metadata-eval52.1%
metadata-eval52.1%
fma-udef52.1%
associate-/r/52.4%
*-commutative52.4%
clear-num52.4%
un-div-inv52.4%
fma-udef52.4%
metadata-eval52.4%
metadata-eval52.4%
distribute-lft-in52.4%
sub-neg52.4%
*-commutative52.4%
Applied egg-rr82.3%
Taylor expanded in i around 0 86.5%
+-commutative86.5%
fma-def86.5%
sub-neg86.5%
associate-*r/86.5%
metadata-eval86.5%
metadata-eval86.5%
Simplified86.5%
Taylor expanded in n around 0 71.3%
*-commutative71.3%
Simplified71.3%
expm1-log1p-u71.2%
expm1-udef69.9%
Applied egg-rr69.9%
expm1-def71.2%
expm1-log1p71.3%
*-lft-identity71.3%
*-commutative71.3%
times-frac71.3%
metadata-eval71.3%
Simplified71.3%
Final simplification65.2%
(FPCore (i n) :precision binary64 (if (or (<= n -1.1e-105) (not (<= n 1.15e-137))) (* n (+ 100.0 (* i 50.0))) (/ n (* (/ i n) 0.005))))
double code(double i, double n) {
double tmp;
if ((n <= -1.1e-105) || !(n <= 1.15e-137)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = n / ((i / n) * 0.005);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-1.1d-105)) .or. (.not. (n <= 1.15d-137))) then
tmp = n * (100.0d0 + (i * 50.0d0))
else
tmp = n / ((i / n) * 0.005d0)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -1.1e-105) || !(n <= 1.15e-137)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = n / ((i / n) * 0.005);
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -1.1e-105) or not (n <= 1.15e-137): tmp = n * (100.0 + (i * 50.0)) else: tmp = n / ((i / n) * 0.005) return tmp
function code(i, n) tmp = 0.0 if ((n <= -1.1e-105) || !(n <= 1.15e-137)) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); else tmp = Float64(n / Float64(Float64(i / n) * 0.005)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -1.1e-105) || ~((n <= 1.15e-137))) tmp = n * (100.0 + (i * 50.0)); else tmp = n / ((i / n) * 0.005); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -1.1e-105], N[Not[LessEqual[n, 1.15e-137]], $MachinePrecision]], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n / N[(N[(i / n), $MachinePrecision] * 0.005), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.1 \cdot 10^{-105} \lor \neg \left(n \leq 1.15 \cdot 10^{-137}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{\frac{i}{n} \cdot 0.005}\\
\end{array}
\end{array}
if n < -1.10000000000000002e-105 or 1.15000000000000004e-137 < n Initial program 20.6%
associate-/r/20.9%
associate-*r*20.9%
*-commutative20.9%
associate-*r/20.9%
sub-neg20.9%
distribute-lft-in20.9%
fma-def20.9%
metadata-eval20.9%
metadata-eval20.9%
Simplified20.9%
Taylor expanded in i around 0 63.6%
associate-*r*63.6%
*-commutative63.6%
associate-*r/63.6%
metadata-eval63.6%
Simplified63.6%
Taylor expanded in n around inf 63.5%
*-commutative63.5%
Simplified63.5%
if -1.10000000000000002e-105 < n < 1.15000000000000004e-137Initial program 52.1%
associate-*r/52.1%
sub-neg52.1%
distribute-lft-in52.1%
metadata-eval52.1%
metadata-eval52.1%
fma-udef52.1%
associate-/r/52.4%
*-commutative52.4%
clear-num52.4%
un-div-inv52.4%
fma-udef52.4%
metadata-eval52.4%
metadata-eval52.4%
distribute-lft-in52.4%
sub-neg52.4%
*-commutative52.4%
Applied egg-rr82.3%
Taylor expanded in i around 0 86.5%
+-commutative86.5%
fma-def86.5%
sub-neg86.5%
associate-*r/86.5%
metadata-eval86.5%
metadata-eval86.5%
Simplified86.5%
Taylor expanded in n around 0 71.3%
*-commutative71.3%
Simplified71.3%
Final simplification65.2%
(FPCore (i n) :precision binary64 (if (<= i -1.3e+20) (* 200.0 (/ n (/ i n))) (if (<= i 92000.0) (* n 100.0) (* 200.0 (/ (* n n) i)))))
double code(double i, double n) {
double tmp;
if (i <= -1.3e+20) {
tmp = 200.0 * (n / (i / n));
} else if (i <= 92000.0) {
tmp = n * 100.0;
} else {
tmp = 200.0 * ((n * n) / i);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= (-1.3d+20)) then
tmp = 200.0d0 * (n / (i / n))
else if (i <= 92000.0d0) then
tmp = n * 100.0d0
else
tmp = 200.0d0 * ((n * n) / i)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= -1.3e+20) {
tmp = 200.0 * (n / (i / n));
} else if (i <= 92000.0) {
tmp = n * 100.0;
} else {
tmp = 200.0 * ((n * n) / i);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -1.3e+20: tmp = 200.0 * (n / (i / n)) elif i <= 92000.0: tmp = n * 100.0 else: tmp = 200.0 * ((n * n) / i) return tmp
function code(i, n) tmp = 0.0 if (i <= -1.3e+20) tmp = Float64(200.0 * Float64(n / Float64(i / n))); elseif (i <= 92000.0) tmp = Float64(n * 100.0); else tmp = Float64(200.0 * Float64(Float64(n * n) / i)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -1.3e+20) tmp = 200.0 * (n / (i / n)); elseif (i <= 92000.0) tmp = n * 100.0; else tmp = 200.0 * ((n * n) / i); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -1.3e+20], N[(200.0 * N[(n / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 92000.0], N[(n * 100.0), $MachinePrecision], N[(200.0 * N[(N[(n * n), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -1.3 \cdot 10^{+20}:\\
\;\;\;\;200 \cdot \frac{n}{\frac{i}{n}}\\
\mathbf{elif}\;i \leq 92000:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;200 \cdot \frac{n \cdot n}{i}\\
\end{array}
\end{array}
if i < -1.3e20Initial program 64.2%
associate-*r/64.2%
sub-neg64.2%
distribute-lft-in64.2%
metadata-eval64.2%
metadata-eval64.2%
fma-udef64.2%
associate-/r/64.3%
*-commutative64.3%
clear-num64.3%
un-div-inv64.4%
fma-udef64.4%
metadata-eval64.4%
metadata-eval64.4%
distribute-lft-in64.4%
sub-neg64.4%
*-commutative64.4%
Applied egg-rr95.7%
Taylor expanded in i around 0 41.0%
+-commutative41.0%
fma-def41.0%
sub-neg41.0%
associate-*r/41.0%
metadata-eval41.0%
metadata-eval41.0%
Simplified41.0%
Taylor expanded in n around 0 32.2%
*-commutative32.2%
Simplified32.2%
expm1-log1p-u30.6%
expm1-udef29.5%
Applied egg-rr29.5%
expm1-def30.6%
expm1-log1p32.2%
*-lft-identity32.2%
*-commutative32.2%
times-frac32.2%
metadata-eval32.2%
Simplified32.2%
if -1.3e20 < i < 92000Initial program 11.0%
Taylor expanded in i around 0 80.5%
*-commutative80.5%
Simplified80.5%
if 92000 < i Initial program 41.5%
associate-*r/41.6%
sub-neg41.6%
distribute-lft-in41.5%
metadata-eval41.5%
metadata-eval41.5%
fma-udef41.6%
associate-/r/41.9%
*-commutative41.9%
clear-num41.9%
un-div-inv41.8%
fma-udef41.8%
metadata-eval41.8%
metadata-eval41.8%
distribute-lft-in41.8%
sub-neg41.8%
*-commutative41.8%
Applied egg-rr70.0%
Taylor expanded in i around 0 26.5%
+-commutative26.5%
fma-def26.5%
sub-neg26.5%
associate-*r/26.5%
metadata-eval26.5%
metadata-eval26.5%
Simplified26.5%
Taylor expanded in n around 0 42.2%
unpow242.2%
Simplified42.2%
Final simplification63.3%
(FPCore (i n) :precision binary64 (if (<= n -4.8e-203) (/ n (+ 0.01 (* i -0.005))) (if (<= n 1.3e-135) (/ n (* (/ i n) 0.005)) (* n (+ 100.0 (* i 50.0))))))
double code(double i, double n) {
double tmp;
if (n <= -4.8e-203) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 1.3e-135) {
tmp = n / ((i / n) * 0.005);
} else {
tmp = 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 <= (-4.8d-203)) then
tmp = n / (0.01d0 + (i * (-0.005d0)))
else if (n <= 1.3d-135) then
tmp = n / ((i / n) * 0.005d0)
else
tmp = n * (100.0d0 + (i * 50.0d0))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -4.8e-203) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 1.3e-135) {
tmp = n / ((i / n) * 0.005);
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -4.8e-203: tmp = n / (0.01 + (i * -0.005)) elif n <= 1.3e-135: tmp = n / ((i / n) * 0.005) else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) tmp = 0.0 if (n <= -4.8e-203) tmp = Float64(n / Float64(0.01 + Float64(i * -0.005))); elseif (n <= 1.3e-135) tmp = Float64(n / Float64(Float64(i / n) * 0.005)); else tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -4.8e-203) tmp = n / (0.01 + (i * -0.005)); elseif (n <= 1.3e-135) tmp = n / ((i / n) * 0.005); else tmp = n * (100.0 + (i * 50.0)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -4.8e-203], N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.3e-135], N[(n / N[(N[(i / n), $MachinePrecision] * 0.005), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -4.8 \cdot 10^{-203}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{elif}\;n \leq 1.3 \cdot 10^{-135}:\\
\;\;\;\;\frac{n}{\frac{i}{n} \cdot 0.005}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < -4.7999999999999997e-203Initial program 25.6%
associate-*r/25.7%
sub-neg25.7%
distribute-lft-in25.7%
metadata-eval25.7%
metadata-eval25.7%
fma-udef25.7%
associate-/r/25.9%
*-commutative25.9%
clear-num25.9%
un-div-inv25.9%
fma-udef25.9%
metadata-eval25.9%
metadata-eval25.9%
distribute-lft-in25.9%
sub-neg25.9%
*-commutative25.9%
Applied egg-rr83.4%
Taylor expanded in i around 0 62.5%
+-commutative62.5%
fma-def62.5%
sub-neg62.5%
associate-*r/62.5%
metadata-eval62.5%
metadata-eval62.5%
Simplified62.5%
Taylor expanded in n around inf 60.0%
*-commutative60.0%
Simplified60.0%
if -4.7999999999999997e-203 < n < 1.30000000000000002e-135Initial program 54.2%
associate-*r/54.2%
sub-neg54.2%
distribute-lft-in54.2%
metadata-eval54.2%
metadata-eval54.2%
fma-udef54.2%
associate-/r/54.6%
*-commutative54.6%
clear-num54.6%
un-div-inv54.6%
fma-udef54.6%
metadata-eval54.6%
metadata-eval54.6%
distribute-lft-in54.6%
sub-neg54.6%
*-commutative54.6%
Applied egg-rr77.0%
Taylor expanded in i around 0 89.5%
+-commutative89.5%
fma-def89.5%
sub-neg89.5%
associate-*r/89.5%
metadata-eval89.5%
metadata-eval89.5%
Simplified89.5%
Taylor expanded in n around 0 78.5%
*-commutative78.5%
Simplified78.5%
if 1.30000000000000002e-135 < n Initial program 18.3%
associate-/r/18.5%
associate-*r*18.6%
*-commutative18.6%
associate-*r/18.6%
sub-neg18.6%
distribute-lft-in18.5%
fma-def18.6%
metadata-eval18.6%
metadata-eval18.6%
Simplified18.6%
Taylor expanded in i around 0 67.2%
associate-*r*67.2%
*-commutative67.2%
associate-*r/67.2%
metadata-eval67.2%
Simplified67.2%
Taylor expanded in n around inf 67.2%
*-commutative67.2%
Simplified67.2%
Final simplification66.0%
(FPCore (i n) :precision binary64 (if (<= i -2e+30) (* 100.0 (/ i (/ i n))) (if (<= i 9.5e+28) (* n 100.0) (* n (* i 50.0)))))
double code(double i, double n) {
double tmp;
if (i <= -2e+30) {
tmp = 100.0 * (i / (i / n));
} else if (i <= 9.5e+28) {
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 <= (-2d+30)) then
tmp = 100.0d0 * (i / (i / n))
else if (i <= 9.5d+28) 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 <= -2e+30) {
tmp = 100.0 * (i / (i / n));
} else if (i <= 9.5e+28) {
tmp = n * 100.0;
} else {
tmp = n * (i * 50.0);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -2e+30: tmp = 100.0 * (i / (i / n)) elif i <= 9.5e+28: tmp = n * 100.0 else: tmp = n * (i * 50.0) return tmp
function code(i, n) tmp = 0.0 if (i <= -2e+30) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (i <= 9.5e+28) 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 <= -2e+30) tmp = 100.0 * (i / (i / n)); elseif (i <= 9.5e+28) tmp = n * 100.0; else tmp = n * (i * 50.0); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -2e+30], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 9.5e+28], N[(n * 100.0), $MachinePrecision], N[(n * N[(i * 50.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -2 \cdot 10^{+30}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;i \leq 9.5 \cdot 10^{+28}:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(i \cdot 50\right)\\
\end{array}
\end{array}
if i < -2e30Initial program 66.7%
Taylor expanded in i around 0 30.6%
if -2e30 < i < 9.49999999999999927e28Initial program 12.1%
Taylor expanded in i around 0 74.7%
*-commutative74.7%
Simplified74.7%
if 9.49999999999999927e28 < i Initial program 46.3%
Taylor expanded in i around 0 35.3%
unpow235.3%
associate-*r/35.3%
metadata-eval35.3%
Simplified35.3%
Taylor expanded in n around inf 39.8%
*-commutative39.8%
unpow239.8%
Simplified39.8%
Taylor expanded in i around inf 28.2%
*-commutative28.2%
associate-*l*28.2%
Simplified28.2%
Final simplification58.9%
(FPCore (i n) :precision binary64 (if (<= i 9.5e+28) (* n 100.0) (* n (* i 50.0))))
double code(double i, double n) {
double tmp;
if (i <= 9.5e+28) {
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 <= 9.5d+28) 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 <= 9.5e+28) {
tmp = n * 100.0;
} else {
tmp = n * (i * 50.0);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 9.5e+28: tmp = n * 100.0 else: tmp = n * (i * 50.0) return tmp
function code(i, n) tmp = 0.0 if (i <= 9.5e+28) 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 <= 9.5e+28) tmp = n * 100.0; else tmp = n * (i * 50.0); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, 9.5e+28], N[(n * 100.0), $MachinePrecision], N[(n * N[(i * 50.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 9.5 \cdot 10^{+28}:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(i \cdot 50\right)\\
\end{array}
\end{array}
if i < 9.49999999999999927e28Initial program 23.5%
Taylor expanded in i around 0 60.2%
*-commutative60.2%
Simplified60.2%
if 9.49999999999999927e28 < i Initial program 46.3%
Taylor expanded in i around 0 35.3%
unpow235.3%
associate-*r/35.3%
metadata-eval35.3%
Simplified35.3%
Taylor expanded in n around inf 39.8%
*-commutative39.8%
unpow239.8%
Simplified39.8%
Taylor expanded in i around inf 28.2%
*-commutative28.2%
associate-*l*28.2%
Simplified28.2%
Final simplification54.5%
(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.5%
associate-/r/27.8%
associate-*r*27.8%
*-commutative27.8%
associate-*r/27.8%
sub-neg27.8%
distribute-lft-in27.8%
fma-def27.8%
metadata-eval27.8%
metadata-eval27.8%
Simplified27.8%
Taylor expanded in i around 0 53.7%
associate-*r*53.7%
*-commutative53.7%
associate-*r/53.7%
metadata-eval53.7%
Simplified53.7%
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.5%
Taylor expanded in i around 0 50.5%
*-commutative50.5%
Simplified50.5%
Final simplification50.5%
(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 2023200
(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))))