
(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 -5e-77)
(/ (+ (* t_0 100.0) -100.0) (/ i n))
(if (<= t_1 0.0)
(* 100.0 (* n (/ (expm1 (* n (log1p (/ i n)))) i)))
(if (<= t_1 INFINITY)
(* 100.0 (+ (- (/ n i) (/ n i)) (- (* (/ 1.0 i) (* n t_0)) (/ n i))))
(* n 100.0))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= -5e-77) {
tmp = ((t_0 * 100.0) + -100.0) / (i / n);
} else if (t_1 <= 0.0) {
tmp = 100.0 * (n * (expm1((n * log1p((i / n)))) / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = 100.0 * (((n / i) - (n / i)) + (((1.0 / i) * (n * t_0)) - (n / i)));
} else {
tmp = n * 100.0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= -5e-77) {
tmp = ((t_0 * 100.0) + -100.0) / (i / n);
} else if (t_1 <= 0.0) {
tmp = 100.0 * (n * (Math.expm1((n * Math.log1p((i / n)))) / i));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = 100.0 * (((n / i) - (n / i)) + (((1.0 / i) * (n * t_0)) - (n / i)));
} else {
tmp = n * 100.0;
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = (t_0 + -1.0) / (i / n) tmp = 0 if t_1 <= -5e-77: tmp = ((t_0 * 100.0) + -100.0) / (i / n) elif t_1 <= 0.0: tmp = 100.0 * (n * (math.expm1((n * math.log1p((i / n)))) / i)) elif t_1 <= math.inf: tmp = 100.0 * (((n / i) - (n / i)) + (((1.0 / i) * (n * t_0)) - (n / i))) else: tmp = n * 100.0 return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_1 <= -5e-77) tmp = Float64(Float64(Float64(t_0 * 100.0) + -100.0) / Float64(i / n)); elseif (t_1 <= 0.0) tmp = Float64(100.0 * Float64(n * Float64(expm1(Float64(n * log1p(Float64(i / n)))) / i))); elseif (t_1 <= Inf) tmp = Float64(100.0 * Float64(Float64(Float64(n / i) - Float64(n / i)) + Float64(Float64(Float64(1.0 / i) * Float64(n * t_0)) - Float64(n / i)))); else tmp = Float64(n * 100.0); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-77], N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(100.0 * N[(n * N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(100.0 * N[(N[(N[(n / i), $MachinePrecision] - N[(n / i), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(1.0 / i), $MachinePrecision] * N[(n * t$95$0), $MachinePrecision]), $MachinePrecision] - N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t_1 \leq -5 \cdot 10^{-77}:\\
\;\;\;\;\frac{t_0 \cdot 100 + -100}{\frac{i}{n}}\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{i}\right)\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;100 \cdot \left(\left(\frac{n}{i} - \frac{n}{i}\right) + \left(\frac{1}{i} \cdot \left(n \cdot t_0\right) - \frac{n}{i}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -4.99999999999999963e-77Initial program 99.6%
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 -4.99999999999999963e-77 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 0.0Initial program 24.1%
associate-*r/24.1%
sub-neg24.1%
distribute-lft-in24.1%
fma-def24.1%
metadata-eval24.1%
metadata-eval24.1%
Simplified24.1%
fma-udef24.1%
metadata-eval24.1%
metadata-eval24.1%
distribute-lft-in24.1%
sub-neg24.1%
associate-*r/24.1%
*-commutative24.1%
associate-/r/23.7%
*-commutative23.7%
pow-to-exp23.7%
expm1-def37.2%
*-commutative37.2%
log1p-udef99.0%
Applied egg-rr99.0%
if 0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 96.0%
div-sub96.1%
*-un-lft-identity96.1%
div-inv95.9%
times-frac96.1%
clear-num96.0%
*-un-lft-identity96.0%
prod-diff95.9%
Applied egg-rr95.9%
+-commutative95.9%
fma-udef95.9%
*-rgt-identity95.9%
*-rgt-identity95.9%
distribute-neg-frac95.9%
fma-udef96.0%
*-rgt-identity96.0%
unsub-neg96.0%
associate-/r/96.2%
/-rgt-identity96.2%
Simplified96.2%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
Taylor expanded in i around 0 88.4%
*-commutative88.4%
Simplified88.4%
Final simplification97.2%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 -5e-77)
(/ (+ (* t_0 100.0) -100.0) (/ i n))
(if (<= t_1 0.0)
(* (expm1 (* n (log1p (/ i n)))) (* 100.0 (/ n i)))
(if (<= t_1 INFINITY)
(* 100.0 (+ (- (/ n i) (/ n i)) (- (* (/ 1.0 i) (* n t_0)) (/ n i))))
(* n 100.0))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= -5e-77) {
tmp = ((t_0 * 100.0) + -100.0) / (i / n);
} else if (t_1 <= 0.0) {
tmp = expm1((n * log1p((i / n)))) * (100.0 * (n / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = 100.0 * (((n / i) - (n / i)) + (((1.0 / i) * (n * t_0)) - (n / i)));
} else {
tmp = n * 100.0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= -5e-77) {
tmp = ((t_0 * 100.0) + -100.0) / (i / n);
} else if (t_1 <= 0.0) {
tmp = Math.expm1((n * Math.log1p((i / n)))) * (100.0 * (n / i));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = 100.0 * (((n / i) - (n / i)) + (((1.0 / i) * (n * t_0)) - (n / i)));
} else {
tmp = n * 100.0;
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = (t_0 + -1.0) / (i / n) tmp = 0 if t_1 <= -5e-77: tmp = ((t_0 * 100.0) + -100.0) / (i / n) elif t_1 <= 0.0: tmp = math.expm1((n * math.log1p((i / n)))) * (100.0 * (n / i)) elif t_1 <= math.inf: tmp = 100.0 * (((n / i) - (n / i)) + (((1.0 / i) * (n * t_0)) - (n / i))) else: tmp = n * 100.0 return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_1 <= -5e-77) tmp = Float64(Float64(Float64(t_0 * 100.0) + -100.0) / Float64(i / n)); elseif (t_1 <= 0.0) tmp = Float64(expm1(Float64(n * log1p(Float64(i / n)))) * Float64(100.0 * Float64(n / i))); elseif (t_1 <= Inf) tmp = Float64(100.0 * Float64(Float64(Float64(n / i) - Float64(n / i)) + Float64(Float64(Float64(1.0 / i) * Float64(n * t_0)) - Float64(n / i)))); else tmp = Float64(n * 100.0); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-77], N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], 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[(100.0 * N[(N[(N[(n / i), $MachinePrecision] - N[(n / i), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(1.0 / i), $MachinePrecision] * N[(n * t$95$0), $MachinePrecision]), $MachinePrecision] - N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t_1 \leq -5 \cdot 10^{-77}:\\
\;\;\;\;\frac{t_0 \cdot 100 + -100}{\frac{i}{n}}\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;\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:\\
\;\;\;\;100 \cdot \left(\left(\frac{n}{i} - \frac{n}{i}\right) + \left(\frac{1}{i} \cdot \left(n \cdot t_0\right) - \frac{n}{i}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -4.99999999999999963e-77Initial program 99.6%
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 -4.99999999999999963e-77 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 0.0Initial program 24.1%
associate-*r/24.1%
sub-neg24.1%
distribute-lft-in24.1%
fma-def24.1%
metadata-eval24.1%
metadata-eval24.1%
Simplified24.1%
fma-udef24.1%
metadata-eval24.1%
metadata-eval24.1%
distribute-lft-in24.1%
sub-neg24.1%
associate-*r/24.1%
*-commutative24.1%
div-inv24.1%
clear-num23.7%
associate-*l*23.6%
pow-to-exp23.6%
expm1-def37.2%
*-commutative37.2%
log1p-udef97.1%
Applied egg-rr97.1%
if 0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 96.0%
div-sub96.1%
*-un-lft-identity96.1%
div-inv95.9%
times-frac96.1%
clear-num96.0%
*-un-lft-identity96.0%
prod-diff95.9%
Applied egg-rr95.9%
+-commutative95.9%
fma-udef95.9%
*-rgt-identity95.9%
*-rgt-identity95.9%
distribute-neg-frac95.9%
fma-udef96.0%
*-rgt-identity96.0%
unsub-neg96.0%
associate-/r/96.2%
/-rgt-identity96.2%
Simplified96.2%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
Taylor expanded in i around 0 88.4%
*-commutative88.4%
Simplified88.4%
Final simplification95.8%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (/ n (/ i (expm1 i)))))
(t_1 (* n (/ (* (* n 100.0) (log (/ i n))) i))))
(if (<= n -7.5e-17)
t_0
(if (<= n -8.2e-56)
t_1
(if (<= n -7e-192)
(* 100.0 (/ (expm1 i) (/ i n)))
(if (<= n 6.5e-197)
(* 100.0 (/ 0.0 (/ i n)))
(if (<= n 2.05e-75)
(* 100.0 (/ i (/ i n)))
(if (<= n 2.2e-32) t_1 t_0))))))))
double code(double i, double n) {
double t_0 = 100.0 * (n / (i / expm1(i)));
double t_1 = n * (((n * 100.0) * log((i / n))) / i);
double tmp;
if (n <= -7.5e-17) {
tmp = t_0;
} else if (n <= -8.2e-56) {
tmp = t_1;
} else if (n <= -7e-192) {
tmp = 100.0 * (expm1(i) / (i / n));
} else if (n <= 6.5e-197) {
tmp = 100.0 * (0.0 / (i / n));
} else if (n <= 2.05e-75) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 2.2e-32) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = 100.0 * (n / (i / Math.expm1(i)));
double t_1 = n * (((n * 100.0) * Math.log((i / n))) / i);
double tmp;
if (n <= -7.5e-17) {
tmp = t_0;
} else if (n <= -8.2e-56) {
tmp = t_1;
} else if (n <= -7e-192) {
tmp = 100.0 * (Math.expm1(i) / (i / n));
} else if (n <= 6.5e-197) {
tmp = 100.0 * (0.0 / (i / n));
} else if (n <= 2.05e-75) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 2.2e-32) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (n / (i / math.expm1(i))) t_1 = n * (((n * 100.0) * math.log((i / n))) / i) tmp = 0 if n <= -7.5e-17: tmp = t_0 elif n <= -8.2e-56: tmp = t_1 elif n <= -7e-192: tmp = 100.0 * (math.expm1(i) / (i / n)) elif n <= 6.5e-197: tmp = 100.0 * (0.0 / (i / n)) elif n <= 2.05e-75: tmp = 100.0 * (i / (i / n)) elif n <= 2.2e-32: tmp = t_1 else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(n / Float64(i / expm1(i)))) t_1 = Float64(n * Float64(Float64(Float64(n * 100.0) * log(Float64(i / n))) / i)) tmp = 0.0 if (n <= -7.5e-17) tmp = t_0; elseif (n <= -8.2e-56) tmp = t_1; elseif (n <= -7e-192) tmp = Float64(100.0 * Float64(expm1(i) / Float64(i / n))); elseif (n <= 6.5e-197) tmp = Float64(100.0 * Float64(0.0 / Float64(i / n))); elseif (n <= 2.05e-75) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (n <= 2.2e-32) tmp = t_1; else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(n / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(n * N[(N[(N[(n * 100.0), $MachinePrecision] * N[Log[N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -7.5e-17], t$95$0, If[LessEqual[n, -8.2e-56], t$95$1, If[LessEqual[n, -7e-192], N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 6.5e-197], N[(100.0 * N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.05e-75], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.2e-32], t$95$1, t$95$0]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\
t_1 := n \cdot \frac{\left(n \cdot 100\right) \cdot \log \left(\frac{i}{n}\right)}{i}\\
\mathbf{if}\;n \leq -7.5 \cdot 10^{-17}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq -8.2 \cdot 10^{-56}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;n \leq -7 \cdot 10^{-192}:\\
\;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 6.5 \cdot 10^{-197}:\\
\;\;\;\;100 \cdot \frac{0}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 2.05 \cdot 10^{-75}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 2.2 \cdot 10^{-32}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if n < -7.49999999999999984e-17 or 2.2e-32 < n Initial program 22.0%
Taylor expanded in n around inf 38.1%
*-commutative38.1%
associate-/l*38.1%
expm1-def91.1%
Simplified91.1%
if -7.49999999999999984e-17 < n < -8.2000000000000003e-56 or 2.05000000000000001e-75 < n < 2.2e-32Initial program 8.1%
associate-/r/8.1%
associate-*r*8.1%
*-commutative8.1%
associate-*r/8.1%
sub-neg8.1%
distribute-lft-in8.2%
fma-def8.1%
metadata-eval8.1%
metadata-eval8.1%
Simplified8.1%
fma-udef8.2%
*-commutative8.2%
Applied egg-rr8.2%
Taylor expanded in n around 0 42.3%
associate-*r*42.5%
*-commutative42.5%
mul-1-neg42.5%
log-rec42.5%
+-commutative42.5%
log-rec42.5%
unsub-neg42.5%
log-div84.3%
Simplified84.3%
if -8.2000000000000003e-56 < n < -7.00000000000000029e-192Initial program 25.6%
Taylor expanded in n around inf 16.8%
expm1-def78.9%
Simplified78.9%
if -7.00000000000000029e-192 < n < 6.4999999999999995e-197Initial program 69.9%
Taylor expanded in i around 0 80.4%
if 6.4999999999999995e-197 < n < 2.05000000000000001e-75Initial program 17.6%
Taylor expanded in i around 0 70.2%
Final simplification85.5%
(FPCore (i n)
:precision binary64
(let* ((t_0 (log (/ i n))) (t_1 (* 100.0 (/ n (/ i (expm1 i))))))
(if (<= n -7.5e-17)
t_1
(if (<= n -4.8e-56)
(/ (* (* 100.0 (* n n)) t_0) i)
(if (<= n -7.5e-192)
(* 100.0 (/ (expm1 i) (/ i n)))
(if (<= n 4e-199)
(* 100.0 (/ 0.0 (/ i n)))
(if (<= n 2.05e-75)
(* 100.0 (/ i (/ i n)))
(if (<= n 2.2e-32) (* n (/ (* (* n 100.0) t_0) i)) t_1))))))))
double code(double i, double n) {
double t_0 = log((i / n));
double t_1 = 100.0 * (n / (i / expm1(i)));
double tmp;
if (n <= -7.5e-17) {
tmp = t_1;
} else if (n <= -4.8e-56) {
tmp = ((100.0 * (n * n)) * t_0) / i;
} else if (n <= -7.5e-192) {
tmp = 100.0 * (expm1(i) / (i / n));
} else if (n <= 4e-199) {
tmp = 100.0 * (0.0 / (i / n));
} else if (n <= 2.05e-75) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 2.2e-32) {
tmp = n * (((n * 100.0) * t_0) / i);
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.log((i / n));
double t_1 = 100.0 * (n / (i / Math.expm1(i)));
double tmp;
if (n <= -7.5e-17) {
tmp = t_1;
} else if (n <= -4.8e-56) {
tmp = ((100.0 * (n * n)) * t_0) / i;
} else if (n <= -7.5e-192) {
tmp = 100.0 * (Math.expm1(i) / (i / n));
} else if (n <= 4e-199) {
tmp = 100.0 * (0.0 / (i / n));
} else if (n <= 2.05e-75) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 2.2e-32) {
tmp = n * (((n * 100.0) * t_0) / i);
} else {
tmp = t_1;
}
return tmp;
}
def code(i, n): t_0 = math.log((i / n)) t_1 = 100.0 * (n / (i / math.expm1(i))) tmp = 0 if n <= -7.5e-17: tmp = t_1 elif n <= -4.8e-56: tmp = ((100.0 * (n * n)) * t_0) / i elif n <= -7.5e-192: tmp = 100.0 * (math.expm1(i) / (i / n)) elif n <= 4e-199: tmp = 100.0 * (0.0 / (i / n)) elif n <= 2.05e-75: tmp = 100.0 * (i / (i / n)) elif n <= 2.2e-32: tmp = n * (((n * 100.0) * t_0) / i) else: tmp = t_1 return tmp
function code(i, n) t_0 = log(Float64(i / n)) t_1 = Float64(100.0 * Float64(n / Float64(i / expm1(i)))) tmp = 0.0 if (n <= -7.5e-17) tmp = t_1; elseif (n <= -4.8e-56) tmp = Float64(Float64(Float64(100.0 * Float64(n * n)) * t_0) / i); elseif (n <= -7.5e-192) tmp = Float64(100.0 * Float64(expm1(i) / Float64(i / n))); elseif (n <= 4e-199) tmp = Float64(100.0 * Float64(0.0 / Float64(i / n))); elseif (n <= 2.05e-75) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (n <= 2.2e-32) tmp = Float64(n * Float64(Float64(Float64(n * 100.0) * t_0) / i)); else tmp = t_1; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Log[N[(i / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(100.0 * N[(n / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -7.5e-17], t$95$1, If[LessEqual[n, -4.8e-56], N[(N[(N[(100.0 * N[(n * n), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] / i), $MachinePrecision], If[LessEqual[n, -7.5e-192], N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 4e-199], N[(100.0 * N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.05e-75], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.2e-32], N[(n * N[(N[(N[(n * 100.0), $MachinePrecision] * t$95$0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\frac{i}{n}\right)\\
t_1 := 100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\
\mathbf{if}\;n \leq -7.5 \cdot 10^{-17}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;n \leq -4.8 \cdot 10^{-56}:\\
\;\;\;\;\frac{\left(100 \cdot \left(n \cdot n\right)\right) \cdot t_0}{i}\\
\mathbf{elif}\;n \leq -7.5 \cdot 10^{-192}:\\
\;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 4 \cdot 10^{-199}:\\
\;\;\;\;100 \cdot \frac{0}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 2.05 \cdot 10^{-75}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 2.2 \cdot 10^{-32}:\\
\;\;\;\;n \cdot \frac{\left(n \cdot 100\right) \cdot t_0}{i}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if n < -7.49999999999999984e-17 or 2.2e-32 < n Initial program 22.0%
Taylor expanded in n around inf 38.1%
*-commutative38.1%
associate-/l*38.1%
expm1-def91.1%
Simplified91.1%
if -7.49999999999999984e-17 < n < -4.80000000000000001e-56Initial program 9.5%
associate-*r/9.5%
sub-neg9.5%
distribute-lft-in9.7%
fma-def9.5%
metadata-eval9.5%
metadata-eval9.5%
Simplified9.5%
fma-udef9.7%
metadata-eval9.7%
metadata-eval9.7%
distribute-lft-in9.5%
sub-neg9.5%
associate-*r/9.5%
*-commutative9.5%
associate-/r/9.5%
*-commutative9.5%
pow-to-exp9.5%
expm1-def99.5%
*-commutative99.5%
log1p-udef99.5%
Applied egg-rr99.5%
expm1-log1p-u99.2%
Applied egg-rr99.2%
Taylor expanded in n around 0 0.0%
associate-*r/0.0%
associate-*r*0.0%
unpow20.0%
mul-1-neg0.0%
log-rec0.0%
+-commutative0.0%
log-rec0.0%
unsub-neg0.0%
log-div97.4%
Simplified97.4%
if -4.80000000000000001e-56 < n < -7.5000000000000001e-192Initial program 25.6%
Taylor expanded in n around inf 16.8%
expm1-def78.9%
Simplified78.9%
if -7.5000000000000001e-192 < n < 3.99999999999999993e-199Initial program 69.9%
Taylor expanded in i around 0 80.4%
if 3.99999999999999993e-199 < n < 2.05000000000000001e-75Initial program 17.6%
Taylor expanded in i around 0 70.2%
if 2.05000000000000001e-75 < n < 2.2e-32Initial program 7.1%
associate-/r/7.1%
associate-*r*7.1%
*-commutative7.1%
associate-*r/7.1%
sub-neg7.1%
distribute-lft-in7.1%
fma-def7.1%
metadata-eval7.1%
metadata-eval7.1%
Simplified7.1%
fma-udef7.1%
*-commutative7.1%
Applied egg-rr7.1%
Taylor expanded in n around 0 74.0%
associate-*r*74.4%
*-commutative74.4%
mul-1-neg74.4%
log-rec74.4%
+-commutative74.4%
log-rec74.4%
unsub-neg74.4%
log-div74.4%
Simplified74.4%
Final simplification85.5%
(FPCore (i n) :precision binary64 (if (or (<= i -1100000.0) (not (<= i 3.5e+34))) (* 100.0 (/ (+ (pow (/ i n) n) -1.0) (/ i n))) (* 100.0 (/ n (/ i (expm1 i))))))
double code(double i, double n) {
double tmp;
if ((i <= -1100000.0) || !(i <= 3.5e+34)) {
tmp = 100.0 * ((pow((i / n), n) + -1.0) / (i / n));
} else {
tmp = 100.0 * (n / (i / expm1(i)));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((i <= -1100000.0) || !(i <= 3.5e+34)) {
tmp = 100.0 * ((Math.pow((i / n), n) + -1.0) / (i / n));
} else {
tmp = 100.0 * (n / (i / Math.expm1(i)));
}
return tmp;
}
def code(i, n): tmp = 0 if (i <= -1100000.0) or not (i <= 3.5e+34): tmp = 100.0 * ((math.pow((i / n), n) + -1.0) / (i / n)) else: tmp = 100.0 * (n / (i / math.expm1(i))) return tmp
function code(i, n) tmp = 0.0 if ((i <= -1100000.0) || !(i <= 3.5e+34)) tmp = Float64(100.0 * Float64(Float64((Float64(i / n) ^ n) + -1.0) / Float64(i / n))); else tmp = Float64(100.0 * Float64(n / Float64(i / expm1(i)))); end return tmp end
code[i_, n_] := If[Or[LessEqual[i, -1100000.0], N[Not[LessEqual[i, 3.5e+34]], $MachinePrecision]], N[(100.0 * N[(N[(N[Power[N[(i / n), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -1100000 \lor \neg \left(i \leq 3.5 \cdot 10^{+34}\right):\\
\;\;\;\;100 \cdot \frac{{\left(\frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\
\end{array}
\end{array}
if i < -1.1e6 or 3.49999999999999998e34 < i Initial program 55.1%
Taylor expanded in i around inf 70.4%
if -1.1e6 < i < 3.49999999999999998e34Initial program 12.6%
Taylor expanded in n around inf 17.6%
*-commutative17.6%
associate-/l*17.6%
expm1-def84.5%
Simplified84.5%
Final simplification79.2%
(FPCore (i n) :precision binary64 (if (or (<= i -6e-43) (not (<= i 1.05e-33))) (* 100.0 (/ (expm1 i) (/ i n))) (* 100.0 (+ n (* (* i n) (- 0.5 (/ 0.5 n)))))))
double code(double i, double n) {
double tmp;
if ((i <= -6e-43) || !(i <= 1.05e-33)) {
tmp = 100.0 * (expm1(i) / (i / n));
} else {
tmp = 100.0 * (n + ((i * n) * (0.5 - (0.5 / n))));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((i <= -6e-43) || !(i <= 1.05e-33)) {
tmp = 100.0 * (Math.expm1(i) / (i / n));
} else {
tmp = 100.0 * (n + ((i * n) * (0.5 - (0.5 / n))));
}
return tmp;
}
def code(i, n): tmp = 0 if (i <= -6e-43) or not (i <= 1.05e-33): tmp = 100.0 * (math.expm1(i) / (i / n)) else: tmp = 100.0 * (n + ((i * n) * (0.5 - (0.5 / n)))) return tmp
function code(i, n) tmp = 0.0 if ((i <= -6e-43) || !(i <= 1.05e-33)) tmp = Float64(100.0 * Float64(expm1(i) / Float64(i / n))); else tmp = Float64(100.0 * Float64(n + Float64(Float64(i * n) * Float64(0.5 - Float64(0.5 / n))))); end return tmp end
code[i_, n_] := If[Or[LessEqual[i, -6e-43], N[Not[LessEqual[i, 1.05e-33]], $MachinePrecision]], N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n + N[(N[(i * n), $MachinePrecision] * N[(0.5 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -6 \cdot 10^{-43} \lor \neg \left(i \leq 1.05 \cdot 10^{-33}\right):\\
\;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n + \left(i \cdot n\right) \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\\
\end{array}
\end{array}
if i < -6.00000000000000007e-43 or 1.05e-33 < i Initial program 48.7%
Taylor expanded in n around inf 53.0%
expm1-def57.1%
Simplified57.1%
if -6.00000000000000007e-43 < i < 1.05e-33Initial program 8.1%
Taylor expanded in i around 0 88.9%
associate-*r*89.0%
*-commutative89.0%
associate-*r/89.0%
metadata-eval89.0%
Simplified89.0%
Final simplification73.0%
(FPCore (i n) :precision binary64 (if (or (<= n -7.5e-192) (not (<= n 1.15e-197))) (* 100.0 (/ n (/ i (expm1 i)))) (* 100.0 (/ 0.0 (/ i n)))))
double code(double i, double n) {
double tmp;
if ((n <= -7.5e-192) || !(n <= 1.15e-197)) {
tmp = 100.0 * (n / (i / expm1(i)));
} else {
tmp = 100.0 * (0.0 / (i / n));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((n <= -7.5e-192) || !(n <= 1.15e-197)) {
tmp = 100.0 * (n / (i / Math.expm1(i)));
} else {
tmp = 100.0 * (0.0 / (i / n));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -7.5e-192) or not (n <= 1.15e-197): tmp = 100.0 * (n / (i / math.expm1(i))) else: tmp = 100.0 * (0.0 / (i / n)) return tmp
function code(i, n) tmp = 0.0 if ((n <= -7.5e-192) || !(n <= 1.15e-197)) tmp = Float64(100.0 * Float64(n / Float64(i / expm1(i)))); else tmp = Float64(100.0 * Float64(0.0 / Float64(i / n))); end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -7.5e-192], N[Not[LessEqual[n, 1.15e-197]], $MachinePrecision]], N[(100.0 * N[(n / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $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 -7.5 \cdot 10^{-192} \lor \neg \left(n \leq 1.15 \cdot 10^{-197}\right):\\
\;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{0}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -7.5000000000000001e-192 or 1.15e-197 < n Initial program 21.1%
Taylor expanded in n around inf 28.4%
*-commutative28.4%
associate-/l*28.4%
expm1-def81.1%
Simplified81.1%
if -7.5000000000000001e-192 < n < 1.15e-197Initial program 69.9%
Taylor expanded in i around 0 80.4%
Final simplification81.0%
(FPCore (i n)
:precision binary64
(if (<= n -2.6e-151)
(*
100.0
(+
n
(*
n
(+
(*
(* i i)
(+ (/ 0.3333333333333333 (* n n)) (- 0.16666666666666666 (/ 0.5 n))))
(* i (- 0.5 (/ 0.5 n)))))))
(if (<= n 5.5e-202)
(* 100.0 (/ 0.0 (/ i n)))
(*
n
(+
100.0
(* 100.0 (* i (+ (+ 0.5 (/ -0.5 n)) (* i 0.16666666666666666)))))))))
double code(double i, double n) {
double tmp;
if (n <= -2.6e-151) {
tmp = 100.0 * (n + (n * (((i * i) * ((0.3333333333333333 / (n * n)) + (0.16666666666666666 - (0.5 / n)))) + (i * (0.5 - (0.5 / n))))));
} else if (n <= 5.5e-202) {
tmp = 100.0 * (0.0 / (i / n));
} else {
tmp = n * (100.0 + (100.0 * (i * ((0.5 + (-0.5 / n)) + (i * 0.16666666666666666)))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-2.6d-151)) then
tmp = 100.0d0 * (n + (n * (((i * i) * ((0.3333333333333333d0 / (n * n)) + (0.16666666666666666d0 - (0.5d0 / n)))) + (i * (0.5d0 - (0.5d0 / n))))))
else if (n <= 5.5d-202) then
tmp = 100.0d0 * (0.0d0 / (i / n))
else
tmp = n * (100.0d0 + (100.0d0 * (i * ((0.5d0 + ((-0.5d0) / n)) + (i * 0.16666666666666666d0)))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -2.6e-151) {
tmp = 100.0 * (n + (n * (((i * i) * ((0.3333333333333333 / (n * n)) + (0.16666666666666666 - (0.5 / n)))) + (i * (0.5 - (0.5 / n))))));
} else if (n <= 5.5e-202) {
tmp = 100.0 * (0.0 / (i / n));
} else {
tmp = n * (100.0 + (100.0 * (i * ((0.5 + (-0.5 / n)) + (i * 0.16666666666666666)))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -2.6e-151: tmp = 100.0 * (n + (n * (((i * i) * ((0.3333333333333333 / (n * n)) + (0.16666666666666666 - (0.5 / n)))) + (i * (0.5 - (0.5 / n)))))) elif n <= 5.5e-202: tmp = 100.0 * (0.0 / (i / n)) else: tmp = n * (100.0 + (100.0 * (i * ((0.5 + (-0.5 / n)) + (i * 0.16666666666666666))))) return tmp
function code(i, n) tmp = 0.0 if (n <= -2.6e-151) tmp = Float64(100.0 * Float64(n + Float64(n * 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))))))); elseif (n <= 5.5e-202) tmp = Float64(100.0 * Float64(0.0 / Float64(i / n))); else tmp = Float64(n * Float64(100.0 + Float64(100.0 * Float64(i * Float64(Float64(0.5 + Float64(-0.5 / n)) + Float64(i * 0.16666666666666666)))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -2.6e-151) tmp = 100.0 * (n + (n * (((i * i) * ((0.3333333333333333 / (n * n)) + (0.16666666666666666 - (0.5 / n)))) + (i * (0.5 - (0.5 / n)))))); elseif (n <= 5.5e-202) tmp = 100.0 * (0.0 / (i / n)); else tmp = n * (100.0 + (100.0 * (i * ((0.5 + (-0.5 / n)) + (i * 0.16666666666666666))))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -2.6e-151], N[(100.0 * N[(n + N[(n * 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], If[LessEqual[n, 5.5e-202], N[(100.0 * N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(100.0 * N[(i * N[(N[(0.5 + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision] + N[(i * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.6 \cdot 10^{-151}:\\
\;\;\;\;100 \cdot \left(n + n \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{elif}\;n \leq 5.5 \cdot 10^{-202}:\\
\;\;\;\;100 \cdot \frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + 100 \cdot \left(i \cdot \left(\left(0.5 + \frac{-0.5}{n}\right) + i \cdot 0.16666666666666666\right)\right)\right)\\
\end{array}
\end{array}
if n < -2.6e-151Initial program 23.2%
Taylor expanded in i around 0 64.4%
distribute-lft-out64.6%
unpow264.6%
associate--l+64.6%
associate-*r/64.6%
metadata-eval64.6%
unpow264.6%
associate-*r/64.6%
metadata-eval64.6%
associate-*r/64.6%
metadata-eval64.6%
Simplified64.6%
if -2.6e-151 < n < 5.5e-202Initial program 65.1%
Taylor expanded in i around 0 73.3%
if 5.5e-202 < n Initial program 16.7%
associate-/r/17.1%
associate-*r*17.1%
*-commutative17.1%
associate-*r/17.1%
sub-neg17.1%
distribute-lft-in17.1%
fma-def17.1%
metadata-eval17.1%
metadata-eval17.1%
Simplified17.1%
Taylor expanded in i around 0 58.9%
distribute-lft-out58.9%
associate-*r/58.9%
metadata-eval58.9%
unpow258.9%
associate--l+58.9%
associate-*r/58.9%
metadata-eval58.9%
unpow258.9%
associate-*r/58.9%
metadata-eval58.9%
Simplified58.9%
Taylor expanded in n around inf 65.1%
*-commutative65.1%
unpow265.1%
Simplified65.1%
associate-*l*65.1%
distribute-lft-out65.1%
sub-neg65.1%
distribute-neg-frac65.1%
metadata-eval65.1%
Applied egg-rr65.1%
Final simplification66.5%
(FPCore (i n)
:precision binary64
(if (or (<= n -1.85e-153) (not (<= n 3.9e-194)))
(*
n
(+ 100.0 (* 100.0 (* i (+ (+ 0.5 (/ -0.5 n)) (* i 0.16666666666666666))))))
(* 100.0 (/ 0.0 (/ i n)))))
double code(double i, double n) {
double tmp;
if ((n <= -1.85e-153) || !(n <= 3.9e-194)) {
tmp = n * (100.0 + (100.0 * (i * ((0.5 + (-0.5 / n)) + (i * 0.16666666666666666)))));
} 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 <= (-1.85d-153)) .or. (.not. (n <= 3.9d-194))) then
tmp = n * (100.0d0 + (100.0d0 * (i * ((0.5d0 + ((-0.5d0) / n)) + (i * 0.16666666666666666d0)))))
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 <= -1.85e-153) || !(n <= 3.9e-194)) {
tmp = n * (100.0 + (100.0 * (i * ((0.5 + (-0.5 / n)) + (i * 0.16666666666666666)))));
} else {
tmp = 100.0 * (0.0 / (i / n));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -1.85e-153) or not (n <= 3.9e-194): tmp = n * (100.0 + (100.0 * (i * ((0.5 + (-0.5 / n)) + (i * 0.16666666666666666))))) else: tmp = 100.0 * (0.0 / (i / n)) return tmp
function code(i, n) tmp = 0.0 if ((n <= -1.85e-153) || !(n <= 3.9e-194)) tmp = Float64(n * Float64(100.0 + Float64(100.0 * Float64(i * Float64(Float64(0.5 + Float64(-0.5 / n)) + Float64(i * 0.16666666666666666)))))); 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 <= -1.85e-153) || ~((n <= 3.9e-194))) tmp = n * (100.0 + (100.0 * (i * ((0.5 + (-0.5 / n)) + (i * 0.16666666666666666))))); else tmp = 100.0 * (0.0 / (i / n)); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -1.85e-153], N[Not[LessEqual[n, 3.9e-194]], $MachinePrecision]], N[(n * N[(100.0 + N[(100.0 * N[(i * N[(N[(0.5 + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision] + N[(i * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 -1.85 \cdot 10^{-153} \lor \neg \left(n \leq 3.9 \cdot 10^{-194}\right):\\
\;\;\;\;n \cdot \left(100 + 100 \cdot \left(i \cdot \left(\left(0.5 + \frac{-0.5}{n}\right) + i \cdot 0.16666666666666666\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{0}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -1.8500000000000001e-153 or 3.8999999999999999e-194 < n Initial program 19.7%
associate-/r/19.6%
associate-*r*19.6%
*-commutative19.6%
associate-*r/19.6%
sub-neg19.6%
distribute-lft-in19.6%
fma-def19.6%
metadata-eval19.6%
metadata-eval19.6%
Simplified19.6%
Taylor expanded in i around 0 61.5%
distribute-lft-out61.5%
associate-*r/61.5%
metadata-eval61.5%
unpow261.5%
associate--l+61.5%
associate-*r/61.5%
metadata-eval61.5%
unpow261.5%
associate-*r/61.5%
metadata-eval61.5%
Simplified61.5%
Taylor expanded in n around inf 64.9%
*-commutative64.9%
unpow264.9%
Simplified64.9%
associate-*l*64.9%
distribute-lft-out64.9%
sub-neg64.9%
distribute-neg-frac64.9%
metadata-eval64.9%
Applied egg-rr64.9%
if -1.8500000000000001e-153 < n < 3.8999999999999999e-194Initial program 65.1%
Taylor expanded in i around 0 73.3%
Final simplification66.5%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* i (+ (+ 0.5 (/ -0.5 n)) (* i 0.16666666666666666)))))
(if (<= n -3.1e-146)
(+ (* n 100.0) (* (* n 100.0) t_0))
(if (<= n 1.65e-196)
(* 100.0 (/ 0.0 (/ i n)))
(* n (+ 100.0 (* 100.0 t_0)))))))
double code(double i, double n) {
double t_0 = i * ((0.5 + (-0.5 / n)) + (i * 0.16666666666666666));
double tmp;
if (n <= -3.1e-146) {
tmp = (n * 100.0) + ((n * 100.0) * t_0);
} else if (n <= 1.65e-196) {
tmp = 100.0 * (0.0 / (i / n));
} else {
tmp = n * (100.0 + (100.0 * t_0));
}
return tmp;
}
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 = i * ((0.5d0 + ((-0.5d0) / n)) + (i * 0.16666666666666666d0))
if (n <= (-3.1d-146)) then
tmp = (n * 100.0d0) + ((n * 100.0d0) * t_0)
else if (n <= 1.65d-196) then
tmp = 100.0d0 * (0.0d0 / (i / n))
else
tmp = n * (100.0d0 + (100.0d0 * t_0))
end if
code = tmp
end function
public static double code(double i, double n) {
double t_0 = i * ((0.5 + (-0.5 / n)) + (i * 0.16666666666666666));
double tmp;
if (n <= -3.1e-146) {
tmp = (n * 100.0) + ((n * 100.0) * t_0);
} else if (n <= 1.65e-196) {
tmp = 100.0 * (0.0 / (i / n));
} else {
tmp = n * (100.0 + (100.0 * t_0));
}
return tmp;
}
def code(i, n): t_0 = i * ((0.5 + (-0.5 / n)) + (i * 0.16666666666666666)) tmp = 0 if n <= -3.1e-146: tmp = (n * 100.0) + ((n * 100.0) * t_0) elif n <= 1.65e-196: tmp = 100.0 * (0.0 / (i / n)) else: tmp = n * (100.0 + (100.0 * t_0)) return tmp
function code(i, n) t_0 = Float64(i * Float64(Float64(0.5 + Float64(-0.5 / n)) + Float64(i * 0.16666666666666666))) tmp = 0.0 if (n <= -3.1e-146) tmp = Float64(Float64(n * 100.0) + Float64(Float64(n * 100.0) * t_0)); elseif (n <= 1.65e-196) tmp = Float64(100.0 * Float64(0.0 / Float64(i / n))); else tmp = Float64(n * Float64(100.0 + Float64(100.0 * t_0))); end return tmp end
function tmp_2 = code(i, n) t_0 = i * ((0.5 + (-0.5 / n)) + (i * 0.16666666666666666)); tmp = 0.0; if (n <= -3.1e-146) tmp = (n * 100.0) + ((n * 100.0) * t_0); elseif (n <= 1.65e-196) tmp = 100.0 * (0.0 / (i / n)); else tmp = n * (100.0 + (100.0 * t_0)); end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(i * N[(N[(0.5 + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision] + N[(i * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -3.1e-146], N[(N[(n * 100.0), $MachinePrecision] + N[(N[(n * 100.0), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.65e-196], N[(100.0 * N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(100.0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := i \cdot \left(\left(0.5 + \frac{-0.5}{n}\right) + i \cdot 0.16666666666666666\right)\\
\mathbf{if}\;n \leq -3.1 \cdot 10^{-146}:\\
\;\;\;\;n \cdot 100 + \left(n \cdot 100\right) \cdot t_0\\
\mathbf{elif}\;n \leq 1.65 \cdot 10^{-196}:\\
\;\;\;\;100 \cdot \frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + 100 \cdot t_0\right)\\
\end{array}
\end{array}
if n < -3.0999999999999998e-146Initial program 23.2%
associate-/r/22.6%
associate-*r*22.6%
*-commutative22.6%
associate-*r/22.6%
sub-neg22.6%
distribute-lft-in22.6%
fma-def22.6%
metadata-eval22.6%
metadata-eval22.6%
Simplified22.6%
Taylor expanded in i around 0 64.6%
distribute-lft-out64.6%
associate-*r/64.6%
metadata-eval64.6%
unpow264.6%
associate--l+64.6%
associate-*r/64.6%
metadata-eval64.6%
unpow264.6%
associate-*r/64.6%
metadata-eval64.6%
Simplified64.6%
Taylor expanded in n around inf 64.6%
*-commutative64.6%
unpow264.6%
Simplified64.6%
+-commutative64.6%
distribute-lft-in64.6%
associate-*r*64.6%
associate-*l*64.6%
distribute-lft-out64.6%
sub-neg64.6%
distribute-neg-frac64.6%
metadata-eval64.6%
Applied egg-rr64.6%
if -3.0999999999999998e-146 < n < 1.64999999999999999e-196Initial program 65.1%
Taylor expanded in i around 0 73.3%
if 1.64999999999999999e-196 < n Initial program 16.7%
associate-/r/17.1%
associate-*r*17.1%
*-commutative17.1%
associate-*r/17.1%
sub-neg17.1%
distribute-lft-in17.1%
fma-def17.1%
metadata-eval17.1%
metadata-eval17.1%
Simplified17.1%
Taylor expanded in i around 0 58.9%
distribute-lft-out58.9%
associate-*r/58.9%
metadata-eval58.9%
unpow258.9%
associate--l+58.9%
associate-*r/58.9%
metadata-eval58.9%
unpow258.9%
associate-*r/58.9%
metadata-eval58.9%
Simplified58.9%
Taylor expanded in n around inf 65.1%
*-commutative65.1%
unpow265.1%
Simplified65.1%
associate-*l*65.1%
distribute-lft-out65.1%
sub-neg65.1%
distribute-neg-frac65.1%
metadata-eval65.1%
Applied egg-rr65.1%
Final simplification66.5%
(FPCore (i n) :precision binary64 (if (or (<= n -1.5e-151) (not (<= n 3.8e-193))) (* n (+ 100.0 (* (* i i) 16.666666666666668))) (* 100.0 (/ 0.0 (/ i n)))))
double code(double i, double n) {
double tmp;
if ((n <= -1.5e-151) || !(n <= 3.8e-193)) {
tmp = n * (100.0 + ((i * i) * 16.666666666666668));
} 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 <= (-1.5d-151)) .or. (.not. (n <= 3.8d-193))) then
tmp = n * (100.0d0 + ((i * i) * 16.666666666666668d0))
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 <= -1.5e-151) || !(n <= 3.8e-193)) {
tmp = n * (100.0 + ((i * i) * 16.666666666666668));
} else {
tmp = 100.0 * (0.0 / (i / n));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -1.5e-151) or not (n <= 3.8e-193): tmp = n * (100.0 + ((i * i) * 16.666666666666668)) else: tmp = 100.0 * (0.0 / (i / n)) return tmp
function code(i, n) tmp = 0.0 if ((n <= -1.5e-151) || !(n <= 3.8e-193)) tmp = Float64(n * Float64(100.0 + Float64(Float64(i * i) * 16.666666666666668))); 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 <= -1.5e-151) || ~((n <= 3.8e-193))) tmp = n * (100.0 + ((i * i) * 16.666666666666668)); else tmp = 100.0 * (0.0 / (i / n)); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -1.5e-151], N[Not[LessEqual[n, 3.8e-193]], $MachinePrecision]], N[(n * N[(100.0 + N[(N[(i * i), $MachinePrecision] * 16.666666666666668), $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 -1.5 \cdot 10^{-151} \lor \neg \left(n \leq 3.8 \cdot 10^{-193}\right):\\
\;\;\;\;n \cdot \left(100 + \left(i \cdot i\right) \cdot 16.666666666666668\right)\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{0}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -1.5e-151 or 3.80000000000000004e-193 < n Initial program 19.7%
associate-/r/19.6%
associate-*r*19.6%
*-commutative19.6%
associate-*r/19.6%
sub-neg19.6%
distribute-lft-in19.6%
fma-def19.6%
metadata-eval19.6%
metadata-eval19.6%
Simplified19.6%
Taylor expanded in i around 0 61.5%
distribute-lft-out61.5%
associate-*r/61.5%
metadata-eval61.5%
unpow261.5%
associate--l+61.5%
associate-*r/61.5%
metadata-eval61.5%
unpow261.5%
associate-*r/61.5%
metadata-eval61.5%
Simplified61.5%
Taylor expanded in n around inf 64.9%
*-commutative64.9%
unpow264.9%
Simplified64.9%
Taylor expanded in i around inf 64.0%
*-commutative64.0%
unpow264.0%
Simplified64.0%
if -1.5e-151 < n < 3.80000000000000004e-193Initial program 65.1%
Taylor expanded in i around 0 73.3%
Final simplification65.8%
(FPCore (i n) :precision binary64 (if (or (<= n -1.35e-151) (not (<= n 4.2e-195))) (* n (+ 100.0 (* i 50.0))) (* 100.0 (/ 0.0 (/ i n)))))
double code(double i, double n) {
double tmp;
if ((n <= -1.35e-151) || !(n <= 4.2e-195)) {
tmp = n * (100.0 + (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 <= (-1.35d-151)) .or. (.not. (n <= 4.2d-195))) then
tmp = n * (100.0d0 + (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 <= -1.35e-151) || !(n <= 4.2e-195)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 100.0 * (0.0 / (i / n));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -1.35e-151) or not (n <= 4.2e-195): tmp = n * (100.0 + (i * 50.0)) else: tmp = 100.0 * (0.0 / (i / n)) return tmp
function code(i, n) tmp = 0.0 if ((n <= -1.35e-151) || !(n <= 4.2e-195)) tmp = Float64(n * Float64(100.0 + 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 <= -1.35e-151) || ~((n <= 4.2e-195))) tmp = n * (100.0 + (i * 50.0)); else tmp = 100.0 * (0.0 / (i / n)); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -1.35e-151], N[Not[LessEqual[n, 4.2e-195]], $MachinePrecision]], N[(n * N[(100.0 + 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 -1.35 \cdot 10^{-151} \lor \neg \left(n \leq 4.2 \cdot 10^{-195}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{0}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -1.35000000000000004e-151 or 4.2e-195 < n Initial program 19.7%
associate-/r/19.6%
associate-*r*19.6%
*-commutative19.6%
associate-*r/19.6%
sub-neg19.6%
distribute-lft-in19.6%
fma-def19.6%
metadata-eval19.6%
metadata-eval19.6%
Simplified19.6%
Taylor expanded in i around 0 62.2%
associate-*r*62.2%
*-commutative62.2%
associate-*r/62.2%
metadata-eval62.2%
Simplified62.2%
Taylor expanded in n around inf 62.1%
*-commutative62.1%
Simplified62.1%
if -1.35000000000000004e-151 < n < 4.2e-195Initial program 65.1%
Taylor expanded in i around 0 73.3%
Final simplification64.2%
(FPCore (i n) :precision binary64 (if (<= i -1e+122) (* 100.0 (* i (/ n i))) (if (<= i 7e+39) (* n 100.0) (* 16.666666666666668 (* n (* i i))))))
double code(double i, double n) {
double tmp;
if (i <= -1e+122) {
tmp = 100.0 * (i * (n / i));
} else if (i <= 7e+39) {
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 <= (-1d+122)) then
tmp = 100.0d0 * (i * (n / i))
else if (i <= 7d+39) 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 <= -1e+122) {
tmp = 100.0 * (i * (n / i));
} else if (i <= 7e+39) {
tmp = n * 100.0;
} else {
tmp = 16.666666666666668 * (n * (i * i));
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -1e+122: tmp = 100.0 * (i * (n / i)) elif i <= 7e+39: tmp = n * 100.0 else: tmp = 16.666666666666668 * (n * (i * i)) return tmp
function code(i, n) tmp = 0.0 if (i <= -1e+122) tmp = Float64(100.0 * Float64(i * Float64(n / i))); elseif (i <= 7e+39) 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 <= -1e+122) tmp = 100.0 * (i * (n / i)); elseif (i <= 7e+39) tmp = n * 100.0; else tmp = 16.666666666666668 * (n * (i * i)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -1e+122], N[(100.0 * N[(i * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 7e+39], 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 -1 \cdot 10^{+122}:\\
\;\;\;\;100 \cdot \left(i \cdot \frac{n}{i}\right)\\
\mathbf{elif}\;i \leq 7 \cdot 10^{+39}:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;16.666666666666668 \cdot \left(n \cdot \left(i \cdot i\right)\right)\\
\end{array}
\end{array}
if i < -1.00000000000000001e122Initial program 73.5%
Taylor expanded in i around 0 38.9%
div-inv38.9%
clear-num34.5%
Applied egg-rr34.5%
if -1.00000000000000001e122 < i < 7.0000000000000003e39Initial program 20.0%
Taylor expanded in i around 0 64.9%
*-commutative64.9%
Simplified64.9%
if 7.0000000000000003e39 < i Initial program 45.4%
associate-/r/45.6%
associate-*r*45.6%
*-commutative45.6%
associate-*r/45.5%
sub-neg45.5%
distribute-lft-in45.5%
fma-def45.5%
metadata-eval45.5%
metadata-eval45.5%
Simplified45.5%
Taylor expanded in i around 0 37.7%
distribute-lft-out37.7%
associate-*r/37.7%
metadata-eval37.7%
unpow237.7%
associate--l+37.7%
associate-*r/37.7%
metadata-eval37.7%
unpow237.7%
associate-*r/37.7%
metadata-eval37.7%
Simplified37.7%
Taylor expanded in n around inf 38.0%
*-commutative38.0%
unpow238.0%
Simplified38.0%
Taylor expanded in i around inf 38.3%
unpow238.3%
Simplified38.3%
Final simplification58.4%
(FPCore (i n) :precision binary64 (if (<= i -1e+119) (* 100.0 (/ i (/ i n))) (if (<= i 7e+39) (* n 100.0) (* 16.666666666666668 (* n (* i i))))))
double code(double i, double n) {
double tmp;
if (i <= -1e+119) {
tmp = 100.0 * (i / (i / n));
} else if (i <= 7e+39) {
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 <= (-1d+119)) then
tmp = 100.0d0 * (i / (i / n))
else if (i <= 7d+39) 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 <= -1e+119) {
tmp = 100.0 * (i / (i / n));
} else if (i <= 7e+39) {
tmp = n * 100.0;
} else {
tmp = 16.666666666666668 * (n * (i * i));
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -1e+119: tmp = 100.0 * (i / (i / n)) elif i <= 7e+39: tmp = n * 100.0 else: tmp = 16.666666666666668 * (n * (i * i)) return tmp
function code(i, n) tmp = 0.0 if (i <= -1e+119) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (i <= 7e+39) 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 <= -1e+119) tmp = 100.0 * (i / (i / n)); elseif (i <= 7e+39) tmp = n * 100.0; else tmp = 16.666666666666668 * (n * (i * i)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -1e+119], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 7e+39], 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 -1 \cdot 10^{+119}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;i \leq 7 \cdot 10^{+39}:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;16.666666666666668 \cdot \left(n \cdot \left(i \cdot i\right)\right)\\
\end{array}
\end{array}
if i < -9.99999999999999944e118Initial program 71.6%
Taylor expanded in i around 0 35.8%
if -9.99999999999999944e118 < i < 7.0000000000000003e39Initial program 19.7%
Taylor expanded in i around 0 65.6%
*-commutative65.6%
Simplified65.6%
if 7.0000000000000003e39 < i Initial program 45.4%
associate-/r/45.6%
associate-*r*45.6%
*-commutative45.6%
associate-*r/45.5%
sub-neg45.5%
distribute-lft-in45.5%
fma-def45.5%
metadata-eval45.5%
metadata-eval45.5%
Simplified45.5%
Taylor expanded in i around 0 37.7%
distribute-lft-out37.7%
associate-*r/37.7%
metadata-eval37.7%
unpow237.7%
associate--l+37.7%
associate-*r/37.7%
metadata-eval37.7%
unpow237.7%
associate-*r/37.7%
metadata-eval37.7%
Simplified37.7%
Taylor expanded in n around inf 38.0%
*-commutative38.0%
unpow238.0%
Simplified38.0%
Taylor expanded in i around inf 38.3%
unpow238.3%
Simplified38.3%
Final simplification58.7%
(FPCore (i n)
:precision binary64
(if (<= i -1.5)
(* 100.0 (/ i (/ i n)))
(if (<= i 3.9e+87)
(* n (+ 100.0 (* i 50.0)))
(* 16.666666666666668 (* n (* i i))))))
double code(double i, double n) {
double tmp;
if (i <= -1.5) {
tmp = 100.0 * (i / (i / n));
} else if (i <= 3.9e+87) {
tmp = n * (100.0 + (i * 50.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 <= (-1.5d0)) then
tmp = 100.0d0 * (i / (i / n))
else if (i <= 3.9d+87) then
tmp = n * (100.0d0 + (i * 50.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 <= -1.5) {
tmp = 100.0 * (i / (i / n));
} else if (i <= 3.9e+87) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 16.666666666666668 * (n * (i * i));
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -1.5: tmp = 100.0 * (i / (i / n)) elif i <= 3.9e+87: tmp = n * (100.0 + (i * 50.0)) else: tmp = 16.666666666666668 * (n * (i * i)) return tmp
function code(i, n) tmp = 0.0 if (i <= -1.5) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (i <= 3.9e+87) tmp = Float64(n * Float64(100.0 + Float64(i * 50.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 <= -1.5) tmp = 100.0 * (i / (i / n)); elseif (i <= 3.9e+87) tmp = n * (100.0 + (i * 50.0)); else tmp = 16.666666666666668 * (n * (i * i)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -1.5], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 3.9e+87], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(16.666666666666668 * N[(n * N[(i * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -1.5:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;i \leq 3.9 \cdot 10^{+87}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;16.666666666666668 \cdot \left(n \cdot \left(i \cdot i\right)\right)\\
\end{array}
\end{array}
if i < -1.5Initial program 60.1%
Taylor expanded in i around 0 19.0%
if -1.5 < i < 3.9000000000000002e87Initial program 14.4%
associate-/r/14.8%
associate-*r*14.8%
*-commutative14.8%
associate-*r/14.8%
sub-neg14.8%
distribute-lft-in14.8%
fma-def14.8%
metadata-eval14.8%
metadata-eval14.8%
Simplified14.8%
Taylor expanded in i around 0 74.6%
associate-*r*74.6%
*-commutative74.6%
associate-*r/74.6%
metadata-eval74.6%
Simplified74.6%
Taylor expanded in n around inf 74.8%
*-commutative74.8%
Simplified74.8%
if 3.9000000000000002e87 < i Initial program 50.1%
associate-/r/50.2%
associate-*r*50.2%
*-commutative50.2%
associate-*r/50.2%
sub-neg50.2%
distribute-lft-in50.2%
fma-def50.2%
metadata-eval50.2%
metadata-eval50.2%
Simplified50.2%
Taylor expanded in i around 0 44.0%
distribute-lft-out44.0%
associate-*r/44.0%
metadata-eval44.0%
unpow244.0%
associate--l+44.0%
associate-*r/44.0%
metadata-eval44.0%
unpow244.0%
associate-*r/44.0%
metadata-eval44.0%
Simplified44.0%
Taylor expanded in n around inf 44.1%
*-commutative44.1%
unpow244.1%
Simplified44.1%
Taylor expanded in i around inf 44.3%
unpow244.3%
Simplified44.3%
Final simplification59.3%
(FPCore (i n) :precision binary64 (if (<= i 7e+39) (* n 100.0) (* 16.666666666666668 (* n (* i i)))))
double code(double i, double n) {
double tmp;
if (i <= 7e+39) {
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 <= 7d+39) 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 <= 7e+39) {
tmp = n * 100.0;
} else {
tmp = 16.666666666666668 * (n * (i * i));
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 7e+39: tmp = n * 100.0 else: tmp = 16.666666666666668 * (n * (i * i)) return tmp
function code(i, n) tmp = 0.0 if (i <= 7e+39) 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 <= 7e+39) tmp = n * 100.0; else tmp = 16.666666666666668 * (n * (i * i)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, 7e+39], 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 7 \cdot 10^{+39}:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;16.666666666666668 \cdot \left(n \cdot \left(i \cdot i\right)\right)\\
\end{array}
\end{array}
if i < 7.0000000000000003e39Initial program 25.4%
Taylor expanded in i around 0 58.8%
*-commutative58.8%
Simplified58.8%
if 7.0000000000000003e39 < i Initial program 45.4%
associate-/r/45.6%
associate-*r*45.6%
*-commutative45.6%
associate-*r/45.5%
sub-neg45.5%
distribute-lft-in45.5%
fma-def45.5%
metadata-eval45.5%
metadata-eval45.5%
Simplified45.5%
Taylor expanded in i around 0 37.7%
distribute-lft-out37.7%
associate-*r/37.7%
metadata-eval37.7%
unpow237.7%
associate--l+37.7%
associate-*r/37.7%
metadata-eval37.7%
unpow237.7%
associate-*r/37.7%
metadata-eval37.7%
Simplified37.7%
Taylor expanded in n around inf 38.0%
*-commutative38.0%
unpow238.0%
Simplified38.0%
Taylor expanded in i around inf 38.3%
unpow238.3%
Simplified38.3%
Final simplification55.8%
(FPCore (i n) :precision binary64 (* i -50.0))
double code(double i, double n) {
return i * -50.0;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = i * (-50.0d0)
end function
public static double code(double i, double n) {
return i * -50.0;
}
def code(i, n): return i * -50.0
function code(i, n) return Float64(i * -50.0) end
function tmp = code(i, n) tmp = i * -50.0; end
code[i_, n_] := N[(i * -50.0), $MachinePrecision]
\begin{array}{l}
\\
i \cdot -50
\end{array}
Initial program 28.4%
associate-/r/28.3%
associate-*r*28.4%
*-commutative28.4%
associate-*r/28.4%
sub-neg28.4%
distribute-lft-in28.4%
fma-def28.4%
metadata-eval28.4%
metadata-eval28.4%
Simplified28.4%
Taylor expanded in i around 0 53.6%
associate-*r*53.6%
*-commutative53.6%
associate-*r/53.6%
metadata-eval53.6%
Simplified53.6%
Taylor expanded in n around 0 3.1%
*-commutative3.1%
Simplified3.1%
Final simplification3.1%
(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 28.4%
Taylor expanded in i around 0 50.9%
*-commutative50.9%
Simplified50.9%
Final simplification50.9%
(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 2023224
(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))))