
(FPCore (i n) :precision binary64 (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))
double code(double i, double n) {
return 100.0 * ((pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 100.0d0 * ((((1.0d0 + (i / n)) ** n) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
return 100.0 * ((Math.pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
def code(i, n): return 100.0 * ((math.pow((1.0 + (i / n)), n) - 1.0) / (i / n))
function code(i, n) return Float64(100.0 * Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) - 1.0) / Float64(i / n))) end
function tmp = code(i, n) tmp = 100.0 * ((((1.0 + (i / n)) ^ n) - 1.0) / (i / n)); end
code[i_, n_] := N[(100.0 * N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (i n) :precision binary64 (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))
double code(double i, double n) {
return 100.0 * ((pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 100.0d0 * ((((1.0d0 + (i / n)) ** n) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
return 100.0 * ((Math.pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
def code(i, n): return 100.0 * ((math.pow((1.0 + (i / n)), n) - 1.0) / (i / n))
function code(i, n) return Float64(100.0 * Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) - 1.0) / Float64(i / n))) end
function tmp = code(i, n) tmp = 100.0 * ((((1.0 + (i / n)) ^ n) - 1.0) / (i / n)); end
code[i_, n_] := N[(100.0 * N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}
\end{array}
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (+ t_0 -1.0)) (t_2 (/ t_1 (/ i n))))
(if (<= t_2 -4e-104)
(* n (/ (+ (* t_0 100.0) -100.0) i))
(if (<= t_2 0.0)
(/ (* 100.0 (expm1 (* n (log1p (/ i n))))) (/ i n))
(if (<= t_2 INFINITY) (* 100.0 (* (/ n i) t_1)) (/ 100.0 (/ 1.0 n)))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = t_0 + -1.0;
double t_2 = t_1 / (i / n);
double tmp;
if (t_2 <= -4e-104) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else if (t_2 <= 0.0) {
tmp = (100.0 * expm1((n * log1p((i / n))))) / (i / n);
} else if (t_2 <= ((double) INFINITY)) {
tmp = 100.0 * ((n / i) * t_1);
} else {
tmp = 100.0 / (1.0 / n);
}
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;
double t_2 = t_1 / (i / n);
double tmp;
if (t_2 <= -4e-104) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else if (t_2 <= 0.0) {
tmp = (100.0 * Math.expm1((n * Math.log1p((i / n))))) / (i / n);
} else if (t_2 <= Double.POSITIVE_INFINITY) {
tmp = 100.0 * ((n / i) * t_1);
} else {
tmp = 100.0 / (1.0 / n);
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = t_0 + -1.0 t_2 = t_1 / (i / n) tmp = 0 if t_2 <= -4e-104: tmp = n * (((t_0 * 100.0) + -100.0) / i) elif t_2 <= 0.0: tmp = (100.0 * math.expm1((n * math.log1p((i / n))))) / (i / n) elif t_2 <= math.inf: tmp = 100.0 * ((n / i) * t_1) else: tmp = 100.0 / (1.0 / n) return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(t_0 + -1.0) t_2 = Float64(t_1 / Float64(i / n)) tmp = 0.0 if (t_2 <= -4e-104) tmp = Float64(n * Float64(Float64(Float64(t_0 * 100.0) + -100.0) / i)); elseif (t_2 <= 0.0) tmp = Float64(Float64(100.0 * expm1(Float64(n * log1p(Float64(i / n))))) / Float64(i / n)); elseif (t_2 <= Inf) tmp = Float64(100.0 * Float64(Float64(n / i) * t_1)); else tmp = Float64(100.0 / Float64(1.0 / 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[(t$95$0 + -1.0), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -4e-104], N[(n * N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.0], N[(N[(100.0 * N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[(100.0 * N[(N[(n / i), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], N[(100.0 / N[(1.0 / n), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := t_0 + -1\\
t_2 := \frac{t_1}{\frac{i}{n}}\\
\mathbf{if}\;t_2 \leq -4 \cdot 10^{-104}:\\
\;\;\;\;n \cdot \frac{t_0 \cdot 100 + -100}{i}\\
\mathbf{elif}\;t_2 \leq 0:\\
\;\;\;\;\frac{100 \cdot \mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{\frac{i}{n}}\\
\mathbf{elif}\;t_2 \leq \infty:\\
\;\;\;\;100 \cdot \left(\frac{n}{i} \cdot t_1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{100}{\frac{1}{n}}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -3.99999999999999971e-104Initial program 99.7%
associate-/r/99.7%
associate-*r*99.9%
*-commutative99.9%
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 -3.99999999999999971e-104 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -0.0Initial program 20.5%
associate-*r/20.5%
*-commutative20.5%
pow-to-exp20.5%
expm1-def31.4%
add-log-exp20.5%
pow-to-exp20.5%
log-pow31.4%
log1p-udef99.6%
Applied egg-rr99.6%
if -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 96.0%
div-sub95.9%
clear-num96.1%
sub-neg96.1%
div-inv96.1%
clear-num96.1%
Applied egg-rr96.1%
+-commutative96.1%
neg-mul-196.1%
distribute-rgt-out96.1%
Simplified96.1%
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%
div-inv0.0%
associate-/r*1.8%
Applied egg-rr1.8%
Taylor expanded in i around 0 66.9%
Final simplification92.4%
(FPCore (i n)
:precision binary64
(let* ((t_0 (+ (pow (+ 1.0 (/ i n)) n) -1.0))
(t_1 (/ t_0 (/ i n)))
(t_2 (* 100.0 (* (/ n i) t_0))))
(if (<= t_1 (- INFINITY))
t_2
(if (<= t_1 0.0)
(* n (* (expm1 (* n (log1p (/ i n)))) (/ 100.0 i)))
(if (<= t_1 INFINITY) t_2 (/ 100.0 (/ 1.0 n)))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n) + -1.0;
double t_1 = t_0 / (i / n);
double t_2 = 100.0 * ((n / i) * t_0);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = t_2;
} else if (t_1 <= 0.0) {
tmp = n * (expm1((n * log1p((i / n)))) * (100.0 / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_2;
} else {
tmp = 100.0 / (1.0 / n);
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n) + -1.0;
double t_1 = t_0 / (i / n);
double t_2 = 100.0 * ((n / i) * t_0);
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = t_2;
} else if (t_1 <= 0.0) {
tmp = n * (Math.expm1((n * Math.log1p((i / n)))) * (100.0 / i));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_2;
} else {
tmp = 100.0 / (1.0 / n);
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) + -1.0 t_1 = t_0 / (i / n) t_2 = 100.0 * ((n / i) * t_0) tmp = 0 if t_1 <= -math.inf: tmp = t_2 elif t_1 <= 0.0: tmp = n * (math.expm1((n * math.log1p((i / n)))) * (100.0 / i)) elif t_1 <= math.inf: tmp = t_2 else: tmp = 100.0 / (1.0 / n) return tmp
function code(i, n) t_0 = Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0) t_1 = Float64(t_0 / Float64(i / n)) t_2 = Float64(100.0 * Float64(Float64(n / i) * t_0)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = t_2; elseif (t_1 <= 0.0) tmp = Float64(n * Float64(expm1(Float64(n * log1p(Float64(i / n)))) * Float64(100.0 / i))); elseif (t_1 <= Inf) tmp = t_2; else tmp = Float64(100.0 / Float64(1.0 / n)); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(i / n), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(100.0 * N[(N[(n / i), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], t$95$2, If[LessEqual[t$95$1, 0.0], N[(n * N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] * N[(100.0 / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$2, N[(100.0 / N[(1.0 / n), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n} + -1\\
t_1 := \frac{t_0}{\frac{i}{n}}\\
t_2 := 100 \cdot \left(\frac{n}{i} \cdot t_0\right)\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;n \cdot \left(\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot \frac{100}{i}\right)\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\frac{100}{\frac{1}{n}}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -inf.0 or -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 96.9%
div-sub96.8%
clear-num96.9%
sub-neg96.9%
div-inv96.9%
clear-num96.9%
Applied egg-rr96.9%
+-commutative96.9%
neg-mul-196.9%
distribute-rgt-out97.0%
Simplified97.0%
if -inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -0.0Initial program 23.4%
associate-/r/23.4%
associate-*r*23.4%
*-commutative23.4%
associate-*r/23.4%
sub-neg23.4%
distribute-lft-in23.3%
fma-def23.4%
metadata-eval23.4%
metadata-eval23.4%
Simplified23.4%
expm1-log1p-u23.4%
expm1-udef18.9%
Applied egg-rr73.3%
expm1-def97.8%
expm1-log1p98.7%
*-rgt-identity98.7%
associate-*r/98.6%
associate-*l*98.6%
associate-*r/98.7%
metadata-eval98.7%
Simplified98.7%
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%
div-inv0.0%
associate-/r*1.8%
Applied egg-rr1.8%
Taylor expanded in i around 0 66.9%
Final simplification91.7%
(FPCore (i n)
:precision binary64
(if (<= n -3.2e+153)
(* n (+ (+ 100.0 (* 16.666666666666668 (* i i))) (* i 50.0)))
(if (<= n 8200.0)
(* 100.0 (/ (* n n) (+ n (* (* i n) (- (/ 0.5 n) 0.5)))))
(if (<= n 3.6e+186)
(* 100.0 (/ (expm1 i) (/ i n)))
(* n (+ 100.0 (* i 50.0)))))))
double code(double i, double n) {
double tmp;
if (n <= -3.2e+153) {
tmp = n * ((100.0 + (16.666666666666668 * (i * i))) + (i * 50.0));
} else if (n <= 8200.0) {
tmp = 100.0 * ((n * n) / (n + ((i * n) * ((0.5 / n) - 0.5))));
} else if (n <= 3.6e+186) {
tmp = 100.0 * (expm1(i) / (i / n));
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if (n <= -3.2e+153) {
tmp = n * ((100.0 + (16.666666666666668 * (i * i))) + (i * 50.0));
} else if (n <= 8200.0) {
tmp = 100.0 * ((n * n) / (n + ((i * n) * ((0.5 / n) - 0.5))));
} else if (n <= 3.6e+186) {
tmp = 100.0 * (Math.expm1(i) / (i / n));
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -3.2e+153: tmp = n * ((100.0 + (16.666666666666668 * (i * i))) + (i * 50.0)) elif n <= 8200.0: tmp = 100.0 * ((n * n) / (n + ((i * n) * ((0.5 / n) - 0.5)))) elif n <= 3.6e+186: tmp = 100.0 * (math.expm1(i) / (i / n)) else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) tmp = 0.0 if (n <= -3.2e+153) tmp = Float64(n * Float64(Float64(100.0 + Float64(16.666666666666668 * Float64(i * i))) + Float64(i * 50.0))); elseif (n <= 8200.0) tmp = Float64(100.0 * Float64(Float64(n * n) / Float64(n + Float64(Float64(i * n) * Float64(Float64(0.5 / n) - 0.5))))); elseif (n <= 3.6e+186) tmp = Float64(100.0 * Float64(expm1(i) / Float64(i / n))); else tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); end return tmp end
code[i_, n_] := If[LessEqual[n, -3.2e+153], N[(n * N[(N[(100.0 + N[(16.666666666666668 * N[(i * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 8200.0], N[(100.0 * N[(N[(n * n), $MachinePrecision] / N[(n + N[(N[(i * n), $MachinePrecision] * N[(N[(0.5 / n), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 3.6e+186], N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -3.2 \cdot 10^{+153}:\\
\;\;\;\;n \cdot \left(\left(100 + 16.666666666666668 \cdot \left(i \cdot i\right)\right) + i \cdot 50\right)\\
\mathbf{elif}\;n \leq 8200:\\
\;\;\;\;100 \cdot \frac{n \cdot n}{n + \left(i \cdot n\right) \cdot \left(\frac{0.5}{n} - 0.5\right)}\\
\mathbf{elif}\;n \leq 3.6 \cdot 10^{+186}:\\
\;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < -3.2000000000000001e153Initial program 16.2%
associate-/r/16.9%
associate-*r*16.9%
*-commutative16.9%
associate-*r/17.0%
sub-neg17.0%
distribute-lft-in17.0%
fma-def17.0%
metadata-eval17.0%
metadata-eval17.0%
Simplified17.0%
Taylor expanded in i around 0 68.0%
+-commutative68.0%
distribute-lft-out68.0%
Simplified68.0%
Taylor expanded in n around inf 68.0%
distribute-lft-in68.0%
associate-+r+68.0%
associate-*r*68.0%
metadata-eval68.0%
unpow268.0%
associate-*r*68.0%
metadata-eval68.0%
Simplified68.0%
if -3.2000000000000001e153 < n < 8200Initial program 29.6%
Taylor expanded in i around 0 46.0%
associate-*r*46.4%
*-commutative46.4%
associate-*r/46.4%
metadata-eval46.4%
Simplified46.4%
flip-+43.9%
*-commutative43.9%
*-commutative43.9%
*-commutative43.9%
Applied egg-rr43.9%
Taylor expanded in i around 0 74.4%
unpow274.4%
Simplified74.4%
if 8200 < n < 3.6000000000000002e186Initial program 49.5%
Taylor expanded in n around inf 58.9%
expm1-def84.6%
Simplified84.6%
if 3.6000000000000002e186 < n Initial program 16.0%
associate-/r/16.7%
associate-*r*16.7%
*-commutative16.7%
associate-*r/16.8%
sub-neg16.8%
distribute-lft-in16.8%
fma-def16.8%
metadata-eval16.8%
metadata-eval16.8%
Simplified16.8%
Taylor expanded in i around 0 76.6%
+-commutative76.6%
distribute-lft-out76.6%
Simplified76.6%
Taylor expanded in n around inf 76.6%
distribute-lft-in76.6%
associate-+r+76.6%
associate-*r*76.6%
metadata-eval76.6%
unpow276.6%
associate-*r*76.6%
metadata-eval76.6%
Simplified76.6%
Taylor expanded in i around 0 78.8%
*-commutative78.8%
Simplified78.8%
Final simplification75.6%
(FPCore (i n) :precision binary64 (if (or (<= n -135000000000.0) (not (<= n 5.5e-10))) (* n (* (/ 100.0 i) (expm1 i))) (* 100.0 (/ (* n n) (+ n (* (* i n) (- (/ 0.5 n) 0.5)))))))
double code(double i, double n) {
double tmp;
if ((n <= -135000000000.0) || !(n <= 5.5e-10)) {
tmp = n * ((100.0 / i) * expm1(i));
} else {
tmp = 100.0 * ((n * n) / (n + ((i * n) * ((0.5 / n) - 0.5))));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((n <= -135000000000.0) || !(n <= 5.5e-10)) {
tmp = n * ((100.0 / i) * Math.expm1(i));
} else {
tmp = 100.0 * ((n * n) / (n + ((i * n) * ((0.5 / n) - 0.5))));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -135000000000.0) or not (n <= 5.5e-10): tmp = n * ((100.0 / i) * math.expm1(i)) else: tmp = 100.0 * ((n * n) / (n + ((i * n) * ((0.5 / n) - 0.5)))) return tmp
function code(i, n) tmp = 0.0 if ((n <= -135000000000.0) || !(n <= 5.5e-10)) tmp = Float64(n * Float64(Float64(100.0 / i) * expm1(i))); else tmp = Float64(100.0 * Float64(Float64(n * n) / Float64(n + Float64(Float64(i * n) * Float64(Float64(0.5 / n) - 0.5))))); end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -135000000000.0], N[Not[LessEqual[n, 5.5e-10]], $MachinePrecision]], N[(n * N[(N[(100.0 / i), $MachinePrecision] * N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(N[(n * n), $MachinePrecision] / N[(n + N[(N[(i * n), $MachinePrecision] * N[(N[(0.5 / n), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -135000000000 \lor \neg \left(n \leq 5.5 \cdot 10^{-10}\right):\\
\;\;\;\;n \cdot \left(\frac{100}{i} \cdot \mathsf{expm1}\left(i\right)\right)\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n \cdot n}{n + \left(i \cdot n\right) \cdot \left(\frac{0.5}{n} - 0.5\right)}\\
\end{array}
\end{array}
if n < -1.35e11 or 5.4999999999999996e-10 < n Initial program 28.4%
associate-/r/28.8%
associate-*r*28.8%
*-commutative28.8%
associate-*r/28.9%
sub-neg28.9%
distribute-lft-in28.9%
fma-def28.9%
metadata-eval28.9%
metadata-eval28.9%
Simplified28.9%
expm1-log1p-u25.0%
expm1-udef15.1%
Applied egg-rr52.1%
expm1-def67.7%
expm1-log1p68.2%
*-rgt-identity68.2%
associate-*r/68.1%
associate-*l*68.1%
associate-*r/68.2%
metadata-eval68.2%
Simplified68.2%
Taylor expanded in n around inf 90.9%
if -1.35e11 < n < 5.4999999999999996e-10Initial program 30.1%
Taylor expanded in i around 0 36.3%
associate-*r*36.7%
*-commutative36.7%
associate-*r/36.7%
metadata-eval36.7%
Simplified36.7%
flip-+33.4%
*-commutative33.4%
*-commutative33.4%
*-commutative33.4%
Applied egg-rr33.4%
Taylor expanded in i around 0 74.7%
unpow274.7%
Simplified74.7%
Final simplification84.5%
(FPCore (i n) :precision binary64 (if (or (<= n -135000000000.0) (not (<= n 5.5e-10))) (* 100.0 (/ n (/ i (expm1 i)))) (* 100.0 (/ (* n n) (+ n (* (* i n) (- (/ 0.5 n) 0.5)))))))
double code(double i, double n) {
double tmp;
if ((n <= -135000000000.0) || !(n <= 5.5e-10)) {
tmp = 100.0 * (n / (i / expm1(i)));
} else {
tmp = 100.0 * ((n * n) / (n + ((i * n) * ((0.5 / n) - 0.5))));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((n <= -135000000000.0) || !(n <= 5.5e-10)) {
tmp = 100.0 * (n / (i / Math.expm1(i)));
} else {
tmp = 100.0 * ((n * n) / (n + ((i * n) * ((0.5 / n) - 0.5))));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -135000000000.0) or not (n <= 5.5e-10): tmp = 100.0 * (n / (i / math.expm1(i))) else: tmp = 100.0 * ((n * n) / (n + ((i * n) * ((0.5 / n) - 0.5)))) return tmp
function code(i, n) tmp = 0.0 if ((n <= -135000000000.0) || !(n <= 5.5e-10)) tmp = Float64(100.0 * Float64(n / Float64(i / expm1(i)))); else tmp = Float64(100.0 * Float64(Float64(n * n) / Float64(n + Float64(Float64(i * n) * Float64(Float64(0.5 / n) - 0.5))))); end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -135000000000.0], N[Not[LessEqual[n, 5.5e-10]], $MachinePrecision]], N[(100.0 * N[(n / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(N[(n * n), $MachinePrecision] / N[(n + N[(N[(i * n), $MachinePrecision] * N[(N[(0.5 / n), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -135000000000 \lor \neg \left(n \leq 5.5 \cdot 10^{-10}\right):\\
\;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n \cdot n}{n + \left(i \cdot n\right) \cdot \left(\frac{0.5}{n} - 0.5\right)}\\
\end{array}
\end{array}
if n < -1.35e11 or 5.4999999999999996e-10 < n Initial program 28.4%
Taylor expanded in n around inf 41.7%
*-commutative41.7%
associate-/l*41.7%
expm1-def90.9%
Simplified90.9%
if -1.35e11 < n < 5.4999999999999996e-10Initial program 30.1%
Taylor expanded in i around 0 36.3%
associate-*r*36.7%
*-commutative36.7%
associate-*r/36.7%
metadata-eval36.7%
Simplified36.7%
flip-+33.4%
*-commutative33.4%
*-commutative33.4%
*-commutative33.4%
Applied egg-rr33.4%
Taylor expanded in i around 0 74.7%
unpow274.7%
Simplified74.7%
Final simplification84.5%
(FPCore (i n)
:precision binary64
(if (<= n -5.2e+153)
(* n (+ (+ 100.0 (* 16.666666666666668 (* i i))) (* i 50.0)))
(if (<= n 5.5e-10)
(* 100.0 (/ (* n n) (+ n (* (* i n) (- (/ 0.5 n) 0.5)))))
(*
100.0
(+
n
(* n (+ (* (* i i) 0.16666666666666666) (* i (- 0.5 (/ 0.5 n))))))))))
double code(double i, double n) {
double tmp;
if (n <= -5.2e+153) {
tmp = n * ((100.0 + (16.666666666666668 * (i * i))) + (i * 50.0));
} else if (n <= 5.5e-10) {
tmp = 100.0 * ((n * n) / (n + ((i * n) * ((0.5 / n) - 0.5))));
} else {
tmp = 100.0 * (n + (n * (((i * i) * 0.16666666666666666) + (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 <= (-5.2d+153)) then
tmp = n * ((100.0d0 + (16.666666666666668d0 * (i * i))) + (i * 50.0d0))
else if (n <= 5.5d-10) then
tmp = 100.0d0 * ((n * n) / (n + ((i * n) * ((0.5d0 / n) - 0.5d0))))
else
tmp = 100.0d0 * (n + (n * (((i * i) * 0.16666666666666666d0) + (i * (0.5d0 - (0.5d0 / n))))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -5.2e+153) {
tmp = n * ((100.0 + (16.666666666666668 * (i * i))) + (i * 50.0));
} else if (n <= 5.5e-10) {
tmp = 100.0 * ((n * n) / (n + ((i * n) * ((0.5 / n) - 0.5))));
} else {
tmp = 100.0 * (n + (n * (((i * i) * 0.16666666666666666) + (i * (0.5 - (0.5 / n))))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -5.2e+153: tmp = n * ((100.0 + (16.666666666666668 * (i * i))) + (i * 50.0)) elif n <= 5.5e-10: tmp = 100.0 * ((n * n) / (n + ((i * n) * ((0.5 / n) - 0.5)))) else: tmp = 100.0 * (n + (n * (((i * i) * 0.16666666666666666) + (i * (0.5 - (0.5 / n)))))) return tmp
function code(i, n) tmp = 0.0 if (n <= -5.2e+153) tmp = Float64(n * Float64(Float64(100.0 + Float64(16.666666666666668 * Float64(i * i))) + Float64(i * 50.0))); elseif (n <= 5.5e-10) tmp = Float64(100.0 * Float64(Float64(n * n) / Float64(n + Float64(Float64(i * n) * Float64(Float64(0.5 / n) - 0.5))))); else tmp = Float64(100.0 * Float64(n + Float64(n * Float64(Float64(Float64(i * i) * 0.16666666666666666) + Float64(i * Float64(0.5 - Float64(0.5 / n))))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -5.2e+153) tmp = n * ((100.0 + (16.666666666666668 * (i * i))) + (i * 50.0)); elseif (n <= 5.5e-10) tmp = 100.0 * ((n * n) / (n + ((i * n) * ((0.5 / n) - 0.5)))); else tmp = 100.0 * (n + (n * (((i * i) * 0.16666666666666666) + (i * (0.5 - (0.5 / n)))))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -5.2e+153], N[(n * N[(N[(100.0 + N[(16.666666666666668 * N[(i * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 5.5e-10], N[(100.0 * N[(N[(n * n), $MachinePrecision] / N[(n + N[(N[(i * n), $MachinePrecision] * N[(N[(0.5 / n), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n + N[(n * N[(N[(N[(i * i), $MachinePrecision] * 0.16666666666666666), $MachinePrecision] + N[(i * N[(0.5 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -5.2 \cdot 10^{+153}:\\
\;\;\;\;n \cdot \left(\left(100 + 16.666666666666668 \cdot \left(i \cdot i\right)\right) + i \cdot 50\right)\\
\mathbf{elif}\;n \leq 5.5 \cdot 10^{-10}:\\
\;\;\;\;100 \cdot \frac{n \cdot n}{n + \left(i \cdot n\right) \cdot \left(\frac{0.5}{n} - 0.5\right)}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n + n \cdot \left(\left(i \cdot i\right) \cdot 0.16666666666666666 + i \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\right)\\
\end{array}
\end{array}
if n < -5.1999999999999998e153Initial program 16.2%
associate-/r/16.9%
associate-*r*16.9%
*-commutative16.9%
associate-*r/17.0%
sub-neg17.0%
distribute-lft-in17.0%
fma-def17.0%
metadata-eval17.0%
metadata-eval17.0%
Simplified17.0%
Taylor expanded in i around 0 68.0%
+-commutative68.0%
distribute-lft-out68.0%
Simplified68.0%
Taylor expanded in n around inf 68.0%
distribute-lft-in68.0%
associate-+r+68.0%
associate-*r*68.0%
metadata-eval68.0%
unpow268.0%
associate-*r*68.0%
metadata-eval68.0%
Simplified68.0%
if -5.1999999999999998e153 < n < 5.4999999999999996e-10Initial program 30.3%
Taylor expanded in i around 0 44.5%
associate-*r*44.8%
*-commutative44.8%
associate-*r/44.8%
metadata-eval44.8%
Simplified44.8%
flip-+42.3%
*-commutative42.3%
*-commutative42.3%
*-commutative42.3%
Applied egg-rr42.3%
Taylor expanded in i around 0 73.6%
unpow273.6%
Simplified73.6%
if 5.4999999999999996e-10 < n Initial program 33.2%
Taylor expanded in i around 0 72.8%
distribute-lft-out73.1%
unpow273.1%
associate--l+73.1%
associate-*r/73.1%
metadata-eval73.1%
unpow273.1%
associate-*r/73.1%
metadata-eval73.1%
associate-*r/73.1%
metadata-eval73.1%
Simplified73.1%
Taylor expanded in n around inf 73.1%
*-commutative73.1%
unpow273.1%
Simplified73.1%
Final simplification72.6%
(FPCore (i n) :precision binary64 (if (or (<= n -3.2e+153) (not (<= n 5.5e-10))) (* n (+ (+ 100.0 (* 16.666666666666668 (* i i))) (* i 50.0))) (* 100.0 (/ (* n n) (+ n (* (* i n) (- (/ 0.5 n) 0.5)))))))
double code(double i, double n) {
double tmp;
if ((n <= -3.2e+153) || !(n <= 5.5e-10)) {
tmp = n * ((100.0 + (16.666666666666668 * (i * i))) + (i * 50.0));
} else {
tmp = 100.0 * ((n * n) / (n + ((i * n) * ((0.5 / n) - 0.5))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-3.2d+153)) .or. (.not. (n <= 5.5d-10))) then
tmp = n * ((100.0d0 + (16.666666666666668d0 * (i * i))) + (i * 50.0d0))
else
tmp = 100.0d0 * ((n * n) / (n + ((i * n) * ((0.5d0 / n) - 0.5d0))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -3.2e+153) || !(n <= 5.5e-10)) {
tmp = n * ((100.0 + (16.666666666666668 * (i * i))) + (i * 50.0));
} else {
tmp = 100.0 * ((n * n) / (n + ((i * n) * ((0.5 / n) - 0.5))));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -3.2e+153) or not (n <= 5.5e-10): tmp = n * ((100.0 + (16.666666666666668 * (i * i))) + (i * 50.0)) else: tmp = 100.0 * ((n * n) / (n + ((i * n) * ((0.5 / n) - 0.5)))) return tmp
function code(i, n) tmp = 0.0 if ((n <= -3.2e+153) || !(n <= 5.5e-10)) tmp = Float64(n * Float64(Float64(100.0 + Float64(16.666666666666668 * Float64(i * i))) + Float64(i * 50.0))); else tmp = Float64(100.0 * Float64(Float64(n * n) / Float64(n + Float64(Float64(i * n) * Float64(Float64(0.5 / n) - 0.5))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -3.2e+153) || ~((n <= 5.5e-10))) tmp = n * ((100.0 + (16.666666666666668 * (i * i))) + (i * 50.0)); else tmp = 100.0 * ((n * n) / (n + ((i * n) * ((0.5 / n) - 0.5)))); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -3.2e+153], N[Not[LessEqual[n, 5.5e-10]], $MachinePrecision]], N[(n * N[(N[(100.0 + N[(16.666666666666668 * N[(i * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(N[(n * n), $MachinePrecision] / N[(n + N[(N[(i * n), $MachinePrecision] * N[(N[(0.5 / n), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -3.2 \cdot 10^{+153} \lor \neg \left(n \leq 5.5 \cdot 10^{-10}\right):\\
\;\;\;\;n \cdot \left(\left(100 + 16.666666666666668 \cdot \left(i \cdot i\right)\right) + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n \cdot n}{n + \left(i \cdot n\right) \cdot \left(\frac{0.5}{n} - 0.5\right)}\\
\end{array}
\end{array}
if n < -3.2000000000000001e153 or 5.4999999999999996e-10 < n Initial program 27.6%
associate-/r/28.0%
associate-*r*28.0%
*-commutative28.0%
associate-*r/28.1%
sub-neg28.1%
distribute-lft-in28.1%
fma-def28.1%
metadata-eval28.1%
metadata-eval28.1%
Simplified28.1%
Taylor expanded in i around 0 71.4%
+-commutative71.4%
distribute-lft-out71.4%
Simplified71.4%
Taylor expanded in n around inf 71.4%
distribute-lft-in71.4%
associate-+r+71.4%
associate-*r*71.4%
metadata-eval71.4%
unpow271.4%
associate-*r*71.4%
metadata-eval71.4%
Simplified71.4%
if -3.2000000000000001e153 < n < 5.4999999999999996e-10Initial program 30.3%
Taylor expanded in i around 0 44.5%
associate-*r*44.8%
*-commutative44.8%
associate-*r/44.8%
metadata-eval44.8%
Simplified44.8%
flip-+42.3%
*-commutative42.3%
*-commutative42.3%
*-commutative42.3%
Applied egg-rr42.3%
Taylor expanded in i around 0 73.6%
unpow273.6%
Simplified73.6%
Final simplification72.6%
(FPCore (i n) :precision binary64 (if (or (<= n -2.65e-130) (not (<= n 2e-79))) (* n (+ (+ 100.0 (* 16.666666666666668 (* i i))) (* i 50.0))) (* 100.0 (/ 0.0 (/ i n)))))
double code(double i, double n) {
double tmp;
if ((n <= -2.65e-130) || !(n <= 2e-79)) {
tmp = n * ((100.0 + (16.666666666666668 * (i * i))) + (i * 50.0));
} else {
tmp = 100.0 * (0.0 / (i / n));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-2.65d-130)) .or. (.not. (n <= 2d-79))) then
tmp = n * ((100.0d0 + (16.666666666666668d0 * (i * i))) + (i * 50.0d0))
else
tmp = 100.0d0 * (0.0d0 / (i / n))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -2.65e-130) || !(n <= 2e-79)) {
tmp = n * ((100.0 + (16.666666666666668 * (i * i))) + (i * 50.0));
} else {
tmp = 100.0 * (0.0 / (i / n));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -2.65e-130) or not (n <= 2e-79): tmp = n * ((100.0 + (16.666666666666668 * (i * i))) + (i * 50.0)) else: tmp = 100.0 * (0.0 / (i / n)) return tmp
function code(i, n) tmp = 0.0 if ((n <= -2.65e-130) || !(n <= 2e-79)) tmp = Float64(n * Float64(Float64(100.0 + Float64(16.666666666666668 * Float64(i * i))) + Float64(i * 50.0))); else tmp = Float64(100.0 * Float64(0.0 / Float64(i / n))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -2.65e-130) || ~((n <= 2e-79))) tmp = n * ((100.0 + (16.666666666666668 * (i * i))) + (i * 50.0)); else tmp = 100.0 * (0.0 / (i / n)); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -2.65e-130], N[Not[LessEqual[n, 2e-79]], $MachinePrecision]], N[(n * N[(N[(100.0 + N[(16.666666666666668 * N[(i * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.65 \cdot 10^{-130} \lor \neg \left(n \leq 2 \cdot 10^{-79}\right):\\
\;\;\;\;n \cdot \left(\left(100 + 16.666666666666668 \cdot \left(i \cdot i\right)\right) + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{0}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -2.6500000000000002e-130 or 2e-79 < n Initial program 25.4%
associate-/r/25.7%
associate-*r*25.7%
*-commutative25.7%
associate-*r/25.8%
sub-neg25.8%
distribute-lft-in25.7%
fma-def25.8%
metadata-eval25.8%
metadata-eval25.8%
Simplified25.8%
Taylor expanded in i around 0 70.4%
+-commutative70.4%
distribute-lft-out70.4%
Simplified70.4%
Taylor expanded in n around inf 70.4%
distribute-lft-in70.4%
associate-+r+70.4%
associate-*r*70.4%
metadata-eval70.4%
unpow270.4%
associate-*r*70.4%
metadata-eval70.4%
Simplified70.4%
if -2.6500000000000002e-130 < n < 2e-79Initial program 39.0%
Taylor expanded in i around 0 68.0%
Final simplification69.8%
(FPCore (i n)
:precision binary64
(if (<= n -1e-15)
(* n 100.0)
(if (<= n 3.9e+72)
(* 100.0 (/ i (/ i n)))
(if (<= n 5.5e+189) (* 16.666666666666668 (* n (* i i))) (* n 100.0)))))
double code(double i, double n) {
double tmp;
if (n <= -1e-15) {
tmp = n * 100.0;
} else if (n <= 3.9e+72) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 5.5e+189) {
tmp = 16.666666666666668 * (n * (i * i));
} 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 (n <= (-1d-15)) then
tmp = n * 100.0d0
else if (n <= 3.9d+72) then
tmp = 100.0d0 * (i / (i / n))
else if (n <= 5.5d+189) then
tmp = 16.666666666666668d0 * (n * (i * i))
else
tmp = n * 100.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -1e-15) {
tmp = n * 100.0;
} else if (n <= 3.9e+72) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 5.5e+189) {
tmp = 16.666666666666668 * (n * (i * i));
} else {
tmp = n * 100.0;
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -1e-15: tmp = n * 100.0 elif n <= 3.9e+72: tmp = 100.0 * (i / (i / n)) elif n <= 5.5e+189: tmp = 16.666666666666668 * (n * (i * i)) else: tmp = n * 100.0 return tmp
function code(i, n) tmp = 0.0 if (n <= -1e-15) tmp = Float64(n * 100.0); elseif (n <= 3.9e+72) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (n <= 5.5e+189) tmp = Float64(16.666666666666668 * Float64(n * Float64(i * i))); else tmp = Float64(n * 100.0); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -1e-15) tmp = n * 100.0; elseif (n <= 3.9e+72) tmp = 100.0 * (i / (i / n)); elseif (n <= 5.5e+189) tmp = 16.666666666666668 * (n * (i * i)); else tmp = n * 100.0; end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -1e-15], N[(n * 100.0), $MachinePrecision], If[LessEqual[n, 3.9e+72], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 5.5e+189], N[(16.666666666666668 * N[(n * N[(i * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1 \cdot 10^{-15}:\\
\;\;\;\;n \cdot 100\\
\mathbf{elif}\;n \leq 3.9 \cdot 10^{+72}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 5.5 \cdot 10^{+189}:\\
\;\;\;\;16.666666666666668 \cdot \left(n \cdot \left(i \cdot i\right)\right)\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if n < -1.0000000000000001e-15 or 5.5e189 < n Initial program 19.9%
Taylor expanded in i around 0 61.7%
*-commutative61.7%
Simplified61.7%
if -1.0000000000000001e-15 < n < 3.89999999999999992e72Initial program 34.6%
Taylor expanded in i around 0 60.5%
if 3.89999999999999992e72 < n < 5.5e189Initial program 46.9%
associate-/r/47.0%
associate-*r*47.0%
*-commutative47.0%
associate-*r/47.0%
sub-neg47.0%
distribute-lft-in47.0%
fma-def47.0%
metadata-eval47.0%
metadata-eval47.0%
Simplified47.0%
Taylor expanded in i around 0 68.6%
+-commutative68.6%
distribute-lft-out68.6%
Simplified68.6%
Taylor expanded in n around inf 68.6%
distribute-lft-in68.6%
associate-+r+68.6%
associate-*r*68.6%
metadata-eval68.6%
unpow268.6%
associate-*r*68.6%
metadata-eval68.6%
Simplified68.6%
Taylor expanded in i around inf 49.0%
unpow249.0%
Simplified49.0%
Final simplification60.0%
(FPCore (i n)
:precision binary64
(if (<= n -1e-15)
(* n 100.0)
(if (<= n 1.25e+73)
(* 100.0 (/ i (/ i n)))
(if (<= n 2.5e+189) (* i (* n (* i 16.666666666666668))) (* n 100.0)))))
double code(double i, double n) {
double tmp;
if (n <= -1e-15) {
tmp = n * 100.0;
} else if (n <= 1.25e+73) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 2.5e+189) {
tmp = i * (n * (i * 16.666666666666668));
} 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 (n <= (-1d-15)) then
tmp = n * 100.0d0
else if (n <= 1.25d+73) then
tmp = 100.0d0 * (i / (i / n))
else if (n <= 2.5d+189) then
tmp = i * (n * (i * 16.666666666666668d0))
else
tmp = n * 100.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -1e-15) {
tmp = n * 100.0;
} else if (n <= 1.25e+73) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 2.5e+189) {
tmp = i * (n * (i * 16.666666666666668));
} else {
tmp = n * 100.0;
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -1e-15: tmp = n * 100.0 elif n <= 1.25e+73: tmp = 100.0 * (i / (i / n)) elif n <= 2.5e+189: tmp = i * (n * (i * 16.666666666666668)) else: tmp = n * 100.0 return tmp
function code(i, n) tmp = 0.0 if (n <= -1e-15) tmp = Float64(n * 100.0); elseif (n <= 1.25e+73) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (n <= 2.5e+189) tmp = Float64(i * Float64(n * Float64(i * 16.666666666666668))); else tmp = Float64(n * 100.0); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -1e-15) tmp = n * 100.0; elseif (n <= 1.25e+73) tmp = 100.0 * (i / (i / n)); elseif (n <= 2.5e+189) tmp = i * (n * (i * 16.666666666666668)); else tmp = n * 100.0; end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -1e-15], N[(n * 100.0), $MachinePrecision], If[LessEqual[n, 1.25e+73], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.5e+189], N[(i * N[(n * N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1 \cdot 10^{-15}:\\
\;\;\;\;n \cdot 100\\
\mathbf{elif}\;n \leq 1.25 \cdot 10^{+73}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 2.5 \cdot 10^{+189}:\\
\;\;\;\;i \cdot \left(n \cdot \left(i \cdot 16.666666666666668\right)\right)\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if n < -1.0000000000000001e-15 or 2.5000000000000002e189 < n Initial program 19.9%
Taylor expanded in i around 0 61.7%
*-commutative61.7%
Simplified61.7%
if -1.0000000000000001e-15 < n < 1.24999999999999994e73Initial program 34.6%
Taylor expanded in i around 0 60.5%
if 1.24999999999999994e73 < n < 2.5000000000000002e189Initial program 46.9%
associate-/r/47.0%
associate-*r*47.0%
*-commutative47.0%
associate-*r/47.0%
sub-neg47.0%
distribute-lft-in47.0%
fma-def47.0%
metadata-eval47.0%
metadata-eval47.0%
Simplified47.0%
Taylor expanded in i around 0 68.6%
+-commutative68.6%
distribute-lft-out68.6%
Simplified68.6%
Taylor expanded in n around inf 68.6%
distribute-lft-in68.6%
associate-+r+68.6%
associate-*r*68.6%
metadata-eval68.6%
unpow268.6%
associate-*r*68.6%
metadata-eval68.6%
Simplified68.6%
Taylor expanded in i around inf 49.0%
*-commutative49.0%
associate-*l*49.0%
unpow249.0%
associate-*l*49.0%
Simplified49.0%
Taylor expanded in n around 0 49.0%
*-commutative49.0%
unpow249.0%
associate-*r*49.0%
associate-*r*49.0%
*-commutative49.0%
associate-*l*49.0%
Simplified49.0%
Final simplification60.0%
(FPCore (i n) :precision binary64 (if (or (<= n -4.3e+15) (not (<= n 2.6e-56))) (* n (+ 100.0 (* i 50.0))) (* 100.0 (/ i (/ i n)))))
double code(double i, double n) {
double tmp;
if ((n <= -4.3e+15) || !(n <= 2.6e-56)) {
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 <= (-4.3d+15)) .or. (.not. (n <= 2.6d-56))) 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 <= -4.3e+15) || !(n <= 2.6e-56)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -4.3e+15) or not (n <= 2.6e-56): 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 <= -4.3e+15) || !(n <= 2.6e-56)) 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 <= -4.3e+15) || ~((n <= 2.6e-56))) 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, -4.3e+15], N[Not[LessEqual[n, 2.6e-56]], $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 -4.3 \cdot 10^{+15} \lor \neg \left(n \leq 2.6 \cdot 10^{-56}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -4.3e15 or 2.59999999999999997e-56 < n Initial program 27.5%
associate-/r/28.0%
associate-*r*28.0%
*-commutative28.0%
associate-*r/28.0%
sub-neg28.0%
distribute-lft-in28.0%
fma-def28.0%
metadata-eval28.0%
metadata-eval28.0%
Simplified28.0%
Taylor expanded in i around 0 70.7%
+-commutative70.7%
distribute-lft-out70.7%
Simplified70.7%
Taylor expanded in n around inf 70.6%
distribute-lft-in70.6%
associate-+r+70.7%
associate-*r*70.7%
metadata-eval70.7%
unpow270.7%
associate-*r*70.7%
metadata-eval70.7%
Simplified70.7%
Taylor expanded in i around 0 65.4%
*-commutative65.4%
Simplified65.4%
if -4.3e15 < n < 2.59999999999999997e-56Initial program 31.6%
Taylor expanded in i around 0 63.9%
Final simplification64.8%
(FPCore (i n) :precision binary64 (if (<= n -1.05e+15) (* 100.0 (* n (+ 1.0 (* i 0.5)))) (if (<= n 9.5e-57) (* 100.0 (/ i (/ i n))) (* n (+ 100.0 (* i 50.0))))))
double code(double i, double n) {
double tmp;
if (n <= -1.05e+15) {
tmp = 100.0 * (n * (1.0 + (i * 0.5)));
} else if (n <= 9.5e-57) {
tmp = 100.0 * (i / (i / n));
} 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 <= (-1.05d+15)) then
tmp = 100.0d0 * (n * (1.0d0 + (i * 0.5d0)))
else if (n <= 9.5d-57) then
tmp = 100.0d0 * (i / (i / n))
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 <= -1.05e+15) {
tmp = 100.0 * (n * (1.0 + (i * 0.5)));
} else if (n <= 9.5e-57) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -1.05e+15: tmp = 100.0 * (n * (1.0 + (i * 0.5))) elif n <= 9.5e-57: tmp = 100.0 * (i / (i / n)) else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) tmp = 0.0 if (n <= -1.05e+15) tmp = Float64(100.0 * Float64(n * Float64(1.0 + Float64(i * 0.5)))); elseif (n <= 9.5e-57) tmp = Float64(100.0 * Float64(i / Float64(i / n))); 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 <= -1.05e+15) tmp = 100.0 * (n * (1.0 + (i * 0.5))); elseif (n <= 9.5e-57) tmp = 100.0 * (i / (i / n)); else tmp = n * (100.0 + (i * 50.0)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -1.05e+15], N[(100.0 * N[(n * N[(1.0 + N[(i * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 9.5e-57], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.05 \cdot 10^{+15}:\\
\;\;\;\;100 \cdot \left(n \cdot \left(1 + i \cdot 0.5\right)\right)\\
\mathbf{elif}\;n \leq 9.5 \cdot 10^{-57}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < -1.05e15Initial program 22.7%
Taylor expanded in i around 0 66.0%
associate-*r*66.0%
*-commutative66.0%
associate-*r/66.0%
metadata-eval66.0%
Simplified66.0%
Taylor expanded in n around inf 66.0%
if -1.05e15 < n < 9.5000000000000005e-57Initial program 31.6%
Taylor expanded in i around 0 63.9%
if 9.5000000000000005e-57 < n Initial program 31.7%
associate-/r/32.0%
associate-*r*32.0%
*-commutative32.0%
associate-*r/32.1%
sub-neg32.1%
distribute-lft-in32.1%
fma-def32.1%
metadata-eval32.1%
metadata-eval32.1%
Simplified32.1%
Taylor expanded in i around 0 72.8%
+-commutative72.8%
distribute-lft-out72.8%
Simplified72.8%
Taylor expanded in n around inf 72.8%
distribute-lft-in72.8%
associate-+r+72.8%
associate-*r*72.8%
metadata-eval72.8%
unpow272.8%
associate-*r*72.8%
metadata-eval72.8%
Simplified72.8%
Taylor expanded in i around 0 65.0%
*-commutative65.0%
Simplified65.0%
Final simplification64.8%
(FPCore (i n) :precision binary64 (if (<= n -2.65e-130) (* 100.0 (* n (+ 1.0 (* i 0.5)))) (if (<= n 2.05e-79) (* 100.0 (/ 0.0 (/ i n))) (* n (+ 100.0 (* i 50.0))))))
double code(double i, double n) {
double tmp;
if (n <= -2.65e-130) {
tmp = 100.0 * (n * (1.0 + (i * 0.5)));
} else if (n <= 2.05e-79) {
tmp = 100.0 * (0.0 / (i / n));
} 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 <= (-2.65d-130)) then
tmp = 100.0d0 * (n * (1.0d0 + (i * 0.5d0)))
else if (n <= 2.05d-79) then
tmp = 100.0d0 * (0.0d0 / (i / n))
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 <= -2.65e-130) {
tmp = 100.0 * (n * (1.0 + (i * 0.5)));
} else if (n <= 2.05e-79) {
tmp = 100.0 * (0.0 / (i / n));
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -2.65e-130: tmp = 100.0 * (n * (1.0 + (i * 0.5))) elif n <= 2.05e-79: tmp = 100.0 * (0.0 / (i / n)) else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) tmp = 0.0 if (n <= -2.65e-130) tmp = Float64(100.0 * Float64(n * Float64(1.0 + Float64(i * 0.5)))); elseif (n <= 2.05e-79) tmp = Float64(100.0 * Float64(0.0 / Float64(i / n))); 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 <= -2.65e-130) tmp = 100.0 * (n * (1.0 + (i * 0.5))); elseif (n <= 2.05e-79) tmp = 100.0 * (0.0 / (i / n)); else tmp = n * (100.0 + (i * 50.0)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -2.65e-130], N[(100.0 * N[(n * N[(1.0 + N[(i * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.05e-79], N[(100.0 * N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.65 \cdot 10^{-130}:\\
\;\;\;\;100 \cdot \left(n \cdot \left(1 + i \cdot 0.5\right)\right)\\
\mathbf{elif}\;n \leq 2.05 \cdot 10^{-79}:\\
\;\;\;\;100 \cdot \frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < -2.6500000000000002e-130Initial program 20.4%
Taylor expanded in i around 0 67.0%
associate-*r*67.0%
*-commutative67.0%
associate-*r/67.0%
metadata-eval67.0%
Simplified67.0%
Taylor expanded in n around inf 67.0%
if -2.6500000000000002e-130 < n < 2.04999999999999997e-79Initial program 39.0%
Taylor expanded in i around 0 68.0%
if 2.04999999999999997e-79 < n Initial program 31.1%
associate-/r/31.4%
associate-*r*31.4%
*-commutative31.4%
associate-*r/31.4%
sub-neg31.4%
distribute-lft-in31.5%
fma-def31.4%
metadata-eval31.4%
metadata-eval31.4%
Simplified31.4%
Taylor expanded in i around 0 72.3%
+-commutative72.3%
distribute-lft-out72.3%
Simplified72.3%
Taylor expanded in n around inf 72.3%
distribute-lft-in72.3%
associate-+r+72.3%
associate-*r*72.3%
metadata-eval72.3%
unpow272.3%
associate-*r*72.3%
metadata-eval72.3%
Simplified72.3%
Taylor expanded in i around 0 64.6%
*-commutative64.6%
Simplified64.6%
Final simplification66.5%
(FPCore (i n) :precision binary64 (if (<= i 2.8e+19) (* n 100.0) (* 16.666666666666668 (* n (* i i)))))
double code(double i, double n) {
double tmp;
if (i <= 2.8e+19) {
tmp = n * 100.0;
} else {
tmp = 16.666666666666668 * (n * (i * i));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= 2.8d+19) then
tmp = n * 100.0d0
else
tmp = 16.666666666666668d0 * (n * (i * i))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= 2.8e+19) {
tmp = n * 100.0;
} else {
tmp = 16.666666666666668 * (n * (i * i));
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 2.8e+19: tmp = n * 100.0 else: tmp = 16.666666666666668 * (n * (i * i)) return tmp
function code(i, n) tmp = 0.0 if (i <= 2.8e+19) tmp = Float64(n * 100.0); else tmp = Float64(16.666666666666668 * Float64(n * Float64(i * i))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= 2.8e+19) tmp = n * 100.0; else tmp = 16.666666666666668 * (n * (i * i)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, 2.8e+19], N[(n * 100.0), $MachinePrecision], N[(16.666666666666668 * N[(n * N[(i * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 2.8 \cdot 10^{+19}:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;16.666666666666668 \cdot \left(n \cdot \left(i \cdot i\right)\right)\\
\end{array}
\end{array}
if i < 2.8e19Initial program 22.5%
Taylor expanded in i around 0 63.1%
*-commutative63.1%
Simplified63.1%
if 2.8e19 < i Initial program 46.8%
associate-/r/47.4%
associate-*r*47.3%
*-commutative47.3%
associate-*r/47.3%
sub-neg47.3%
distribute-lft-in47.3%
fma-def47.3%
metadata-eval47.3%
metadata-eval47.3%
Simplified47.3%
Taylor expanded in i around 0 38.6%
+-commutative38.6%
distribute-lft-out38.6%
Simplified38.6%
Taylor expanded in n around inf 39.4%
distribute-lft-in39.4%
associate-+r+39.4%
associate-*r*39.4%
metadata-eval39.4%
unpow239.4%
associate-*r*39.4%
metadata-eval39.4%
Simplified39.4%
Taylor expanded in i around inf 39.4%
unpow239.4%
Simplified39.4%
Final simplification56.7%
(FPCore (i n) :precision binary64 (if (<= i 5.1e+19) (* n 100.0) (* (* i n) 50.0)))
double code(double i, double n) {
double tmp;
if (i <= 5.1e+19) {
tmp = n * 100.0;
} else {
tmp = (i * n) * 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 <= 5.1d+19) then
tmp = n * 100.0d0
else
tmp = (i * n) * 50.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= 5.1e+19) {
tmp = n * 100.0;
} else {
tmp = (i * n) * 50.0;
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 5.1e+19: tmp = n * 100.0 else: tmp = (i * n) * 50.0 return tmp
function code(i, n) tmp = 0.0 if (i <= 5.1e+19) tmp = Float64(n * 100.0); else tmp = Float64(Float64(i * n) * 50.0); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= 5.1e+19) tmp = n * 100.0; else tmp = (i * n) * 50.0; end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, 5.1e+19], N[(n * 100.0), $MachinePrecision], N[(N[(i * n), $MachinePrecision] * 50.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 5.1 \cdot 10^{+19}:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;\left(i \cdot n\right) \cdot 50\\
\end{array}
\end{array}
if i < 5.1e19Initial program 22.5%
Taylor expanded in i around 0 63.1%
*-commutative63.1%
Simplified63.1%
if 5.1e19 < i Initial program 46.8%
Taylor expanded in i around 0 24.3%
associate-*r*24.4%
*-commutative24.4%
associate-*r/24.4%
metadata-eval24.4%
Simplified24.4%
Taylor expanded in n around inf 25.1%
Taylor expanded in i around inf 25.1%
Final simplification52.9%
(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 29.1%
Taylor expanded in i around 0 53.7%
associate-*r*53.9%
*-commutative53.9%
associate-*r/53.9%
metadata-eval53.9%
Simplified53.9%
Taylor expanded in n around 0 2.7%
*-commutative2.7%
Simplified2.7%
Final simplification2.7%
(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 29.1%
Taylor expanded in i around 0 47.5%
*-commutative47.5%
Simplified47.5%
Final simplification47.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 2023171
(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))))