
(FPCore (i n) :precision binary64 (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))
double code(double i, double n) {
return 100.0 * ((pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 100.0d0 * ((((1.0d0 + (i / n)) ** n) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
return 100.0 * ((Math.pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
def code(i, n): return 100.0 * ((math.pow((1.0 + (i / n)), n) - 1.0) / (i / n))
function code(i, n) return Float64(100.0 * Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) - 1.0) / Float64(i / n))) end
function tmp = code(i, n) tmp = 100.0 * ((((1.0 + (i / n)) ^ n) - 1.0) / (i / n)); end
code[i_, n_] := N[(100.0 * N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (i n) :precision binary64 (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))
double code(double i, double n) {
return 100.0 * ((pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 100.0d0 * ((((1.0d0 + (i / n)) ** n) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
return 100.0 * ((Math.pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
def code(i, n): return 100.0 * ((math.pow((1.0 + (i / n)), n) - 1.0) / (i / n))
function code(i, n) return Float64(100.0 * Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) - 1.0) / Float64(i / n))) end
function tmp = code(i, n) tmp = 100.0 * ((((1.0 + (i / n)) ^ n) - 1.0) / (i / n)); end
code[i_, n_] := N[(100.0 * N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}
\end{array}
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 1e-193)
(* n (/ (expm1 (* n (log1p (/ i n)))) (/ i 100.0)))
(if (<= t_1 INFINITY) (* n (/ (+ (* t_0 100.0) -100.0) i)) (* n 100.0)))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 1e-193) {
tmp = n * (expm1((n * log1p((i / n)))) / (i / 100.0));
} else if (t_1 <= ((double) INFINITY)) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else {
tmp = n * 100.0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 1e-193) {
tmp = n * (Math.expm1((n * Math.log1p((i / n)))) / (i / 100.0));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else {
tmp = n * 100.0;
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = (t_0 + -1.0) / (i / n) tmp = 0 if t_1 <= 1e-193: tmp = n * (math.expm1((n * math.log1p((i / n)))) / (i / 100.0)) elif t_1 <= math.inf: tmp = n * (((t_0 * 100.0) + -100.0) / i) else: tmp = n * 100.0 return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_1 <= 1e-193) tmp = Float64(n * Float64(expm1(Float64(n * log1p(Float64(i / n)))) / Float64(i / 100.0))); elseif (t_1 <= Inf) tmp = Float64(n * Float64(Float64(Float64(t_0 * 100.0) + -100.0) / i)); else tmp = Float64(n * 100.0); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 1e-193], N[(n * N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] / N[(i / 100.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(n * N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(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 10^{-193}:\\
\;\;\;\;n \cdot \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{\frac{i}{100}}\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;n \cdot \frac{t_0 \cdot 100 + -100}{i}\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 1e-193Initial program 28.9%
associate-/r/28.6%
associate-*r*28.6%
*-commutative28.6%
associate-*r/28.6%
sub-neg28.6%
distribute-lft-in28.6%
fma-def28.6%
metadata-eval28.6%
metadata-eval28.6%
Simplified28.6%
fma-udef28.6%
metadata-eval28.6%
metadata-eval28.6%
distribute-lft-in28.6%
sub-neg28.6%
*-commutative28.6%
pow-to-exp27.6%
expm1-def42.4%
add-log-exp27.6%
pow-to-exp28.6%
log-pow42.4%
log1p-udef97.7%
Applied egg-rr97.7%
*-un-lft-identity97.7%
associate-/l*97.7%
Applied egg-rr97.7%
*-lft-identity97.7%
Simplified97.7%
if 1e-193 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 98.0%
associate-/r/98.0%
associate-*r*98.0%
*-commutative98.0%
associate-*r/98.0%
sub-neg98.0%
distribute-lft-in98.0%
fma-def98.0%
metadata-eval98.0%
metadata-eval98.0%
Simplified98.0%
fma-udef98.0%
*-commutative98.0%
Applied egg-rr98.0%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
Taylor expanded in i around 0 76.2%
*-commutative76.2%
Simplified76.2%
Final simplification94.8%
(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 1e-193)
(* 100.0 (* n (/ (expm1 (* n (log1p (/ i n)))) i)))
(if (<= t_1 INFINITY) (* n (/ (+ (* t_0 100.0) -100.0) i)) (* n 100.0)))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 1e-193) {
tmp = 100.0 * (n * (expm1((n * log1p((i / n)))) / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else {
tmp = n * 100.0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 1e-193) {
tmp = 100.0 * (n * (Math.expm1((n * Math.log1p((i / n)))) / i));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else {
tmp = n * 100.0;
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = (t_0 + -1.0) / (i / n) tmp = 0 if t_1 <= 1e-193: tmp = 100.0 * (n * (math.expm1((n * math.log1p((i / n)))) / i)) elif t_1 <= math.inf: tmp = n * (((t_0 * 100.0) + -100.0) / i) else: tmp = n * 100.0 return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_1 <= 1e-193) tmp = Float64(100.0 * Float64(n * Float64(expm1(Float64(n * log1p(Float64(i / n)))) / i))); elseif (t_1 <= Inf) tmp = Float64(n * Float64(Float64(Float64(t_0 * 100.0) + -100.0) / i)); else tmp = Float64(n * 100.0); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 1e-193], 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[(n * N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t_1 \leq 10^{-193}:\\
\;\;\;\;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:\\
\;\;\;\;n \cdot \frac{t_0 \cdot 100 + -100}{i}\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 1e-193Initial program 28.9%
associate-/r/28.6%
pow-to-exp27.6%
expm1-def42.3%
add-log-exp27.6%
pow-to-exp28.6%
log-pow42.3%
log1p-udef97.6%
Applied egg-rr97.6%
if 1e-193 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 98.0%
associate-/r/98.0%
associate-*r*98.0%
*-commutative98.0%
associate-*r/98.0%
sub-neg98.0%
distribute-lft-in98.0%
fma-def98.0%
metadata-eval98.0%
metadata-eval98.0%
Simplified98.0%
fma-udef98.0%
*-commutative98.0%
Applied egg-rr98.0%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
Taylor expanded in i around 0 76.2%
*-commutative76.2%
Simplified76.2%
Final simplification94.7%
(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 1e-193)
(* n (* 100.0 (/ (expm1 (* n (log1p (/ i n)))) i)))
(if (<= t_1 INFINITY) (* n (/ (+ (* t_0 100.0) -100.0) i)) (* n 100.0)))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 1e-193) {
tmp = n * (100.0 * (expm1((n * log1p((i / n)))) / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else {
tmp = n * 100.0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 1e-193) {
tmp = n * (100.0 * (Math.expm1((n * Math.log1p((i / n)))) / i));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else {
tmp = n * 100.0;
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = (t_0 + -1.0) / (i / n) tmp = 0 if t_1 <= 1e-193: tmp = n * (100.0 * (math.expm1((n * math.log1p((i / n)))) / i)) elif t_1 <= math.inf: tmp = n * (((t_0 * 100.0) + -100.0) / i) else: tmp = n * 100.0 return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_1 <= 1e-193) tmp = Float64(n * Float64(100.0 * Float64(expm1(Float64(n * log1p(Float64(i / n)))) / i))); elseif (t_1 <= Inf) tmp = Float64(n * Float64(Float64(Float64(t_0 * 100.0) + -100.0) / i)); else tmp = Float64(n * 100.0); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 1e-193], N[(n * N[(100.0 * N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(n * N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t_1 \leq 10^{-193}:\\
\;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{i}\right)\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;n \cdot \frac{t_0 \cdot 100 + -100}{i}\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 1e-193Initial program 28.9%
associate-/r/28.6%
associate-*r*28.6%
*-commutative28.6%
associate-*r/28.6%
sub-neg28.6%
distribute-lft-in28.6%
fma-def28.6%
metadata-eval28.6%
metadata-eval28.6%
Simplified28.6%
fma-udef28.6%
metadata-eval28.6%
metadata-eval28.6%
distribute-lft-in28.6%
sub-neg28.6%
*-commutative28.6%
pow-to-exp27.6%
expm1-def42.4%
add-log-exp27.6%
pow-to-exp28.6%
log-pow42.4%
log1p-udef97.7%
Applied egg-rr97.7%
*-un-lft-identity97.7%
associate-/l*97.7%
Applied egg-rr97.7%
*-lft-identity97.7%
Simplified97.7%
associate-/r/97.7%
Applied egg-rr97.7%
if 1e-193 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 98.0%
associate-/r/98.0%
associate-*r*98.0%
*-commutative98.0%
associate-*r/98.0%
sub-neg98.0%
distribute-lft-in98.0%
fma-def98.0%
metadata-eval98.0%
metadata-eval98.0%
Simplified98.0%
fma-udef98.0%
*-commutative98.0%
Applied egg-rr98.0%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
Taylor expanded in i around 0 76.2%
*-commutative76.2%
Simplified76.2%
Final simplification94.8%
(FPCore (i n)
:precision binary64
(if (<= i -1.9)
(* 100.0 (/ 0.0 (/ i n)))
(if (<= i 2.9e-186)
(* 100.0 (+ n (* (* i n) (- 0.5 (/ 0.5 n)))))
(if (<= i 2.6e-14)
(* 100.0 (/ (* i n) i))
(* 100.0 (cbrt (* n (* n n))))))))
double code(double i, double n) {
double tmp;
if (i <= -1.9) {
tmp = 100.0 * (0.0 / (i / n));
} else if (i <= 2.9e-186) {
tmp = 100.0 * (n + ((i * n) * (0.5 - (0.5 / n))));
} else if (i <= 2.6e-14) {
tmp = 100.0 * ((i * n) / i);
} else {
tmp = 100.0 * cbrt((n * (n * n)));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if (i <= -1.9) {
tmp = 100.0 * (0.0 / (i / n));
} else if (i <= 2.9e-186) {
tmp = 100.0 * (n + ((i * n) * (0.5 - (0.5 / n))));
} else if (i <= 2.6e-14) {
tmp = 100.0 * ((i * n) / i);
} else {
tmp = 100.0 * Math.cbrt((n * (n * n)));
}
return tmp;
}
function code(i, n) tmp = 0.0 if (i <= -1.9) tmp = Float64(100.0 * Float64(0.0 / Float64(i / n))); elseif (i <= 2.9e-186) tmp = Float64(100.0 * Float64(n + Float64(Float64(i * n) * Float64(0.5 - Float64(0.5 / n))))); elseif (i <= 2.6e-14) tmp = Float64(100.0 * Float64(Float64(i * n) / i)); else tmp = Float64(100.0 * cbrt(Float64(n * Float64(n * n)))); end return tmp end
code[i_, n_] := If[LessEqual[i, -1.9], N[(100.0 * N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 2.9e-186], N[(100.0 * N[(n + N[(N[(i * n), $MachinePrecision] * N[(0.5 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 2.6e-14], N[(100.0 * N[(N[(i * n), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[Power[N[(n * N[(n * n), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -1.9:\\
\;\;\;\;100 \cdot \frac{0}{\frac{i}{n}}\\
\mathbf{elif}\;i \leq 2.9 \cdot 10^{-186}:\\
\;\;\;\;100 \cdot \left(n + \left(i \cdot n\right) \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\\
\mathbf{elif}\;i \leq 2.6 \cdot 10^{-14}:\\
\;\;\;\;100 \cdot \frac{i \cdot n}{i}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \sqrt[3]{n \cdot \left(n \cdot n\right)}\\
\end{array}
\end{array}
if i < -1.8999999999999999Initial program 50.9%
Taylor expanded in i around 0 30.7%
if -1.8999999999999999 < i < 2.90000000000000019e-186Initial program 8.4%
Taylor expanded in i around 0 83.3%
associate-*r*83.6%
*-commutative83.6%
associate-*r/83.6%
metadata-eval83.6%
Simplified83.6%
if 2.90000000000000019e-186 < i < 2.59999999999999997e-14Initial program 21.8%
Taylor expanded in i around 0 21.8%
+-commutative21.8%
Simplified21.8%
add-cbrt-cube21.8%
associate-/r/21.8%
associate--l+21.8%
metadata-eval21.8%
associate-/r/21.8%
associate--l+21.6%
metadata-eval21.6%
associate-/r/21.6%
associate--l+62.5%
metadata-eval62.5%
Applied egg-rr62.5%
associate-*l*62.5%
*-commutative62.5%
+-rgt-identity62.5%
associate-*l*62.5%
+-rgt-identity62.5%
*-commutative62.5%
+-rgt-identity62.5%
Simplified62.5%
*-commutative62.5%
*-inverses62.5%
*-un-lft-identity62.5%
*-inverses62.5%
*-commutative62.5%
*-un-lft-identity62.5%
*-inverses62.5%
*-commutative62.5%
*-un-lft-identity62.5%
add-cbrt-cube68.7%
*-un-lft-identity68.7%
*-commutative68.7%
*-inverses68.7%
associate-*r/81.4%
Applied egg-rr81.4%
if 2.59999999999999997e-14 < i Initial program 47.5%
Taylor expanded in i around 0 19.7%
associate-/r/5.8%
*-inverses5.8%
*-un-lft-identity5.8%
add-cbrt-cube58.4%
*-un-lft-identity58.4%
*-commutative58.4%
*-inverses58.4%
*-un-lft-identity58.4%
*-inverses58.4%
*-un-lft-identity58.4%
*-commutative58.4%
*-inverses58.4%
*-commutative58.4%
*-inverses58.4%
*-commutative58.4%
*-un-lft-identity58.4%
*-inverses58.4%
*-un-lft-identity58.4%
*-inverses58.4%
*-commutative58.4%
*-un-lft-identity58.4%
Applied egg-rr58.4%
Final simplification64.3%
(FPCore (i n)
:precision binary64
(if (<= i -2.35e-56)
(* 100.0 (/ (expm1 i) (/ i n)))
(if (<= i 1.4e-186)
(* 100.0 (+ n (* (* i n) (- 0.5 (/ 0.5 n)))))
(if (<= i 1.6e-13)
(* 100.0 (/ (* i n) i))
(* 100.0 (cbrt (* n (* n n))))))))
double code(double i, double n) {
double tmp;
if (i <= -2.35e-56) {
tmp = 100.0 * (expm1(i) / (i / n));
} else if (i <= 1.4e-186) {
tmp = 100.0 * (n + ((i * n) * (0.5 - (0.5 / n))));
} else if (i <= 1.6e-13) {
tmp = 100.0 * ((i * n) / i);
} else {
tmp = 100.0 * cbrt((n * (n * n)));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if (i <= -2.35e-56) {
tmp = 100.0 * (Math.expm1(i) / (i / n));
} else if (i <= 1.4e-186) {
tmp = 100.0 * (n + ((i * n) * (0.5 - (0.5 / n))));
} else if (i <= 1.6e-13) {
tmp = 100.0 * ((i * n) / i);
} else {
tmp = 100.0 * Math.cbrt((n * (n * n)));
}
return tmp;
}
function code(i, n) tmp = 0.0 if (i <= -2.35e-56) tmp = Float64(100.0 * Float64(expm1(i) / Float64(i / n))); elseif (i <= 1.4e-186) tmp = Float64(100.0 * Float64(n + Float64(Float64(i * n) * Float64(0.5 - Float64(0.5 / n))))); elseif (i <= 1.6e-13) tmp = Float64(100.0 * Float64(Float64(i * n) / i)); else tmp = Float64(100.0 * cbrt(Float64(n * Float64(n * n)))); end return tmp end
code[i_, n_] := If[LessEqual[i, -2.35e-56], N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 1.4e-186], N[(100.0 * N[(n + N[(N[(i * n), $MachinePrecision] * N[(0.5 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 1.6e-13], N[(100.0 * N[(N[(i * n), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[Power[N[(n * N[(n * n), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -2.35 \cdot 10^{-56}:\\
\;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\
\mathbf{elif}\;i \leq 1.4 \cdot 10^{-186}:\\
\;\;\;\;100 \cdot \left(n + \left(i \cdot n\right) \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\\
\mathbf{elif}\;i \leq 1.6 \cdot 10^{-13}:\\
\;\;\;\;100 \cdot \frac{i \cdot n}{i}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \sqrt[3]{n \cdot \left(n \cdot n\right)}\\
\end{array}
\end{array}
if i < -2.35e-56Initial program 45.8%
Taylor expanded in n around inf 70.4%
expm1-def76.0%
Simplified76.0%
if -2.35e-56 < i < 1.39999999999999992e-186Initial program 6.8%
Taylor expanded in i around 0 86.7%
associate-*r*87.1%
*-commutative87.1%
associate-*r/87.1%
metadata-eval87.1%
Simplified87.1%
if 1.39999999999999992e-186 < i < 1.6e-13Initial program 21.8%
Taylor expanded in i around 0 21.8%
+-commutative21.8%
Simplified21.8%
add-cbrt-cube21.8%
associate-/r/21.8%
associate--l+21.8%
metadata-eval21.8%
associate-/r/21.8%
associate--l+21.6%
metadata-eval21.6%
associate-/r/21.6%
associate--l+62.5%
metadata-eval62.5%
Applied egg-rr62.5%
associate-*l*62.5%
*-commutative62.5%
+-rgt-identity62.5%
associate-*l*62.5%
+-rgt-identity62.5%
*-commutative62.5%
+-rgt-identity62.5%
Simplified62.5%
*-commutative62.5%
*-inverses62.5%
*-un-lft-identity62.5%
*-inverses62.5%
*-commutative62.5%
*-un-lft-identity62.5%
*-inverses62.5%
*-commutative62.5%
*-un-lft-identity62.5%
add-cbrt-cube68.7%
*-un-lft-identity68.7%
*-commutative68.7%
*-inverses68.7%
associate-*r/81.4%
Applied egg-rr81.4%
if 1.6e-13 < i Initial program 47.5%
Taylor expanded in i around 0 19.7%
associate-/r/5.8%
*-inverses5.8%
*-un-lft-identity5.8%
add-cbrt-cube58.4%
*-un-lft-identity58.4%
*-commutative58.4%
*-inverses58.4%
*-un-lft-identity58.4%
*-inverses58.4%
*-un-lft-identity58.4%
*-commutative58.4%
*-inverses58.4%
*-commutative58.4%
*-inverses58.4%
*-commutative58.4%
*-un-lft-identity58.4%
*-inverses58.4%
*-un-lft-identity58.4%
*-inverses58.4%
*-commutative58.4%
*-un-lft-identity58.4%
Applied egg-rr58.4%
Final simplification76.2%
(FPCore (i n) :precision binary64 (if (or (<= n -1.06e-247) (not (<= n 3.3e-151))) (* n (* 100.0 (/ (expm1 i) i))) (* 100.0 (/ 0.0 (/ i n)))))
double code(double i, double n) {
double tmp;
if ((n <= -1.06e-247) || !(n <= 3.3e-151)) {
tmp = n * (100.0 * (expm1(i) / i));
} else {
tmp = 100.0 * (0.0 / (i / n));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((n <= -1.06e-247) || !(n <= 3.3e-151)) {
tmp = n * (100.0 * (Math.expm1(i) / i));
} else {
tmp = 100.0 * (0.0 / (i / n));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -1.06e-247) or not (n <= 3.3e-151): tmp = n * (100.0 * (math.expm1(i) / i)) else: tmp = 100.0 * (0.0 / (i / n)) return tmp
function code(i, n) tmp = 0.0 if ((n <= -1.06e-247) || !(n <= 3.3e-151)) tmp = Float64(n * Float64(100.0 * Float64(expm1(i) / i))); else tmp = Float64(100.0 * Float64(0.0 / Float64(i / n))); end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -1.06e-247], N[Not[LessEqual[n, 3.3e-151]], $MachinePrecision]], N[(n * N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $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.06 \cdot 10^{-247} \lor \neg \left(n \leq 3.3 \cdot 10^{-151}\right):\\
\;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{0}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -1.06e-247 or 3.2999999999999999e-151 < n Initial program 26.2%
associate-/r/26.4%
associate-*r*26.4%
*-commutative26.4%
associate-*r/26.4%
sub-neg26.4%
distribute-lft-in26.4%
fma-def26.4%
metadata-eval26.4%
metadata-eval26.4%
Simplified26.4%
fma-udef26.4%
metadata-eval26.4%
metadata-eval26.4%
distribute-lft-in26.4%
sub-neg26.4%
*-commutative26.4%
pow-to-exp21.4%
expm1-def32.3%
add-log-exp21.4%
pow-to-exp26.4%
log-pow32.3%
log1p-udef81.8%
Applied egg-rr81.8%
Taylor expanded in n around inf 36.3%
expm1-def79.4%
Simplified79.4%
if -1.06e-247 < n < 3.2999999999999999e-151Initial program 51.3%
Taylor expanded in i around 0 71.3%
Final simplification78.1%
(FPCore (i n)
:precision binary64
(if (<= n -4e+56)
(* n (+ 100.0 (+ (* i 50.0) (* (* i i) 16.666666666666668))))
(if (<= n -8.5e-248)
(* 100.0 (/ i (/ i n)))
(if (<= n 4.5e-155)
(* 100.0 (/ 0.0 (/ i n)))
(*
100.0
(+
n
(*
n
(+
(* i (- 0.5 (/ 0.5 n)))
(*
(* i i)
(+
(/ 0.3333333333333333 (* n n))
(- 0.16666666666666666 (/ 0.5 n))))))))))))
double code(double i, double n) {
double tmp;
if (n <= -4e+56) {
tmp = n * (100.0 + ((i * 50.0) + ((i * i) * 16.666666666666668)));
} else if (n <= -8.5e-248) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 4.5e-155) {
tmp = 100.0 * (0.0 / (i / n));
} else {
tmp = 100.0 * (n + (n * ((i * (0.5 - (0.5 / n))) + ((i * i) * ((0.3333333333333333 / (n * n)) + (0.16666666666666666 - (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 <= (-4d+56)) then
tmp = n * (100.0d0 + ((i * 50.0d0) + ((i * i) * 16.666666666666668d0)))
else if (n <= (-8.5d-248)) then
tmp = 100.0d0 * (i / (i / n))
else if (n <= 4.5d-155) then
tmp = 100.0d0 * (0.0d0 / (i / n))
else
tmp = 100.0d0 * (n + (n * ((i * (0.5d0 - (0.5d0 / n))) + ((i * i) * ((0.3333333333333333d0 / (n * n)) + (0.16666666666666666d0 - (0.5d0 / n)))))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -4e+56) {
tmp = n * (100.0 + ((i * 50.0) + ((i * i) * 16.666666666666668)));
} else if (n <= -8.5e-248) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 4.5e-155) {
tmp = 100.0 * (0.0 / (i / n));
} else {
tmp = 100.0 * (n + (n * ((i * (0.5 - (0.5 / n))) + ((i * i) * ((0.3333333333333333 / (n * n)) + (0.16666666666666666 - (0.5 / n)))))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -4e+56: tmp = n * (100.0 + ((i * 50.0) + ((i * i) * 16.666666666666668))) elif n <= -8.5e-248: tmp = 100.0 * (i / (i / n)) elif n <= 4.5e-155: tmp = 100.0 * (0.0 / (i / n)) else: tmp = 100.0 * (n + (n * ((i * (0.5 - (0.5 / n))) + ((i * i) * ((0.3333333333333333 / (n * n)) + (0.16666666666666666 - (0.5 / n))))))) return tmp
function code(i, n) tmp = 0.0 if (n <= -4e+56) tmp = Float64(n * Float64(100.0 + Float64(Float64(i * 50.0) + Float64(Float64(i * i) * 16.666666666666668)))); elseif (n <= -8.5e-248) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (n <= 4.5e-155) tmp = Float64(100.0 * Float64(0.0 / Float64(i / n))); else tmp = Float64(100.0 * Float64(n + Float64(n * Float64(Float64(i * Float64(0.5 - Float64(0.5 / n))) + Float64(Float64(i * i) * Float64(Float64(0.3333333333333333 / Float64(n * n)) + Float64(0.16666666666666666 - Float64(0.5 / n)))))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -4e+56) tmp = n * (100.0 + ((i * 50.0) + ((i * i) * 16.666666666666668))); elseif (n <= -8.5e-248) tmp = 100.0 * (i / (i / n)); elseif (n <= 4.5e-155) tmp = 100.0 * (0.0 / (i / n)); else tmp = 100.0 * (n + (n * ((i * (0.5 - (0.5 / n))) + ((i * i) * ((0.3333333333333333 / (n * n)) + (0.16666666666666666 - (0.5 / n))))))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -4e+56], N[(n * N[(100.0 + N[(N[(i * 50.0), $MachinePrecision] + N[(N[(i * i), $MachinePrecision] * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -8.5e-248], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 4.5e-155], N[(100.0 * N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n + N[(n * N[(N[(i * N[(0.5 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 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]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -4 \cdot 10^{+56}:\\
\;\;\;\;n \cdot \left(100 + \left(i \cdot 50 + \left(i \cdot i\right) \cdot 16.666666666666668\right)\right)\\
\mathbf{elif}\;n \leq -8.5 \cdot 10^{-248}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 4.5 \cdot 10^{-155}:\\
\;\;\;\;100 \cdot \frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n + n \cdot \left(i \cdot \left(0.5 - \frac{0.5}{n}\right) + \left(i \cdot i\right) \cdot \left(\frac{0.3333333333333333}{n \cdot n} + \left(0.16666666666666666 - \frac{0.5}{n}\right)\right)\right)\right)\\
\end{array}
\end{array}
if n < -4.00000000000000037e56Initial program 29.4%
associate-/r/29.9%
associate-*r*29.9%
*-commutative29.9%
associate-*r/30.0%
sub-neg30.0%
distribute-lft-in30.0%
fma-def30.0%
metadata-eval30.0%
metadata-eval30.0%
Simplified30.0%
Taylor expanded in i around 0 56.0%
+-commutative56.0%
distribute-lft-out56.0%
Simplified56.0%
Taylor expanded in n around inf 56.0%
+-commutative56.0%
distribute-rgt-in56.0%
*-commutative56.0%
associate-*l*56.0%
metadata-eval56.0%
*-commutative56.0%
associate-*l*56.0%
unpow256.0%
metadata-eval56.0%
Simplified56.0%
if -4.00000000000000037e56 < n < -8.5000000000000003e-248Initial program 35.5%
Taylor expanded in i around 0 61.2%
if -8.5000000000000003e-248 < n < 4.5000000000000004e-155Initial program 51.3%
Taylor expanded in i around 0 71.3%
if 4.5000000000000004e-155 < n Initial program 17.3%
Taylor expanded in i around 0 63.7%
distribute-lft-out64.2%
unpow264.2%
associate--l+64.2%
associate-*r/64.2%
metadata-eval64.2%
unpow264.2%
associate-*r/64.2%
metadata-eval64.2%
associate-*r/64.2%
metadata-eval64.2%
Simplified64.2%
Final simplification62.7%
(FPCore (i n)
:precision binary64
(if (<= n -3.6e+56)
(* n (+ 100.0 (+ (* i 50.0) (* (* i i) 16.666666666666668))))
(if (<= n -9.2e-248)
(* 100.0 (/ i (/ i n)))
(if (<= n 3e-153)
(* 100.0 (/ 0.0 (/ i n)))
(*
n
(+
100.0
(*
100.0
(+
(*
(* i i)
(+
(/ 0.3333333333333333 (* n n))
(+ 0.16666666666666666 (/ -0.5 n))))
(* i (- 0.5 (/ 0.5 n)))))))))))
double code(double i, double n) {
double tmp;
if (n <= -3.6e+56) {
tmp = n * (100.0 + ((i * 50.0) + ((i * i) * 16.666666666666668)));
} else if (n <= -9.2e-248) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 3e-153) {
tmp = 100.0 * (0.0 / (i / n));
} else {
tmp = n * (100.0 + (100.0 * (((i * i) * ((0.3333333333333333 / (n * n)) + (0.16666666666666666 + (-0.5 / n)))) + (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 <= (-3.6d+56)) then
tmp = n * (100.0d0 + ((i * 50.0d0) + ((i * i) * 16.666666666666668d0)))
else if (n <= (-9.2d-248)) then
tmp = 100.0d0 * (i / (i / n))
else if (n <= 3d-153) then
tmp = 100.0d0 * (0.0d0 / (i / n))
else
tmp = n * (100.0d0 + (100.0d0 * (((i * i) * ((0.3333333333333333d0 / (n * n)) + (0.16666666666666666d0 + ((-0.5d0) / n)))) + (i * (0.5d0 - (0.5d0 / n))))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -3.6e+56) {
tmp = n * (100.0 + ((i * 50.0) + ((i * i) * 16.666666666666668)));
} else if (n <= -9.2e-248) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 3e-153) {
tmp = 100.0 * (0.0 / (i / n));
} else {
tmp = n * (100.0 + (100.0 * (((i * i) * ((0.3333333333333333 / (n * n)) + (0.16666666666666666 + (-0.5 / n)))) + (i * (0.5 - (0.5 / n))))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -3.6e+56: tmp = n * (100.0 + ((i * 50.0) + ((i * i) * 16.666666666666668))) elif n <= -9.2e-248: tmp = 100.0 * (i / (i / n)) elif n <= 3e-153: tmp = 100.0 * (0.0 / (i / n)) else: tmp = n * (100.0 + (100.0 * (((i * i) * ((0.3333333333333333 / (n * n)) + (0.16666666666666666 + (-0.5 / n)))) + (i * (0.5 - (0.5 / n)))))) return tmp
function code(i, n) tmp = 0.0 if (n <= -3.6e+56) tmp = Float64(n * Float64(100.0 + Float64(Float64(i * 50.0) + Float64(Float64(i * i) * 16.666666666666668)))); elseif (n <= -9.2e-248) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (n <= 3e-153) tmp = Float64(100.0 * Float64(0.0 / Float64(i / n))); else tmp = Float64(n * Float64(100.0 + Float64(100.0 * Float64(Float64(Float64(i * i) * Float64(Float64(0.3333333333333333 / Float64(n * n)) + Float64(0.16666666666666666 + Float64(-0.5 / n)))) + Float64(i * Float64(0.5 - Float64(0.5 / n))))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -3.6e+56) tmp = n * (100.0 + ((i * 50.0) + ((i * i) * 16.666666666666668))); elseif (n <= -9.2e-248) tmp = 100.0 * (i / (i / n)); elseif (n <= 3e-153) tmp = 100.0 * (0.0 / (i / n)); else tmp = n * (100.0 + (100.0 * (((i * i) * ((0.3333333333333333 / (n * n)) + (0.16666666666666666 + (-0.5 / n)))) + (i * (0.5 - (0.5 / n)))))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -3.6e+56], N[(n * N[(100.0 + N[(N[(i * 50.0), $MachinePrecision] + N[(N[(i * i), $MachinePrecision] * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -9.2e-248], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 3e-153], N[(100.0 * N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(100.0 * N[(N[(N[(i * i), $MachinePrecision] * N[(N[(0.3333333333333333 / N[(n * n), $MachinePrecision]), $MachinePrecision] + N[(0.16666666666666666 + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(i * N[(0.5 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -3.6 \cdot 10^{+56}:\\
\;\;\;\;n \cdot \left(100 + \left(i \cdot 50 + \left(i \cdot i\right) \cdot 16.666666666666668\right)\right)\\
\mathbf{elif}\;n \leq -9.2 \cdot 10^{-248}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 3 \cdot 10^{-153}:\\
\;\;\;\;100 \cdot \frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + 100 \cdot \left(\left(i \cdot i\right) \cdot \left(\frac{0.3333333333333333}{n \cdot n} + \left(0.16666666666666666 + \frac{-0.5}{n}\right)\right) + i \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\right)\\
\end{array}
\end{array}
if n < -3.59999999999999998e56Initial program 29.4%
associate-/r/29.9%
associate-*r*29.9%
*-commutative29.9%
associate-*r/30.0%
sub-neg30.0%
distribute-lft-in30.0%
fma-def30.0%
metadata-eval30.0%
metadata-eval30.0%
Simplified30.0%
Taylor expanded in i around 0 56.0%
+-commutative56.0%
distribute-lft-out56.0%
Simplified56.0%
Taylor expanded in n around inf 56.0%
+-commutative56.0%
distribute-rgt-in56.0%
*-commutative56.0%
associate-*l*56.0%
metadata-eval56.0%
*-commutative56.0%
associate-*l*56.0%
unpow256.0%
metadata-eval56.0%
Simplified56.0%
if -3.59999999999999998e56 < n < -9.2000000000000001e-248Initial program 35.5%
Taylor expanded in i around 0 61.2%
if -9.2000000000000001e-248 < n < 3e-153Initial program 51.3%
Taylor expanded in i around 0 71.3%
if 3e-153 < n Initial program 17.3%
associate-/r/17.5%
associate-*r*17.5%
*-commutative17.5%
associate-*r/17.5%
sub-neg17.5%
distribute-lft-in17.6%
fma-def17.5%
metadata-eval17.5%
metadata-eval17.5%
Simplified17.5%
Taylor expanded in i around 0 64.2%
+-commutative64.2%
distribute-lft-out64.2%
Simplified64.2%
Final simplification62.7%
(FPCore (i n)
:precision binary64
(if (<= n -1.3e+98)
(* 100.0 (/ (* i n) i))
(if (<= n -1.42e-247)
(* 100.0 (/ i (/ i n)))
(if (<= n 4.3e-154)
(* 100.0 (/ 0.0 (/ i n)))
(* n (+ 100.0 (* (- 0.5 (/ 0.5 n)) (* i 100.0))))))))
double code(double i, double n) {
double tmp;
if (n <= -1.3e+98) {
tmp = 100.0 * ((i * n) / i);
} else if (n <= -1.42e-247) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 4.3e-154) {
tmp = 100.0 * (0.0 / (i / n));
} else {
tmp = n * (100.0 + ((0.5 - (0.5 / n)) * (i * 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 <= (-1.3d+98)) then
tmp = 100.0d0 * ((i * n) / i)
else if (n <= (-1.42d-247)) then
tmp = 100.0d0 * (i / (i / n))
else if (n <= 4.3d-154) then
tmp = 100.0d0 * (0.0d0 / (i / n))
else
tmp = n * (100.0d0 + ((0.5d0 - (0.5d0 / n)) * (i * 100.0d0)))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -1.3e+98) {
tmp = 100.0 * ((i * n) / i);
} else if (n <= -1.42e-247) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 4.3e-154) {
tmp = 100.0 * (0.0 / (i / n));
} else {
tmp = n * (100.0 + ((0.5 - (0.5 / n)) * (i * 100.0)));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -1.3e+98: tmp = 100.0 * ((i * n) / i) elif n <= -1.42e-247: tmp = 100.0 * (i / (i / n)) elif n <= 4.3e-154: tmp = 100.0 * (0.0 / (i / n)) else: tmp = n * (100.0 + ((0.5 - (0.5 / n)) * (i * 100.0))) return tmp
function code(i, n) tmp = 0.0 if (n <= -1.3e+98) tmp = Float64(100.0 * Float64(Float64(i * n) / i)); elseif (n <= -1.42e-247) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (n <= 4.3e-154) tmp = Float64(100.0 * Float64(0.0 / Float64(i / n))); else tmp = Float64(n * Float64(100.0 + Float64(Float64(0.5 - Float64(0.5 / n)) * Float64(i * 100.0)))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -1.3e+98) tmp = 100.0 * ((i * n) / i); elseif (n <= -1.42e-247) tmp = 100.0 * (i / (i / n)); elseif (n <= 4.3e-154) tmp = 100.0 * (0.0 / (i / n)); else tmp = n * (100.0 + ((0.5 - (0.5 / n)) * (i * 100.0))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -1.3e+98], N[(100.0 * N[(N[(i * n), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -1.42e-247], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 4.3e-154], N[(100.0 * N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(N[(0.5 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] * N[(i * 100.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.3 \cdot 10^{+98}:\\
\;\;\;\;100 \cdot \frac{i \cdot n}{i}\\
\mathbf{elif}\;n \leq -1.42 \cdot 10^{-247}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 4.3 \cdot 10^{-154}:\\
\;\;\;\;100 \cdot \frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + \left(0.5 - \frac{0.5}{n}\right) \cdot \left(i \cdot 100\right)\right)\\
\end{array}
\end{array}
if n < -1.3e98Initial program 19.8%
Taylor expanded in i around 0 3.3%
+-commutative3.3%
Simplified3.3%
add-cbrt-cube22.9%
associate-/r/22.9%
associate--l+22.9%
metadata-eval22.9%
associate-/r/22.9%
associate--l+22.6%
metadata-eval22.6%
associate-/r/22.7%
associate--l+26.2%
metadata-eval26.2%
Applied egg-rr26.2%
associate-*l*26.2%
*-commutative26.2%
+-rgt-identity26.2%
associate-*l*26.2%
+-rgt-identity26.2%
*-commutative26.2%
+-rgt-identity26.2%
Simplified26.2%
*-commutative26.2%
*-inverses26.2%
*-un-lft-identity26.2%
*-inverses26.2%
*-commutative26.2%
*-un-lft-identity26.2%
*-inverses26.2%
*-commutative26.2%
*-un-lft-identity26.2%
add-cbrt-cube50.6%
*-un-lft-identity50.6%
*-commutative50.6%
*-inverses50.6%
associate-*r/61.2%
Applied egg-rr61.2%
if -1.3e98 < n < -1.42000000000000001e-247Initial program 39.4%
Taylor expanded in i around 0 54.6%
if -1.42000000000000001e-247 < n < 4.29999999999999992e-154Initial program 51.3%
Taylor expanded in i around 0 71.3%
if 4.29999999999999992e-154 < n Initial program 17.3%
associate-/r/17.5%
associate-*r*17.5%
*-commutative17.5%
associate-*r/17.5%
sub-neg17.5%
distribute-lft-in17.6%
fma-def17.5%
metadata-eval17.5%
metadata-eval17.5%
Simplified17.5%
Taylor expanded in i around 0 58.1%
associate-*r*58.1%
*-commutative58.1%
associate-*r/58.1%
metadata-eval58.1%
Simplified58.1%
Final simplification59.6%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* n (+ 100.0 (+ (* i 50.0) (* (* i i) 16.666666666666668))))))
(if (<= n -3.6e+56)
t_0
(if (<= n -7.5e-248)
(* 100.0 (/ i (/ i n)))
(if (<= n 5.4e-155) (* 100.0 (/ 0.0 (/ i n))) t_0)))))
double code(double i, double n) {
double t_0 = n * (100.0 + ((i * 50.0) + ((i * i) * 16.666666666666668)));
double tmp;
if (n <= -3.6e+56) {
tmp = t_0;
} else if (n <= -7.5e-248) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 5.4e-155) {
tmp = 100.0 * (0.0 / (i / n));
} else {
tmp = 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 = n * (100.0d0 + ((i * 50.0d0) + ((i * i) * 16.666666666666668d0)))
if (n <= (-3.6d+56)) then
tmp = t_0
else if (n <= (-7.5d-248)) then
tmp = 100.0d0 * (i / (i / n))
else if (n <= 5.4d-155) then
tmp = 100.0d0 * (0.0d0 / (i / n))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double i, double n) {
double t_0 = n * (100.0 + ((i * 50.0) + ((i * i) * 16.666666666666668)));
double tmp;
if (n <= -3.6e+56) {
tmp = t_0;
} else if (n <= -7.5e-248) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 5.4e-155) {
tmp = 100.0 * (0.0 / (i / n));
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = n * (100.0 + ((i * 50.0) + ((i * i) * 16.666666666666668))) tmp = 0 if n <= -3.6e+56: tmp = t_0 elif n <= -7.5e-248: tmp = 100.0 * (i / (i / n)) elif n <= 5.4e-155: tmp = 100.0 * (0.0 / (i / n)) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(n * Float64(100.0 + Float64(Float64(i * 50.0) + Float64(Float64(i * i) * 16.666666666666668)))) tmp = 0.0 if (n <= -3.6e+56) tmp = t_0; elseif (n <= -7.5e-248) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (n <= 5.4e-155) tmp = Float64(100.0 * Float64(0.0 / Float64(i / n))); else tmp = t_0; end return tmp end
function tmp_2 = code(i, n) t_0 = n * (100.0 + ((i * 50.0) + ((i * i) * 16.666666666666668))); tmp = 0.0; if (n <= -3.6e+56) tmp = t_0; elseif (n <= -7.5e-248) tmp = 100.0 * (i / (i / n)); elseif (n <= 5.4e-155) tmp = 100.0 * (0.0 / (i / n)); else tmp = t_0; end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(n * N[(100.0 + N[(N[(i * 50.0), $MachinePrecision] + N[(N[(i * i), $MachinePrecision] * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -3.6e+56], t$95$0, If[LessEqual[n, -7.5e-248], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 5.4e-155], N[(100.0 * N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(100 + \left(i \cdot 50 + \left(i \cdot i\right) \cdot 16.666666666666668\right)\right)\\
\mathbf{if}\;n \leq -3.6 \cdot 10^{+56}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq -7.5 \cdot 10^{-248}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 5.4 \cdot 10^{-155}:\\
\;\;\;\;100 \cdot \frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if n < -3.59999999999999998e56 or 5.39999999999999962e-155 < n Initial program 21.9%
associate-/r/22.2%
associate-*r*22.2%
*-commutative22.2%
associate-*r/22.2%
sub-neg22.2%
distribute-lft-in22.3%
fma-def22.2%
metadata-eval22.2%
metadata-eval22.2%
Simplified22.2%
Taylor expanded in i around 0 61.1%
+-commutative61.1%
distribute-lft-out61.1%
Simplified61.1%
Taylor expanded in n around inf 60.3%
+-commutative60.3%
distribute-rgt-in60.3%
*-commutative60.3%
associate-*l*60.3%
metadata-eval60.3%
*-commutative60.3%
associate-*l*60.3%
unpow260.3%
metadata-eval60.3%
Simplified60.3%
if -3.59999999999999998e56 < n < -7.4999999999999994e-248Initial program 35.5%
Taylor expanded in i around 0 61.2%
if -7.4999999999999994e-248 < n < 5.39999999999999962e-155Initial program 51.3%
Taylor expanded in i around 0 71.3%
Final simplification62.3%
(FPCore (i n)
:precision binary64
(if (<= n -1.6e+98)
(* 100.0 (/ (* i n) i))
(if (<= n -8.5e-248)
(* 100.0 (/ i (/ i n)))
(if (<= n 1.75e-147)
(* 100.0 (/ 0.0 (/ i n)))
(+ (* n 100.0) (* i (- (* n 50.0) 50.0)))))))
double code(double i, double n) {
double tmp;
if (n <= -1.6e+98) {
tmp = 100.0 * ((i * n) / i);
} else if (n <= -8.5e-248) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 1.75e-147) {
tmp = 100.0 * (0.0 / (i / n));
} else {
tmp = (n * 100.0) + (i * ((n * 50.0) - 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.6d+98)) then
tmp = 100.0d0 * ((i * n) / i)
else if (n <= (-8.5d-248)) then
tmp = 100.0d0 * (i / (i / n))
else if (n <= 1.75d-147) then
tmp = 100.0d0 * (0.0d0 / (i / n))
else
tmp = (n * 100.0d0) + (i * ((n * 50.0d0) - 50.0d0))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -1.6e+98) {
tmp = 100.0 * ((i * n) / i);
} else if (n <= -8.5e-248) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 1.75e-147) {
tmp = 100.0 * (0.0 / (i / n));
} else {
tmp = (n * 100.0) + (i * ((n * 50.0) - 50.0));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -1.6e+98: tmp = 100.0 * ((i * n) / i) elif n <= -8.5e-248: tmp = 100.0 * (i / (i / n)) elif n <= 1.75e-147: tmp = 100.0 * (0.0 / (i / n)) else: tmp = (n * 100.0) + (i * ((n * 50.0) - 50.0)) return tmp
function code(i, n) tmp = 0.0 if (n <= -1.6e+98) tmp = Float64(100.0 * Float64(Float64(i * n) / i)); elseif (n <= -8.5e-248) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (n <= 1.75e-147) tmp = Float64(100.0 * Float64(0.0 / Float64(i / n))); else tmp = Float64(Float64(n * 100.0) + Float64(i * Float64(Float64(n * 50.0) - 50.0))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -1.6e+98) tmp = 100.0 * ((i * n) / i); elseif (n <= -8.5e-248) tmp = 100.0 * (i / (i / n)); elseif (n <= 1.75e-147) tmp = 100.0 * (0.0 / (i / n)); else tmp = (n * 100.0) + (i * ((n * 50.0) - 50.0)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -1.6e+98], N[(100.0 * N[(N[(i * n), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -8.5e-248], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.75e-147], N[(100.0 * N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(n * 100.0), $MachinePrecision] + N[(i * N[(N[(n * 50.0), $MachinePrecision] - 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.6 \cdot 10^{+98}:\\
\;\;\;\;100 \cdot \frac{i \cdot n}{i}\\
\mathbf{elif}\;n \leq -8.5 \cdot 10^{-248}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 1.75 \cdot 10^{-147}:\\
\;\;\;\;100 \cdot \frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100 + i \cdot \left(n \cdot 50 - 50\right)\\
\end{array}
\end{array}
if n < -1.6000000000000001e98Initial program 19.8%
Taylor expanded in i around 0 3.3%
+-commutative3.3%
Simplified3.3%
add-cbrt-cube22.9%
associate-/r/22.9%
associate--l+22.9%
metadata-eval22.9%
associate-/r/22.9%
associate--l+22.6%
metadata-eval22.6%
associate-/r/22.7%
associate--l+26.2%
metadata-eval26.2%
Applied egg-rr26.2%
associate-*l*26.2%
*-commutative26.2%
+-rgt-identity26.2%
associate-*l*26.2%
+-rgt-identity26.2%
*-commutative26.2%
+-rgt-identity26.2%
Simplified26.2%
*-commutative26.2%
*-inverses26.2%
*-un-lft-identity26.2%
*-inverses26.2%
*-commutative26.2%
*-un-lft-identity26.2%
*-inverses26.2%
*-commutative26.2%
*-un-lft-identity26.2%
add-cbrt-cube50.6%
*-un-lft-identity50.6%
*-commutative50.6%
*-inverses50.6%
associate-*r/61.2%
Applied egg-rr61.2%
if -1.6000000000000001e98 < n < -8.5000000000000003e-248Initial program 39.4%
Taylor expanded in i around 0 54.6%
if -8.5000000000000003e-248 < n < 1.75000000000000002e-147Initial program 51.3%
Taylor expanded in i around 0 71.3%
if 1.75000000000000002e-147 < n Initial program 17.3%
associate-/r/17.5%
associate-*r*17.5%
*-commutative17.5%
associate-*r/17.5%
sub-neg17.5%
distribute-lft-in17.6%
fma-def17.5%
metadata-eval17.5%
metadata-eval17.5%
Simplified17.5%
Taylor expanded in i around 0 58.1%
associate-*r*58.1%
*-commutative58.1%
associate-*r/58.1%
metadata-eval58.1%
Simplified58.1%
Taylor expanded in n around 0 58.1%
fma-def58.1%
*-commutative58.1%
*-commutative58.1%
Simplified58.1%
Taylor expanded in i around 0 58.1%
Final simplification59.5%
(FPCore (i n)
:precision binary64
(if (<= n -1.3e+98)
(* 100.0 (/ (* i n) i))
(if (<= n -1.5e-247)
(* 100.0 (/ i (/ i n)))
(if (<= n 5.8e-157)
(* 100.0 (/ 0.0 (/ i n)))
(* n (+ 100.0 (* i 50.0)))))))
double code(double i, double n) {
double tmp;
if (n <= -1.3e+98) {
tmp = 100.0 * ((i * n) / i);
} else if (n <= -1.5e-247) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 5.8e-157) {
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 <= (-1.3d+98)) then
tmp = 100.0d0 * ((i * n) / i)
else if (n <= (-1.5d-247)) then
tmp = 100.0d0 * (i / (i / n))
else if (n <= 5.8d-157) 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 <= -1.3e+98) {
tmp = 100.0 * ((i * n) / i);
} else if (n <= -1.5e-247) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 5.8e-157) {
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 <= -1.3e+98: tmp = 100.0 * ((i * n) / i) elif n <= -1.5e-247: tmp = 100.0 * (i / (i / n)) elif n <= 5.8e-157: 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 <= -1.3e+98) tmp = Float64(100.0 * Float64(Float64(i * n) / i)); elseif (n <= -1.5e-247) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (n <= 5.8e-157) 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 <= -1.3e+98) tmp = 100.0 * ((i * n) / i); elseif (n <= -1.5e-247) tmp = 100.0 * (i / (i / n)); elseif (n <= 5.8e-157) 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, -1.3e+98], N[(100.0 * N[(N[(i * n), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -1.5e-247], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 5.8e-157], 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 -1.3 \cdot 10^{+98}:\\
\;\;\;\;100 \cdot \frac{i \cdot n}{i}\\
\mathbf{elif}\;n \leq -1.5 \cdot 10^{-247}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 5.8 \cdot 10^{-157}:\\
\;\;\;\;100 \cdot \frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < -1.3e98Initial program 19.8%
Taylor expanded in i around 0 3.3%
+-commutative3.3%
Simplified3.3%
add-cbrt-cube22.9%
associate-/r/22.9%
associate--l+22.9%
metadata-eval22.9%
associate-/r/22.9%
associate--l+22.6%
metadata-eval22.6%
associate-/r/22.7%
associate--l+26.2%
metadata-eval26.2%
Applied egg-rr26.2%
associate-*l*26.2%
*-commutative26.2%
+-rgt-identity26.2%
associate-*l*26.2%
+-rgt-identity26.2%
*-commutative26.2%
+-rgt-identity26.2%
Simplified26.2%
*-commutative26.2%
*-inverses26.2%
*-un-lft-identity26.2%
*-inverses26.2%
*-commutative26.2%
*-un-lft-identity26.2%
*-inverses26.2%
*-commutative26.2%
*-un-lft-identity26.2%
add-cbrt-cube50.6%
*-un-lft-identity50.6%
*-commutative50.6%
*-inverses50.6%
associate-*r/61.2%
Applied egg-rr61.2%
if -1.3e98 < n < -1.4999999999999999e-247Initial program 39.4%
Taylor expanded in i around 0 54.6%
if -1.4999999999999999e-247 < n < 5.79999999999999977e-157Initial program 51.3%
Taylor expanded in i around 0 71.3%
if 5.79999999999999977e-157 < n Initial program 17.3%
associate-/r/17.5%
associate-*r*17.5%
*-commutative17.5%
associate-*r/17.5%
sub-neg17.5%
distribute-lft-in17.6%
fma-def17.5%
metadata-eval17.5%
metadata-eval17.5%
Simplified17.5%
Taylor expanded in i around 0 58.1%
associate-*r*58.1%
*-commutative58.1%
associate-*r/58.1%
metadata-eval58.1%
Simplified58.1%
Taylor expanded in n around inf 57.6%
*-commutative57.6%
Simplified57.6%
Final simplification59.4%
(FPCore (i n) :precision binary64 (if (or (<= i -10000.0) (not (<= i 1.45e-35))) (* 100.0 (/ i (/ i n))) (* n 100.0)))
double code(double i, double n) {
double tmp;
if ((i <= -10000.0) || !(i <= 1.45e-35)) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = n * 100.0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((i <= (-10000.0d0)) .or. (.not. (i <= 1.45d-35))) then
tmp = 100.0d0 * (i / (i / n))
else
tmp = n * 100.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((i <= -10000.0) || !(i <= 1.45e-35)) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = n * 100.0;
}
return tmp;
}
def code(i, n): tmp = 0 if (i <= -10000.0) or not (i <= 1.45e-35): tmp = 100.0 * (i / (i / n)) else: tmp = n * 100.0 return tmp
function code(i, n) tmp = 0.0 if ((i <= -10000.0) || !(i <= 1.45e-35)) tmp = Float64(100.0 * Float64(i / Float64(i / n))); else tmp = Float64(n * 100.0); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((i <= -10000.0) || ~((i <= 1.45e-35))) tmp = 100.0 * (i / (i / n)); else tmp = n * 100.0; end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[i, -10000.0], N[Not[LessEqual[i, 1.45e-35]], $MachinePrecision]], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -10000 \lor \neg \left(i \leq 1.45 \cdot 10^{-35}\right):\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if i < -1e4 or 1.4500000000000001e-35 < i Initial program 46.7%
Taylor expanded in i around 0 23.5%
if -1e4 < i < 1.4500000000000001e-35Initial program 13.4%
Taylor expanded in i around 0 78.9%
*-commutative78.9%
Simplified78.9%
Final simplification51.2%
(FPCore (i n) :precision binary64 (if (or (<= n -2.95e+96) (not (<= n 5e-40))) (* 100.0 (/ (* i n) i)) (* 100.0 (/ i (/ i n)))))
double code(double i, double n) {
double tmp;
if ((n <= -2.95e+96) || !(n <= 5e-40)) {
tmp = 100.0 * ((i * n) / i);
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-2.95d+96)) .or. (.not. (n <= 5d-40))) then
tmp = 100.0d0 * ((i * n) / i)
else
tmp = 100.0d0 * (i / (i / n))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -2.95e+96) || !(n <= 5e-40)) {
tmp = 100.0 * ((i * n) / i);
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -2.95e+96) or not (n <= 5e-40): tmp = 100.0 * ((i * n) / i) else: tmp = 100.0 * (i / (i / n)) return tmp
function code(i, n) tmp = 0.0 if ((n <= -2.95e+96) || !(n <= 5e-40)) tmp = Float64(100.0 * Float64(Float64(i * n) / i)); else tmp = Float64(100.0 * Float64(i / Float64(i / n))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -2.95e+96) || ~((n <= 5e-40))) tmp = 100.0 * ((i * n) / i); else tmp = 100.0 * (i / (i / n)); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -2.95e+96], N[Not[LessEqual[n, 5e-40]], $MachinePrecision]], N[(100.0 * N[(N[(i * n), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.95 \cdot 10^{+96} \lor \neg \left(n \leq 5 \cdot 10^{-40}\right):\\
\;\;\;\;100 \cdot \frac{i \cdot n}{i}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -2.95000000000000014e96 or 4.99999999999999965e-40 < n Initial program 19.1%
Taylor expanded in i around 0 3.7%
+-commutative3.7%
Simplified3.7%
add-cbrt-cube19.2%
associate-/r/19.2%
associate--l+19.2%
metadata-eval19.2%
associate-/r/19.2%
associate--l+19.1%
metadata-eval19.1%
associate-/r/19.2%
associate--l+37.8%
metadata-eval37.8%
Applied egg-rr37.8%
associate-*l*37.8%
*-commutative37.8%
+-rgt-identity37.8%
associate-*l*37.8%
+-rgt-identity37.8%
*-commutative37.8%
+-rgt-identity37.8%
Simplified37.8%
*-commutative37.8%
*-inverses37.8%
*-un-lft-identity37.8%
*-inverses37.8%
*-commutative37.8%
*-un-lft-identity37.8%
*-inverses37.8%
*-commutative37.8%
*-un-lft-identity37.8%
add-cbrt-cube49.2%
*-un-lft-identity49.2%
*-commutative49.2%
*-inverses49.2%
associate-*r/58.4%
Applied egg-rr58.4%
if -2.95000000000000014e96 < n < 4.99999999999999965e-40Initial program 39.5%
Taylor expanded in i around 0 52.8%
Final simplification55.3%
(FPCore (i n) :precision binary64 (if (<= n -1.6e+98) (* 100.0 (/ (* i n) i)) (if (<= n 1.5) (* 100.0 (/ i (/ i n))) (* n (+ 100.0 (* i 50.0))))))
double code(double i, double n) {
double tmp;
if (n <= -1.6e+98) {
tmp = 100.0 * ((i * n) / i);
} else if (n <= 1.5) {
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.6d+98)) then
tmp = 100.0d0 * ((i * n) / i)
else if (n <= 1.5d0) 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.6e+98) {
tmp = 100.0 * ((i * n) / i);
} else if (n <= 1.5) {
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.6e+98: tmp = 100.0 * ((i * n) / i) elif n <= 1.5: 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.6e+98) tmp = Float64(100.0 * Float64(Float64(i * n) / i)); elseif (n <= 1.5) 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.6e+98) tmp = 100.0 * ((i * n) / i); elseif (n <= 1.5) 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.6e+98], N[(100.0 * N[(N[(i * n), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.5], 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.6 \cdot 10^{+98}:\\
\;\;\;\;100 \cdot \frac{i \cdot n}{i}\\
\mathbf{elif}\;n \leq 1.5:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < -1.6000000000000001e98Initial program 19.8%
Taylor expanded in i around 0 3.3%
+-commutative3.3%
Simplified3.3%
add-cbrt-cube22.9%
associate-/r/22.9%
associate--l+22.9%
metadata-eval22.9%
associate-/r/22.9%
associate--l+22.6%
metadata-eval22.6%
associate-/r/22.7%
associate--l+26.2%
metadata-eval26.2%
Applied egg-rr26.2%
associate-*l*26.2%
*-commutative26.2%
+-rgt-identity26.2%
associate-*l*26.2%
+-rgt-identity26.2%
*-commutative26.2%
+-rgt-identity26.2%
Simplified26.2%
*-commutative26.2%
*-inverses26.2%
*-un-lft-identity26.2%
*-inverses26.2%
*-commutative26.2%
*-un-lft-identity26.2%
*-inverses26.2%
*-commutative26.2%
*-un-lft-identity26.2%
add-cbrt-cube50.6%
*-un-lft-identity50.6%
*-commutative50.6%
*-inverses50.6%
associate-*r/61.2%
Applied egg-rr61.2%
if -1.6000000000000001e98 < n < 1.5Initial program 36.9%
Taylor expanded in i around 0 53.1%
if 1.5 < n Initial program 19.8%
associate-/r/20.2%
associate-*r*20.2%
*-commutative20.2%
associate-*r/20.2%
sub-neg20.2%
distribute-lft-in20.2%
fma-def20.2%
metadata-eval20.2%
metadata-eval20.2%
Simplified20.2%
Taylor expanded in i around 0 58.1%
associate-*r*58.1%
*-commutative58.1%
associate-*r/58.1%
metadata-eval58.1%
Simplified58.1%
Taylor expanded in n around inf 58.1%
*-commutative58.1%
Simplified58.1%
Final simplification55.6%
(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 30.1%
associate-/r/30.1%
associate-*r*30.1%
*-commutative30.1%
associate-*r/30.1%
sub-neg30.1%
distribute-lft-in30.1%
fma-def30.1%
metadata-eval30.1%
metadata-eval30.1%
Simplified30.1%
Taylor expanded in i around 0 47.0%
associate-*r*47.0%
*-commutative47.0%
associate-*r/47.0%
metadata-eval47.0%
Simplified47.0%
Taylor expanded in n around 0 3.3%
*-commutative3.3%
Simplified3.3%
Final simplification3.3%
(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 30.1%
Taylor expanded in i around 0 43.5%
*-commutative43.5%
Simplified43.5%
Final simplification43.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 2023199
(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))))