
(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) -1.0) (/ i n))))
(if (<= t_0 (- INFINITY))
(*
n
(/
(*
i
(+
100.0
(* i (+ 50.0 (* i (+ 16.666666666666668 (* i 4.166666666666667)))))))
i))
(if (<= t_0 2e-249)
(* 100.0 (/ (expm1 (* n (log1p (/ i n)))) (/ i n)))
(if (<= t_0 INFINITY)
(* t_0 100.0)
(* n (/ 1.0 (+ 0.01 (* i -0.005)))))))))
double code(double i, double n) {
double t_0 = (pow((1.0 + (i / n)), n) + -1.0) / (i / n);
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = n * ((i * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))))) / i);
} else if (t_0 <= 2e-249) {
tmp = 100.0 * (expm1((n * log1p((i / n)))) / (i / n));
} else if (t_0 <= ((double) INFINITY)) {
tmp = t_0 * 100.0;
} else {
tmp = n * (1.0 / (0.01 + (i * -0.005)));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = (Math.pow((1.0 + (i / n)), n) + -1.0) / (i / n);
double tmp;
if (t_0 <= -Double.POSITIVE_INFINITY) {
tmp = n * ((i * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))))) / i);
} else if (t_0 <= 2e-249) {
tmp = 100.0 * (Math.expm1((n * Math.log1p((i / n)))) / (i / n));
} else if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = t_0 * 100.0;
} else {
tmp = n * (1.0 / (0.01 + (i * -0.005)));
}
return tmp;
}
def code(i, n): t_0 = (math.pow((1.0 + (i / n)), n) + -1.0) / (i / n) tmp = 0 if t_0 <= -math.inf: tmp = n * ((i * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))))) / i) elif t_0 <= 2e-249: tmp = 100.0 * (math.expm1((n * math.log1p((i / n)))) / (i / n)) elif t_0 <= math.inf: tmp = t_0 * 100.0 else: tmp = n * (1.0 / (0.01 + (i * -0.005))) return tmp
function code(i, n) t_0 = Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0) / Float64(i / n)) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(n * Float64(Float64(i * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * Float64(16.666666666666668 + Float64(i * 4.166666666666667))))))) / i)); elseif (t_0 <= 2e-249) tmp = Float64(100.0 * Float64(expm1(Float64(n * log1p(Float64(i / n)))) / Float64(i / n))); elseif (t_0 <= Inf) tmp = Float64(t_0 * 100.0); else tmp = Float64(n * Float64(1.0 / Float64(0.01 + Float64(i * -0.005)))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(n * N[(N[(i * N[(100.0 + N[(i * N[(50.0 + N[(i * N[(16.666666666666668 + N[(i * 4.166666666666667), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e-249], N[(100.0 * N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(t$95$0 * 100.0), $MachinePrecision], N[(n * N[(1.0 / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}}\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;n \cdot \frac{i \cdot \left(100 + i \cdot \left(50 + i \cdot \left(16.666666666666668 + i \cdot 4.166666666666667\right)\right)\right)}{i}\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-249}:\\
\;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{\frac{i}{n}}\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;t\_0 \cdot 100\\
\mathbf{else}:\\
\;\;\;\;n \cdot \frac{1}{0.01 + i \cdot -0.005}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < -inf.0Initial program 100.0%
associate-/r/100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*r/100.0%
sub-neg100.0%
distribute-lft-in100.0%
metadata-eval100.0%
metadata-eval100.0%
metadata-eval100.0%
fma-define100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in n around inf 0.8%
sub-neg0.8%
metadata-eval0.8%
metadata-eval0.8%
distribute-lft-in0.8%
metadata-eval0.8%
sub-neg0.8%
expm1-define0.8%
Simplified0.8%
Taylor expanded in i around 0 100.0%
*-commutative100.0%
Simplified100.0%
if -inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 2.00000000000000011e-249Initial program 25.5%
sub-neg25.5%
metadata-eval25.5%
Applied egg-rr25.5%
metadata-eval25.5%
sub-neg25.5%
exp-to-pow25.5%
log1p-undefine48.3%
*-commutative48.3%
expm1-undefine99.7%
Simplified99.7%
if 2.00000000000000011e-249 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 99.9%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) Initial program 0.0%
associate-/r/1.9%
associate-*r*1.9%
*-commutative1.9%
associate-*r/1.9%
sub-neg1.9%
distribute-lft-in1.9%
metadata-eval1.9%
metadata-eval1.9%
metadata-eval1.9%
fma-define1.9%
metadata-eval1.9%
Simplified1.9%
Taylor expanded in n around inf 1.9%
sub-neg1.9%
metadata-eval1.9%
metadata-eval1.9%
distribute-lft-in1.9%
metadata-eval1.9%
sub-neg1.9%
expm1-define85.3%
Simplified85.3%
clear-num85.3%
inv-pow85.3%
*-un-lft-identity85.3%
times-frac85.4%
metadata-eval85.4%
Applied egg-rr85.4%
unpow-185.4%
associate-*r/85.3%
Simplified85.3%
Taylor expanded in i around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification99.8%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (* n (/ (expm1 i) i)))))
(if (<= n -1.65e-201)
t_0
(if (<= n 2e-138)
(/ 0.0 (/ i n))
(if (<= n 8e-111) (* n (* (* n (log (/ i n))) (/ 100.0 i))) t_0)))))
double code(double i, double n) {
double t_0 = 100.0 * (n * (expm1(i) / i));
double tmp;
if (n <= -1.65e-201) {
tmp = t_0;
} else if (n <= 2e-138) {
tmp = 0.0 / (i / n);
} else if (n <= 8e-111) {
tmp = n * ((n * log((i / n))) * (100.0 / i));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = 100.0 * (n * (Math.expm1(i) / i));
double tmp;
if (n <= -1.65e-201) {
tmp = t_0;
} else if (n <= 2e-138) {
tmp = 0.0 / (i / n);
} else if (n <= 8e-111) {
tmp = n * ((n * Math.log((i / n))) * (100.0 / i));
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (n * (math.expm1(i) / i)) tmp = 0 if n <= -1.65e-201: tmp = t_0 elif n <= 2e-138: tmp = 0.0 / (i / n) elif n <= 8e-111: tmp = n * ((n * math.log((i / n))) * (100.0 / i)) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(n * Float64(expm1(i) / i))) tmp = 0.0 if (n <= -1.65e-201) tmp = t_0; elseif (n <= 2e-138) tmp = Float64(0.0 / Float64(i / n)); elseif (n <= 8e-111) tmp = Float64(n * Float64(Float64(n * log(Float64(i / n))) * Float64(100.0 / i))); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1.65e-201], t$95$0, If[LessEqual[n, 2e-138], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 8e-111], N[(n * N[(N[(n * N[Log[N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(100.0 / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{if}\;n \leq -1.65 \cdot 10^{-201}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 2 \cdot 10^{-138}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 8 \cdot 10^{-111}:\\
\;\;\;\;n \cdot \left(\left(n \cdot \log \left(\frac{i}{n}\right)\right) \cdot \frac{100}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -1.6500000000000002e-201 or 8.00000000000000071e-111 < n Initial program 25.7%
Taylor expanded in n around inf 34.8%
*-commutative34.8%
associate-/l*34.8%
expm1-define85.7%
Simplified85.7%
if -1.6500000000000002e-201 < n < 2.00000000000000013e-138Initial program 56.3%
associate-*r/56.3%
sub-neg56.3%
distribute-rgt-in56.3%
metadata-eval56.3%
metadata-eval56.3%
Simplified56.3%
Taylor expanded in i around 0 82.1%
if 2.00000000000000013e-138 < n < 8.00000000000000071e-111Initial program 36.8%
associate-/r/36.8%
associate-*r*36.8%
*-commutative36.8%
associate-*r/36.8%
sub-neg36.8%
distribute-lft-in36.8%
metadata-eval36.8%
metadata-eval36.8%
metadata-eval36.8%
fma-define36.8%
metadata-eval36.8%
Simplified36.8%
Taylor expanded in n around 0 96.0%
associate-*r/95.9%
*-commutative95.9%
mul-1-neg95.9%
unsub-neg95.9%
Simplified95.9%
associate-/l*96.0%
diff-log96.2%
Applied egg-rr96.2%
Final simplification85.5%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (* n (/ (expm1 i) i)))))
(if (<= n -5.2e-204)
t_0
(if (<= n 8.5e-139)
(/ 0.0 (/ i n))
(if (<= n 1.8e-112) (* n (* 100.0 (* (log (/ i n)) (/ n i)))) t_0)))))
double code(double i, double n) {
double t_0 = 100.0 * (n * (expm1(i) / i));
double tmp;
if (n <= -5.2e-204) {
tmp = t_0;
} else if (n <= 8.5e-139) {
tmp = 0.0 / (i / n);
} else if (n <= 1.8e-112) {
tmp = n * (100.0 * (log((i / n)) * (n / i)));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = 100.0 * (n * (Math.expm1(i) / i));
double tmp;
if (n <= -5.2e-204) {
tmp = t_0;
} else if (n <= 8.5e-139) {
tmp = 0.0 / (i / n);
} else if (n <= 1.8e-112) {
tmp = n * (100.0 * (Math.log((i / n)) * (n / i)));
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (n * (math.expm1(i) / i)) tmp = 0 if n <= -5.2e-204: tmp = t_0 elif n <= 8.5e-139: tmp = 0.0 / (i / n) elif n <= 1.8e-112: tmp = n * (100.0 * (math.log((i / n)) * (n / i))) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(n * Float64(expm1(i) / i))) tmp = 0.0 if (n <= -5.2e-204) tmp = t_0; elseif (n <= 8.5e-139) tmp = Float64(0.0 / Float64(i / n)); elseif (n <= 1.8e-112) tmp = Float64(n * Float64(100.0 * Float64(log(Float64(i / n)) * Float64(n / i)))); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -5.2e-204], t$95$0, If[LessEqual[n, 8.5e-139], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.8e-112], N[(n * N[(100.0 * N[(N[Log[N[(i / n), $MachinePrecision]], $MachinePrecision] * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{if}\;n \leq -5.2 \cdot 10^{-204}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 8.5 \cdot 10^{-139}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 1.8 \cdot 10^{-112}:\\
\;\;\;\;n \cdot \left(100 \cdot \left(\log \left(\frac{i}{n}\right) \cdot \frac{n}{i}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -5.19999999999999965e-204 or 1.8e-112 < n Initial program 25.7%
Taylor expanded in n around inf 34.8%
*-commutative34.8%
associate-/l*34.8%
expm1-define85.7%
Simplified85.7%
if -5.19999999999999965e-204 < n < 8.5000000000000003e-139Initial program 56.3%
associate-*r/56.3%
sub-neg56.3%
distribute-rgt-in56.3%
metadata-eval56.3%
metadata-eval56.3%
Simplified56.3%
Taylor expanded in i around 0 82.1%
if 8.5000000000000003e-139 < n < 1.8e-112Initial program 36.8%
associate-/r/36.8%
associate-*r*36.8%
*-commutative36.8%
associate-*r/36.8%
sub-neg36.8%
distribute-lft-in36.8%
metadata-eval36.8%
metadata-eval36.8%
metadata-eval36.8%
fma-define36.8%
metadata-eval36.8%
Simplified36.8%
Taylor expanded in n around 0 96.0%
associate-*r/95.9%
*-commutative95.9%
mul-1-neg95.9%
unsub-neg95.9%
Simplified95.9%
*-commutative95.9%
*-un-lft-identity95.9%
times-frac96.0%
metadata-eval96.0%
diff-log96.2%
Applied egg-rr96.2%
*-commutative96.2%
associate-/l*96.1%
Simplified96.1%
Final simplification85.5%
(FPCore (i n) :precision binary64 (if (or (<= n -9e-208) (not (<= n 4e-114))) (* 100.0 (* n (/ (expm1 i) i))) (/ 0.0 (/ i n))))
double code(double i, double n) {
double tmp;
if ((n <= -9e-208) || !(n <= 4e-114)) {
tmp = 100.0 * (n * (expm1(i) / i));
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((n <= -9e-208) || !(n <= 4e-114)) {
tmp = 100.0 * (n * (Math.expm1(i) / i));
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -9e-208) or not (n <= 4e-114): tmp = 100.0 * (n * (math.expm1(i) / i)) else: tmp = 0.0 / (i / n) return tmp
function code(i, n) tmp = 0.0 if ((n <= -9e-208) || !(n <= 4e-114)) tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); else tmp = Float64(0.0 / Float64(i / n)); end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -9e-208], N[Not[LessEqual[n, 4e-114]], $MachinePrecision]], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -9 \cdot 10^{-208} \lor \neg \left(n \leq 4 \cdot 10^{-114}\right):\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -8.9999999999999992e-208 or 4.0000000000000002e-114 < n Initial program 25.6%
Taylor expanded in n around inf 34.6%
*-commutative34.6%
associate-/l*34.7%
expm1-define85.3%
Simplified85.3%
if -8.9999999999999992e-208 < n < 4.0000000000000002e-114Initial program 54.0%
associate-*r/54.0%
sub-neg54.0%
distribute-rgt-in54.0%
metadata-eval54.0%
metadata-eval54.0%
Simplified54.0%
Taylor expanded in i around 0 75.6%
Final simplification83.9%
(FPCore (i n) :precision binary64 (if (or (<= n -7.5e-209) (not (<= n 3.8e-114))) (* n (/ (* 100.0 (expm1 i)) i)) (/ 0.0 (/ i n))))
double code(double i, double n) {
double tmp;
if ((n <= -7.5e-209) || !(n <= 3.8e-114)) {
tmp = n * ((100.0 * expm1(i)) / i);
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((n <= -7.5e-209) || !(n <= 3.8e-114)) {
tmp = n * ((100.0 * Math.expm1(i)) / i);
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -7.5e-209) or not (n <= 3.8e-114): tmp = n * ((100.0 * math.expm1(i)) / i) else: tmp = 0.0 / (i / n) return tmp
function code(i, n) tmp = 0.0 if ((n <= -7.5e-209) || !(n <= 3.8e-114)) tmp = Float64(n * Float64(Float64(100.0 * expm1(i)) / i)); else tmp = Float64(0.0 / Float64(i / n)); end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -7.5e-209], N[Not[LessEqual[n, 3.8e-114]], $MachinePrecision]], N[(n * N[(N[(100.0 * N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -7.5 \cdot 10^{-209} \lor \neg \left(n \leq 3.8 \cdot 10^{-114}\right):\\
\;\;\;\;n \cdot \frac{100 \cdot \mathsf{expm1}\left(i\right)}{i}\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -7.49999999999999965e-209 or 3.7999999999999998e-114 < n Initial program 25.6%
associate-/r/25.7%
associate-*r*25.7%
*-commutative25.7%
associate-*r/25.7%
sub-neg25.7%
distribute-lft-in25.7%
metadata-eval25.7%
metadata-eval25.7%
metadata-eval25.7%
fma-define25.7%
metadata-eval25.7%
Simplified25.7%
Taylor expanded in n around inf 34.6%
sub-neg34.6%
metadata-eval34.6%
metadata-eval34.6%
distribute-lft-in34.7%
metadata-eval34.7%
sub-neg34.7%
expm1-define85.3%
Simplified85.3%
if -7.49999999999999965e-209 < n < 3.7999999999999998e-114Initial program 54.0%
associate-*r/54.0%
sub-neg54.0%
distribute-rgt-in54.0%
metadata-eval54.0%
metadata-eval54.0%
Simplified54.0%
Taylor expanded in i around 0 75.6%
Final simplification83.9%
(FPCore (i n)
:precision binary64
(if (<= n -1.05e+179)
(* 100.0 (* n (+ 1.0 (* i (+ 0.5 (* i 0.16666666666666666))))))
(if (<= n -8.8e-209)
(* n (/ 1.0 (+ 0.01 (* i -0.005))))
(if (<= n 4.4e-114)
(/ 0.0 (/ i n))
(*
100.0
(*
n
(/
(*
i
(+
1.0
(*
i
(+
0.5
(* i (+ 0.16666666666666666 (* i 0.041666666666666664)))))))
i)))))))
double code(double i, double n) {
double tmp;
if (n <= -1.05e+179) {
tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * 0.16666666666666666)))));
} else if (n <= -8.8e-209) {
tmp = n * (1.0 / (0.01 + (i * -0.005)));
} else if (n <= 4.4e-114) {
tmp = 0.0 / (i / n);
} else {
tmp = 100.0 * (n * ((i * (1.0 + (i * (0.5 + (i * (0.16666666666666666 + (i * 0.041666666666666664))))))) / i));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-1.05d+179)) then
tmp = 100.0d0 * (n * (1.0d0 + (i * (0.5d0 + (i * 0.16666666666666666d0)))))
else if (n <= (-8.8d-209)) then
tmp = n * (1.0d0 / (0.01d0 + (i * (-0.005d0))))
else if (n <= 4.4d-114) then
tmp = 0.0d0 / (i / n)
else
tmp = 100.0d0 * (n * ((i * (1.0d0 + (i * (0.5d0 + (i * (0.16666666666666666d0 + (i * 0.041666666666666664d0))))))) / i))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -1.05e+179) {
tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * 0.16666666666666666)))));
} else if (n <= -8.8e-209) {
tmp = n * (1.0 / (0.01 + (i * -0.005)));
} else if (n <= 4.4e-114) {
tmp = 0.0 / (i / n);
} else {
tmp = 100.0 * (n * ((i * (1.0 + (i * (0.5 + (i * (0.16666666666666666 + (i * 0.041666666666666664))))))) / i));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -1.05e+179: tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * 0.16666666666666666))))) elif n <= -8.8e-209: tmp = n * (1.0 / (0.01 + (i * -0.005))) elif n <= 4.4e-114: tmp = 0.0 / (i / n) else: tmp = 100.0 * (n * ((i * (1.0 + (i * (0.5 + (i * (0.16666666666666666 + (i * 0.041666666666666664))))))) / i)) return tmp
function code(i, n) tmp = 0.0 if (n <= -1.05e+179) tmp = Float64(100.0 * Float64(n * Float64(1.0 + Float64(i * Float64(0.5 + Float64(i * 0.16666666666666666)))))); elseif (n <= -8.8e-209) tmp = Float64(n * Float64(1.0 / Float64(0.01 + Float64(i * -0.005)))); elseif (n <= 4.4e-114) tmp = Float64(0.0 / Float64(i / n)); else tmp = Float64(100.0 * Float64(n * Float64(Float64(i * Float64(1.0 + Float64(i * Float64(0.5 + Float64(i * Float64(0.16666666666666666 + Float64(i * 0.041666666666666664))))))) / i))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -1.05e+179) tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * 0.16666666666666666))))); elseif (n <= -8.8e-209) tmp = n * (1.0 / (0.01 + (i * -0.005))); elseif (n <= 4.4e-114) tmp = 0.0 / (i / n); else tmp = 100.0 * (n * ((i * (1.0 + (i * (0.5 + (i * (0.16666666666666666 + (i * 0.041666666666666664))))))) / i)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -1.05e+179], N[(100.0 * N[(n * N[(1.0 + N[(i * N[(0.5 + N[(i * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -8.8e-209], N[(n * N[(1.0 / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 4.4e-114], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n * N[(N[(i * N[(1.0 + N[(i * N[(0.5 + N[(i * N[(0.16666666666666666 + N[(i * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.05 \cdot 10^{+179}:\\
\;\;\;\;100 \cdot \left(n \cdot \left(1 + i \cdot \left(0.5 + i \cdot 0.16666666666666666\right)\right)\right)\\
\mathbf{elif}\;n \leq -8.8 \cdot 10^{-209}:\\
\;\;\;\;n \cdot \frac{1}{0.01 + i \cdot -0.005}\\
\mathbf{elif}\;n \leq 4.4 \cdot 10^{-114}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{i \cdot \left(1 + i \cdot \left(0.5 + i \cdot \left(0.16666666666666666 + i \cdot 0.041666666666666664\right)\right)\right)}{i}\right)\\
\end{array}
\end{array}
if n < -1.0499999999999999e179Initial program 6.2%
Taylor expanded in n around inf 35.0%
*-commutative35.0%
associate-/l*35.0%
expm1-define94.5%
Simplified94.5%
Taylor expanded in i around 0 79.4%
*-commutative79.4%
Simplified79.4%
if -1.0499999999999999e179 < n < -8.80000000000000039e-209Initial program 32.5%
associate-/r/32.0%
associate-*r*31.9%
*-commutative31.9%
associate-*r/32.0%
sub-neg32.0%
distribute-lft-in31.8%
metadata-eval31.8%
metadata-eval31.8%
metadata-eval31.8%
fma-define32.0%
metadata-eval32.0%
Simplified32.0%
Taylor expanded in n around inf 31.2%
sub-neg31.2%
metadata-eval31.2%
metadata-eval31.2%
distribute-lft-in31.2%
metadata-eval31.2%
sub-neg31.2%
expm1-define77.3%
Simplified77.3%
clear-num77.3%
inv-pow77.3%
*-un-lft-identity77.3%
times-frac77.4%
metadata-eval77.4%
Applied egg-rr77.4%
unpow-177.4%
associate-*r/77.4%
Simplified77.4%
Taylor expanded in i around 0 62.0%
*-commutative62.0%
Simplified62.0%
if -8.80000000000000039e-209 < n < 4.40000000000000022e-114Initial program 54.0%
associate-*r/54.0%
sub-neg54.0%
distribute-rgt-in54.0%
metadata-eval54.0%
metadata-eval54.0%
Simplified54.0%
Taylor expanded in i around 0 75.6%
if 4.40000000000000022e-114 < n Initial program 26.7%
Taylor expanded in n around inf 37.9%
*-commutative37.9%
associate-/l*37.9%
expm1-define89.4%
Simplified89.4%
Taylor expanded in i around 0 83.1%
*-commutative83.1%
Simplified83.1%
Final simplification74.1%
(FPCore (i n)
:precision binary64
(if (<= n -2.4e+179)
(* 100.0 (* n (+ 1.0 (* i (+ 0.5 (* i 0.16666666666666666))))))
(if (<= n -1.95e-209)
(* n (/ 1.0 (+ 0.01 (* i -0.005))))
(if (<= n 1.65e-113)
(/ 0.0 (/ i n))
(*
n
(/
(*
i
(+
100.0
(*
i
(+ 50.0 (* i (+ 16.666666666666668 (* i 4.166666666666667)))))))
i))))))
double code(double i, double n) {
double tmp;
if (n <= -2.4e+179) {
tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * 0.16666666666666666)))));
} else if (n <= -1.95e-209) {
tmp = n * (1.0 / (0.01 + (i * -0.005)));
} else if (n <= 1.65e-113) {
tmp = 0.0 / (i / n);
} else {
tmp = n * ((i * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))))) / i);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-2.4d+179)) then
tmp = 100.0d0 * (n * (1.0d0 + (i * (0.5d0 + (i * 0.16666666666666666d0)))))
else if (n <= (-1.95d-209)) then
tmp = n * (1.0d0 / (0.01d0 + (i * (-0.005d0))))
else if (n <= 1.65d-113) then
tmp = 0.0d0 / (i / n)
else
tmp = n * ((i * (100.0d0 + (i * (50.0d0 + (i * (16.666666666666668d0 + (i * 4.166666666666667d0))))))) / i)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -2.4e+179) {
tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * 0.16666666666666666)))));
} else if (n <= -1.95e-209) {
tmp = n * (1.0 / (0.01 + (i * -0.005)));
} else if (n <= 1.65e-113) {
tmp = 0.0 / (i / n);
} else {
tmp = n * ((i * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))))) / i);
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -2.4e+179: tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * 0.16666666666666666))))) elif n <= -1.95e-209: tmp = n * (1.0 / (0.01 + (i * -0.005))) elif n <= 1.65e-113: tmp = 0.0 / (i / n) else: tmp = n * ((i * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))))) / i) return tmp
function code(i, n) tmp = 0.0 if (n <= -2.4e+179) tmp = Float64(100.0 * Float64(n * Float64(1.0 + Float64(i * Float64(0.5 + Float64(i * 0.16666666666666666)))))); elseif (n <= -1.95e-209) tmp = Float64(n * Float64(1.0 / Float64(0.01 + Float64(i * -0.005)))); elseif (n <= 1.65e-113) tmp = Float64(0.0 / Float64(i / n)); else tmp = Float64(n * Float64(Float64(i * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * Float64(16.666666666666668 + Float64(i * 4.166666666666667))))))) / i)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -2.4e+179) tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * 0.16666666666666666))))); elseif (n <= -1.95e-209) tmp = n * (1.0 / (0.01 + (i * -0.005))); elseif (n <= 1.65e-113) tmp = 0.0 / (i / n); else tmp = n * ((i * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))))) / i); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -2.4e+179], N[(100.0 * N[(n * N[(1.0 + N[(i * N[(0.5 + N[(i * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -1.95e-209], N[(n * N[(1.0 / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.65e-113], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(n * N[(N[(i * N[(100.0 + N[(i * N[(50.0 + N[(i * N[(16.666666666666668 + N[(i * 4.166666666666667), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.4 \cdot 10^{+179}:\\
\;\;\;\;100 \cdot \left(n \cdot \left(1 + i \cdot \left(0.5 + i \cdot 0.16666666666666666\right)\right)\right)\\
\mathbf{elif}\;n \leq -1.95 \cdot 10^{-209}:\\
\;\;\;\;n \cdot \frac{1}{0.01 + i \cdot -0.005}\\
\mathbf{elif}\;n \leq 1.65 \cdot 10^{-113}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \frac{i \cdot \left(100 + i \cdot \left(50 + i \cdot \left(16.666666666666668 + i \cdot 4.166666666666667\right)\right)\right)}{i}\\
\end{array}
\end{array}
if n < -2.40000000000000013e179Initial program 6.2%
Taylor expanded in n around inf 35.0%
*-commutative35.0%
associate-/l*35.0%
expm1-define94.5%
Simplified94.5%
Taylor expanded in i around 0 79.4%
*-commutative79.4%
Simplified79.4%
if -2.40000000000000013e179 < n < -1.95e-209Initial program 32.5%
associate-/r/32.0%
associate-*r*31.9%
*-commutative31.9%
associate-*r/32.0%
sub-neg32.0%
distribute-lft-in31.8%
metadata-eval31.8%
metadata-eval31.8%
metadata-eval31.8%
fma-define32.0%
metadata-eval32.0%
Simplified32.0%
Taylor expanded in n around inf 31.2%
sub-neg31.2%
metadata-eval31.2%
metadata-eval31.2%
distribute-lft-in31.2%
metadata-eval31.2%
sub-neg31.2%
expm1-define77.3%
Simplified77.3%
clear-num77.3%
inv-pow77.3%
*-un-lft-identity77.3%
times-frac77.4%
metadata-eval77.4%
Applied egg-rr77.4%
unpow-177.4%
associate-*r/77.4%
Simplified77.4%
Taylor expanded in i around 0 62.0%
*-commutative62.0%
Simplified62.0%
if -1.95e-209 < n < 1.6500000000000001e-113Initial program 54.0%
associate-*r/54.0%
sub-neg54.0%
distribute-rgt-in54.0%
metadata-eval54.0%
metadata-eval54.0%
Simplified54.0%
Taylor expanded in i around 0 75.6%
if 1.6500000000000001e-113 < n Initial program 26.7%
associate-/r/27.1%
associate-*r*27.1%
*-commutative27.1%
associate-*r/27.1%
sub-neg27.1%
distribute-lft-in27.1%
metadata-eval27.1%
metadata-eval27.1%
metadata-eval27.1%
fma-define27.1%
metadata-eval27.1%
Simplified27.1%
Taylor expanded in n around inf 37.9%
sub-neg37.9%
metadata-eval37.9%
metadata-eval37.9%
distribute-lft-in37.9%
metadata-eval37.9%
sub-neg37.9%
expm1-define89.3%
Simplified89.3%
Taylor expanded in i around 0 83.0%
*-commutative83.0%
Simplified83.0%
Final simplification74.0%
(FPCore (i n)
:precision binary64
(if (<= n -3.1e+181)
(* 100.0 (* n (+ 1.0 (* i (+ 0.5 (* i 0.16666666666666666))))))
(if (<= n -5.1e-201)
(* n (/ 1.0 (+ 0.01 (* i -0.005))))
(if (<= n 6e-114)
(/ 0.0 (/ i n))
(*
n
(+
100.0
(*
i
(+ 50.0 (* i (+ 16.666666666666668 (* i 4.166666666666667)))))))))))
double code(double i, double n) {
double tmp;
if (n <= -3.1e+181) {
tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * 0.16666666666666666)))));
} else if (n <= -5.1e-201) {
tmp = n * (1.0 / (0.01 + (i * -0.005)));
} else if (n <= 6e-114) {
tmp = 0.0 / (i / n);
} else {
tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-3.1d+181)) then
tmp = 100.0d0 * (n * (1.0d0 + (i * (0.5d0 + (i * 0.16666666666666666d0)))))
else if (n <= (-5.1d-201)) then
tmp = n * (1.0d0 / (0.01d0 + (i * (-0.005d0))))
else if (n <= 6d-114) then
tmp = 0.0d0 / (i / n)
else
tmp = n * (100.0d0 + (i * (50.0d0 + (i * (16.666666666666668d0 + (i * 4.166666666666667d0))))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -3.1e+181) {
tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * 0.16666666666666666)))));
} else if (n <= -5.1e-201) {
tmp = n * (1.0 / (0.01 + (i * -0.005)));
} else if (n <= 6e-114) {
tmp = 0.0 / (i / n);
} else {
tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -3.1e+181: tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * 0.16666666666666666))))) elif n <= -5.1e-201: tmp = n * (1.0 / (0.01 + (i * -0.005))) elif n <= 6e-114: tmp = 0.0 / (i / n) else: tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667)))))) return tmp
function code(i, n) tmp = 0.0 if (n <= -3.1e+181) tmp = Float64(100.0 * Float64(n * Float64(1.0 + Float64(i * Float64(0.5 + Float64(i * 0.16666666666666666)))))); elseif (n <= -5.1e-201) tmp = Float64(n * Float64(1.0 / Float64(0.01 + Float64(i * -0.005)))); elseif (n <= 6e-114) tmp = Float64(0.0 / Float64(i / n)); else tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * Float64(16.666666666666668 + Float64(i * 4.166666666666667))))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -3.1e+181) tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * 0.16666666666666666))))); elseif (n <= -5.1e-201) tmp = n * (1.0 / (0.01 + (i * -0.005))); elseif (n <= 6e-114) tmp = 0.0 / (i / n); else tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667)))))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -3.1e+181], N[(100.0 * N[(n * N[(1.0 + N[(i * N[(0.5 + N[(i * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -5.1e-201], N[(n * N[(1.0 / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 6e-114], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * N[(16.666666666666668 + N[(i * 4.166666666666667), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -3.1 \cdot 10^{+181}:\\
\;\;\;\;100 \cdot \left(n \cdot \left(1 + i \cdot \left(0.5 + i \cdot 0.16666666666666666\right)\right)\right)\\
\mathbf{elif}\;n \leq -5.1 \cdot 10^{-201}:\\
\;\;\;\;n \cdot \frac{1}{0.01 + i \cdot -0.005}\\
\mathbf{elif}\;n \leq 6 \cdot 10^{-114}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot \left(16.666666666666668 + i \cdot 4.166666666666667\right)\right)\right)\\
\end{array}
\end{array}
if n < -3.09999999999999989e181Initial program 6.2%
Taylor expanded in n around inf 35.0%
*-commutative35.0%
associate-/l*35.0%
expm1-define94.5%
Simplified94.5%
Taylor expanded in i around 0 79.4%
*-commutative79.4%
Simplified79.4%
if -3.09999999999999989e181 < n < -5.1000000000000001e-201Initial program 32.5%
associate-/r/32.0%
associate-*r*31.9%
*-commutative31.9%
associate-*r/32.0%
sub-neg32.0%
distribute-lft-in31.8%
metadata-eval31.8%
metadata-eval31.8%
metadata-eval31.8%
fma-define32.0%
metadata-eval32.0%
Simplified32.0%
Taylor expanded in n around inf 31.2%
sub-neg31.2%
metadata-eval31.2%
metadata-eval31.2%
distribute-lft-in31.2%
metadata-eval31.2%
sub-neg31.2%
expm1-define77.3%
Simplified77.3%
clear-num77.3%
inv-pow77.3%
*-un-lft-identity77.3%
times-frac77.4%
metadata-eval77.4%
Applied egg-rr77.4%
unpow-177.4%
associate-*r/77.4%
Simplified77.4%
Taylor expanded in i around 0 62.0%
*-commutative62.0%
Simplified62.0%
if -5.1000000000000001e-201 < n < 6.0000000000000003e-114Initial program 54.0%
associate-*r/54.0%
sub-neg54.0%
distribute-rgt-in54.0%
metadata-eval54.0%
metadata-eval54.0%
Simplified54.0%
Taylor expanded in i around 0 75.6%
if 6.0000000000000003e-114 < n Initial program 26.7%
associate-/r/27.1%
associate-*r*27.1%
*-commutative27.1%
associate-*r/27.1%
sub-neg27.1%
distribute-lft-in27.1%
metadata-eval27.1%
metadata-eval27.1%
metadata-eval27.1%
fma-define27.1%
metadata-eval27.1%
Simplified27.1%
Taylor expanded in n around inf 37.9%
sub-neg37.9%
metadata-eval37.9%
metadata-eval37.9%
distribute-lft-in37.9%
metadata-eval37.9%
sub-neg37.9%
expm1-define89.3%
Simplified89.3%
Taylor expanded in i around 0 82.1%
*-commutative82.1%
Simplified82.1%
Final simplification73.7%
(FPCore (i n)
:precision binary64
(if (<= n -1.9e+180)
(* 100.0 (* n (+ 1.0 (* i (+ 0.5 (* i 0.16666666666666666))))))
(if (<= n -3e-207)
(* n (/ 1.0 (+ 0.01 (* i -0.005))))
(if (<= n 3.8e-114)
(/ 0.0 (/ i n))
(* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668)))))))))
double code(double i, double n) {
double tmp;
if (n <= -1.9e+180) {
tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * 0.16666666666666666)))));
} else if (n <= -3e-207) {
tmp = n * (1.0 / (0.01 + (i * -0.005)));
} else if (n <= 3.8e-114) {
tmp = 0.0 / (i / n);
} else {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-1.9d+180)) then
tmp = 100.0d0 * (n * (1.0d0 + (i * (0.5d0 + (i * 0.16666666666666666d0)))))
else if (n <= (-3d-207)) then
tmp = n * (1.0d0 / (0.01d0 + (i * (-0.005d0))))
else if (n <= 3.8d-114) then
tmp = 0.0d0 / (i / n)
else
tmp = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -1.9e+180) {
tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * 0.16666666666666666)))));
} else if (n <= -3e-207) {
tmp = n * (1.0 / (0.01 + (i * -0.005)));
} else if (n <= 3.8e-114) {
tmp = 0.0 / (i / n);
} else {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -1.9e+180: tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * 0.16666666666666666))))) elif n <= -3e-207: tmp = n * (1.0 / (0.01 + (i * -0.005))) elif n <= 3.8e-114: tmp = 0.0 / (i / n) else: tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) return tmp
function code(i, n) tmp = 0.0 if (n <= -1.9e+180) tmp = Float64(100.0 * Float64(n * Float64(1.0 + Float64(i * Float64(0.5 + Float64(i * 0.16666666666666666)))))); elseif (n <= -3e-207) tmp = Float64(n * Float64(1.0 / Float64(0.01 + Float64(i * -0.005)))); elseif (n <= 3.8e-114) tmp = Float64(0.0 / Float64(i / n)); else tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -1.9e+180) tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * 0.16666666666666666))))); elseif (n <= -3e-207) tmp = n * (1.0 / (0.01 + (i * -0.005))); elseif (n <= 3.8e-114) tmp = 0.0 / (i / n); else tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -1.9e+180], N[(100.0 * N[(n * N[(1.0 + N[(i * N[(0.5 + N[(i * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -3e-207], N[(n * N[(1.0 / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 3.8e-114], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.9 \cdot 10^{+180}:\\
\;\;\;\;100 \cdot \left(n \cdot \left(1 + i \cdot \left(0.5 + i \cdot 0.16666666666666666\right)\right)\right)\\
\mathbf{elif}\;n \leq -3 \cdot 10^{-207}:\\
\;\;\;\;n \cdot \frac{1}{0.01 + i \cdot -0.005}\\
\mathbf{elif}\;n \leq 3.8 \cdot 10^{-114}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\end{array}
\end{array}
if n < -1.9e180Initial program 6.2%
Taylor expanded in n around inf 35.0%
*-commutative35.0%
associate-/l*35.0%
expm1-define94.5%
Simplified94.5%
Taylor expanded in i around 0 79.4%
*-commutative79.4%
Simplified79.4%
if -1.9e180 < n < -2.9999999999999999e-207Initial program 32.5%
associate-/r/32.0%
associate-*r*31.9%
*-commutative31.9%
associate-*r/32.0%
sub-neg32.0%
distribute-lft-in31.8%
metadata-eval31.8%
metadata-eval31.8%
metadata-eval31.8%
fma-define32.0%
metadata-eval32.0%
Simplified32.0%
Taylor expanded in n around inf 31.2%
sub-neg31.2%
metadata-eval31.2%
metadata-eval31.2%
distribute-lft-in31.2%
metadata-eval31.2%
sub-neg31.2%
expm1-define77.3%
Simplified77.3%
clear-num77.3%
inv-pow77.3%
*-un-lft-identity77.3%
times-frac77.4%
metadata-eval77.4%
Applied egg-rr77.4%
unpow-177.4%
associate-*r/77.4%
Simplified77.4%
Taylor expanded in i around 0 62.0%
*-commutative62.0%
Simplified62.0%
if -2.9999999999999999e-207 < n < 3.7999999999999998e-114Initial program 54.0%
associate-*r/54.0%
sub-neg54.0%
distribute-rgt-in54.0%
metadata-eval54.0%
metadata-eval54.0%
Simplified54.0%
Taylor expanded in i around 0 75.6%
if 3.7999999999999998e-114 < n Initial program 26.7%
associate-/r/27.1%
associate-*r*27.1%
*-commutative27.1%
associate-*r/27.1%
sub-neg27.1%
distribute-lft-in27.1%
metadata-eval27.1%
metadata-eval27.1%
metadata-eval27.1%
fma-define27.1%
metadata-eval27.1%
Simplified27.1%
Taylor expanded in n around inf 37.9%
sub-neg37.9%
metadata-eval37.9%
metadata-eval37.9%
distribute-lft-in37.9%
metadata-eval37.9%
sub-neg37.9%
expm1-define89.3%
Simplified89.3%
Taylor expanded in i around 0 78.0%
*-commutative78.0%
Simplified78.0%
Final simplification72.2%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668)))))))
(if (<= n -7.8e+183)
t_0
(if (<= n -5.8e-211)
(* n (/ 1.0 (+ 0.01 (* i -0.005))))
(if (<= n 3.8e-114) (/ 0.0 (/ i n)) t_0)))))
double code(double i, double n) {
double t_0 = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
double tmp;
if (n <= -7.8e+183) {
tmp = t_0;
} else if (n <= -5.8e-211) {
tmp = n * (1.0 / (0.01 + (i * -0.005)));
} else if (n <= 3.8e-114) {
tmp = 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 * 16.666666666666668d0))))
if (n <= (-7.8d+183)) then
tmp = t_0
else if (n <= (-5.8d-211)) then
tmp = n * (1.0d0 / (0.01d0 + (i * (-0.005d0))))
else if (n <= 3.8d-114) then
tmp = 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 * 16.666666666666668))));
double tmp;
if (n <= -7.8e+183) {
tmp = t_0;
} else if (n <= -5.8e-211) {
tmp = n * (1.0 / (0.01 + (i * -0.005)));
} else if (n <= 3.8e-114) {
tmp = 0.0 / (i / n);
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) tmp = 0 if n <= -7.8e+183: tmp = t_0 elif n <= -5.8e-211: tmp = n * (1.0 / (0.01 + (i * -0.005))) elif n <= 3.8e-114: tmp = 0.0 / (i / n) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))) tmp = 0.0 if (n <= -7.8e+183) tmp = t_0; elseif (n <= -5.8e-211) tmp = Float64(n * Float64(1.0 / Float64(0.01 + Float64(i * -0.005)))); elseif (n <= 3.8e-114) tmp = 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 * 16.666666666666668)))); tmp = 0.0; if (n <= -7.8e+183) tmp = t_0; elseif (n <= -5.8e-211) tmp = n * (1.0 / (0.01 + (i * -0.005))); elseif (n <= 3.8e-114) tmp = 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[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -7.8e+183], t$95$0, If[LessEqual[n, -5.8e-211], N[(n * N[(1.0 / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 3.8e-114], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\mathbf{if}\;n \leq -7.8 \cdot 10^{+183}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq -5.8 \cdot 10^{-211}:\\
\;\;\;\;n \cdot \frac{1}{0.01 + i \cdot -0.005}\\
\mathbf{elif}\;n \leq 3.8 \cdot 10^{-114}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -7.7999999999999998e183 or 3.7999999999999998e-114 < n Initial program 20.8%
associate-/r/21.4%
associate-*r*21.4%
*-commutative21.4%
associate-*r/21.4%
sub-neg21.4%
distribute-lft-in21.4%
metadata-eval21.4%
metadata-eval21.4%
metadata-eval21.4%
fma-define21.4%
metadata-eval21.4%
Simplified21.4%
Taylor expanded in n around inf 37.1%
sub-neg37.1%
metadata-eval37.1%
metadata-eval37.1%
distribute-lft-in37.1%
metadata-eval37.1%
sub-neg37.1%
expm1-define90.8%
Simplified90.8%
Taylor expanded in i around 0 78.4%
*-commutative78.4%
Simplified78.4%
if -7.7999999999999998e183 < n < -5.80000000000000029e-211Initial program 32.5%
associate-/r/32.0%
associate-*r*31.9%
*-commutative31.9%
associate-*r/32.0%
sub-neg32.0%
distribute-lft-in31.8%
metadata-eval31.8%
metadata-eval31.8%
metadata-eval31.8%
fma-define32.0%
metadata-eval32.0%
Simplified32.0%
Taylor expanded in n around inf 31.2%
sub-neg31.2%
metadata-eval31.2%
metadata-eval31.2%
distribute-lft-in31.2%
metadata-eval31.2%
sub-neg31.2%
expm1-define77.3%
Simplified77.3%
clear-num77.3%
inv-pow77.3%
*-un-lft-identity77.3%
times-frac77.4%
metadata-eval77.4%
Applied egg-rr77.4%
unpow-177.4%
associate-*r/77.4%
Simplified77.4%
Taylor expanded in i around 0 62.0%
*-commutative62.0%
Simplified62.0%
if -5.80000000000000029e-211 < n < 3.7999999999999998e-114Initial program 54.0%
associate-*r/54.0%
sub-neg54.0%
distribute-rgt-in54.0%
metadata-eval54.0%
metadata-eval54.0%
Simplified54.0%
Taylor expanded in i around 0 75.6%
Final simplification72.2%
(FPCore (i n) :precision binary64 (if (or (<= n -4.2e+39) (not (<= n 3.7e-17))) (* n (+ 100.0 (* i 50.0))) (* 100.0 (/ i (/ i n)))))
double code(double i, double n) {
double tmp;
if ((n <= -4.2e+39) || !(n <= 3.7e-17)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-4.2d+39)) .or. (.not. (n <= 3.7d-17))) then
tmp = n * (100.0d0 + (i * 50.0d0))
else
tmp = 100.0d0 * (i / (i / n))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -4.2e+39) || !(n <= 3.7e-17)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -4.2e+39) or not (n <= 3.7e-17): tmp = n * (100.0 + (i * 50.0)) else: tmp = 100.0 * (i / (i / n)) return tmp
function code(i, n) tmp = 0.0 if ((n <= -4.2e+39) || !(n <= 3.7e-17)) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); else tmp = Float64(100.0 * Float64(i / Float64(i / n))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -4.2e+39) || ~((n <= 3.7e-17))) tmp = n * (100.0 + (i * 50.0)); else tmp = 100.0 * (i / (i / n)); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -4.2e+39], N[Not[LessEqual[n, 3.7e-17]], $MachinePrecision]], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -4.2 \cdot 10^{+39} \lor \neg \left(n \leq 3.7 \cdot 10^{-17}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -4.1999999999999997e39 or 3.6999999999999997e-17 < n Initial program 24.5%
Taylor expanded in n around inf 41.6%
*-commutative41.6%
associate-/l*41.6%
expm1-define90.6%
Simplified90.6%
Taylor expanded in i around 0 64.9%
+-commutative64.9%
associate-*r*64.9%
distribute-rgt-in65.0%
*-commutative65.0%
Simplified65.0%
if -4.1999999999999997e39 < n < 3.6999999999999997e-17Initial program 37.0%
Taylor expanded in i around 0 58.1%
Final simplification62.1%
(FPCore (i n) :precision binary64 (if (or (<= i -6.5e+158) (not (<= i 3.3e-35))) (* 100.0 (* i (/ n i))) (* n 100.0)))
double code(double i, double n) {
double tmp;
if ((i <= -6.5e+158) || !(i <= 3.3e-35)) {
tmp = 100.0 * (i * (n / i));
} else {
tmp = n * 100.0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((i <= (-6.5d+158)) .or. (.not. (i <= 3.3d-35))) then
tmp = 100.0d0 * (i * (n / i))
else
tmp = n * 100.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((i <= -6.5e+158) || !(i <= 3.3e-35)) {
tmp = 100.0 * (i * (n / i));
} else {
tmp = n * 100.0;
}
return tmp;
}
def code(i, n): tmp = 0 if (i <= -6.5e+158) or not (i <= 3.3e-35): tmp = 100.0 * (i * (n / i)) else: tmp = n * 100.0 return tmp
function code(i, n) tmp = 0.0 if ((i <= -6.5e+158) || !(i <= 3.3e-35)) tmp = Float64(100.0 * Float64(i * Float64(n / i))); else tmp = Float64(n * 100.0); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((i <= -6.5e+158) || ~((i <= 3.3e-35))) tmp = 100.0 * (i * (n / i)); else tmp = n * 100.0; end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[i, -6.5e+158], N[Not[LessEqual[i, 3.3e-35]], $MachinePrecision]], N[(100.0 * N[(i * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -6.5 \cdot 10^{+158} \lor \neg \left(i \leq 3.3 \cdot 10^{-35}\right):\\
\;\;\;\;100 \cdot \left(i \cdot \frac{n}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if i < -6.5000000000000001e158 or 3.3e-35 < i Initial program 57.9%
Taylor expanded in i around 0 23.4%
clear-num23.4%
associate-/r/23.4%
clear-num22.3%
Applied egg-rr22.3%
if -6.5000000000000001e158 < i < 3.3e-35Initial program 14.9%
associate-/r/15.5%
associate-*r*15.5%
*-commutative15.5%
associate-*r/15.5%
sub-neg15.5%
distribute-lft-in15.4%
metadata-eval15.4%
metadata-eval15.4%
metadata-eval15.4%
fma-define15.5%
metadata-eval15.5%
Simplified15.5%
Taylor expanded in i around 0 71.7%
*-commutative71.7%
Simplified71.7%
Final simplification54.7%
(FPCore (i n) :precision binary64 (if (<= n -1.06e-203) (* n (/ 1.0 (+ 0.01 (* i -0.005)))) (if (<= n 4.1e-114) (/ 0.0 (/ i n)) (* n (+ 100.0 (* i 50.0))))))
double code(double i, double n) {
double tmp;
if (n <= -1.06e-203) {
tmp = n * (1.0 / (0.01 + (i * -0.005)));
} else if (n <= 4.1e-114) {
tmp = 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.06d-203)) then
tmp = n * (1.0d0 / (0.01d0 + (i * (-0.005d0))))
else if (n <= 4.1d-114) then
tmp = 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.06e-203) {
tmp = n * (1.0 / (0.01 + (i * -0.005)));
} else if (n <= 4.1e-114) {
tmp = 0.0 / (i / n);
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -1.06e-203: tmp = n * (1.0 / (0.01 + (i * -0.005))) elif n <= 4.1e-114: tmp = 0.0 / (i / n) else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) tmp = 0.0 if (n <= -1.06e-203) tmp = Float64(n * Float64(1.0 / Float64(0.01 + Float64(i * -0.005)))); elseif (n <= 4.1e-114) tmp = 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.06e-203) tmp = n * (1.0 / (0.01 + (i * -0.005))); elseif (n <= 4.1e-114) tmp = 0.0 / (i / n); else tmp = n * (100.0 + (i * 50.0)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -1.06e-203], N[(n * N[(1.0 / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 4.1e-114], N[(0.0 / N[(i / n), $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.06 \cdot 10^{-203}:\\
\;\;\;\;n \cdot \frac{1}{0.01 + i \cdot -0.005}\\
\mathbf{elif}\;n \leq 4.1 \cdot 10^{-114}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < -1.0599999999999999e-203Initial program 24.8%
associate-/r/24.7%
associate-*r*24.7%
*-commutative24.7%
associate-*r/24.7%
sub-neg24.7%
distribute-lft-in24.6%
metadata-eval24.6%
metadata-eval24.6%
metadata-eval24.6%
fma-define24.7%
metadata-eval24.7%
Simplified24.7%
Taylor expanded in n around inf 32.3%
sub-neg32.3%
metadata-eval32.3%
metadata-eval32.3%
distribute-lft-in32.3%
metadata-eval32.3%
sub-neg32.3%
expm1-define82.4%
Simplified82.4%
clear-num82.3%
inv-pow82.3%
*-un-lft-identity82.3%
times-frac82.4%
metadata-eval82.4%
Applied egg-rr82.4%
unpow-182.4%
associate-*r/82.4%
Simplified82.4%
Taylor expanded in i around 0 63.2%
*-commutative63.2%
Simplified63.2%
if -1.0599999999999999e-203 < n < 4.0999999999999997e-114Initial program 54.0%
associate-*r/54.0%
sub-neg54.0%
distribute-rgt-in54.0%
metadata-eval54.0%
metadata-eval54.0%
Simplified54.0%
Taylor expanded in i around 0 75.6%
if 4.0999999999999997e-114 < n Initial program 26.7%
Taylor expanded in n around inf 37.9%
*-commutative37.9%
associate-/l*37.9%
expm1-define89.4%
Simplified89.4%
Taylor expanded in i around 0 71.1%
+-commutative71.1%
associate-*r*71.1%
distribute-rgt-in71.1%
*-commutative71.1%
Simplified71.1%
Final simplification67.9%
(FPCore (i n) :precision binary64 (if (<= i -1e-10) (* 100.0 (/ i (/ i n))) (if (<= i 1500000000.0) (* n 100.0) (* i (- (* n 50.0) 50.0)))))
double code(double i, double n) {
double tmp;
if (i <= -1e-10) {
tmp = 100.0 * (i / (i / n));
} else if (i <= 1500000000.0) {
tmp = n * 100.0;
} else {
tmp = 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 (i <= (-1d-10)) then
tmp = 100.0d0 * (i / (i / n))
else if (i <= 1500000000.0d0) then
tmp = n * 100.0d0
else
tmp = i * ((n * 50.0d0) - 50.0d0)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= -1e-10) {
tmp = 100.0 * (i / (i / n));
} else if (i <= 1500000000.0) {
tmp = n * 100.0;
} else {
tmp = i * ((n * 50.0) - 50.0);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -1e-10: tmp = 100.0 * (i / (i / n)) elif i <= 1500000000.0: tmp = n * 100.0 else: tmp = i * ((n * 50.0) - 50.0) return tmp
function code(i, n) tmp = 0.0 if (i <= -1e-10) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (i <= 1500000000.0) tmp = Float64(n * 100.0); else tmp = Float64(i * Float64(Float64(n * 50.0) - 50.0)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -1e-10) tmp = 100.0 * (i / (i / n)); elseif (i <= 1500000000.0) tmp = n * 100.0; else tmp = i * ((n * 50.0) - 50.0); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -1e-10], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 1500000000.0], N[(n * 100.0), $MachinePrecision], N[(i * N[(N[(n * 50.0), $MachinePrecision] - 50.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -1 \cdot 10^{-10}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;i \leq 1500000000:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;i \cdot \left(n \cdot 50 - 50\right)\\
\end{array}
\end{array}
if i < -1.00000000000000004e-10Initial program 54.0%
Taylor expanded in i around 0 22.9%
if -1.00000000000000004e-10 < i < 1.5e9Initial program 10.6%
associate-/r/11.2%
associate-*r*11.2%
*-commutative11.2%
associate-*r/11.2%
sub-neg11.2%
distribute-lft-in11.2%
metadata-eval11.2%
metadata-eval11.2%
metadata-eval11.2%
fma-define11.2%
metadata-eval11.2%
Simplified11.2%
Taylor expanded in i around 0 83.6%
*-commutative83.6%
Simplified83.6%
if 1.5e9 < i Initial program 53.2%
associate-/r/53.3%
associate-*r*53.2%
*-commutative53.2%
associate-*r/53.3%
sub-neg53.3%
distribute-lft-in53.3%
metadata-eval53.3%
metadata-eval53.3%
metadata-eval53.3%
fma-define53.3%
metadata-eval53.3%
Simplified53.3%
Taylor expanded in i around 0 31.8%
*-commutative31.8%
associate-*r/31.8%
metadata-eval31.8%
Simplified31.8%
Taylor expanded in n around 0 31.8%
Taylor expanded in i around inf 31.8%
Final simplification58.7%
(FPCore (i n) :precision binary64 (if (<= i -1e-11) (* 100.0 (/ i (/ i n))) (if (<= i 3e-35) (* n 100.0) (* 100.0 (* i (/ n i))))))
double code(double i, double n) {
double tmp;
if (i <= -1e-11) {
tmp = 100.0 * (i / (i / n));
} else if (i <= 3e-35) {
tmp = n * 100.0;
} else {
tmp = 100.0 * (i * (n / i));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= (-1d-11)) then
tmp = 100.0d0 * (i / (i / n))
else if (i <= 3d-35) then
tmp = n * 100.0d0
else
tmp = 100.0d0 * (i * (n / i))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= -1e-11) {
tmp = 100.0 * (i / (i / n));
} else if (i <= 3e-35) {
tmp = n * 100.0;
} else {
tmp = 100.0 * (i * (n / i));
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -1e-11: tmp = 100.0 * (i / (i / n)) elif i <= 3e-35: tmp = n * 100.0 else: tmp = 100.0 * (i * (n / i)) return tmp
function code(i, n) tmp = 0.0 if (i <= -1e-11) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (i <= 3e-35) tmp = Float64(n * 100.0); else tmp = Float64(100.0 * Float64(i * Float64(n / i))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -1e-11) tmp = 100.0 * (i / (i / n)); elseif (i <= 3e-35) tmp = n * 100.0; else tmp = 100.0 * (i * (n / i)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -1e-11], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 3e-35], N[(n * 100.0), $MachinePrecision], N[(100.0 * N[(i * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -1 \cdot 10^{-11}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;i \leq 3 \cdot 10^{-35}:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(i \cdot \frac{n}{i}\right)\\
\end{array}
\end{array}
if i < -9.99999999999999939e-12Initial program 53.1%
Taylor expanded in i around 0 23.9%
if -9.99999999999999939e-12 < i < 2.99999999999999989e-35Initial program 9.4%
associate-/r/10.1%
associate-*r*10.1%
*-commutative10.1%
associate-*r/10.1%
sub-neg10.1%
distribute-lft-in10.1%
metadata-eval10.1%
metadata-eval10.1%
metadata-eval10.1%
fma-define10.1%
metadata-eval10.1%
Simplified10.1%
Taylor expanded in i around 0 86.1%
*-commutative86.1%
Simplified86.1%
if 2.99999999999999989e-35 < i Initial program 52.5%
Taylor expanded in i around 0 16.6%
clear-num16.6%
associate-/r/16.6%
clear-num16.6%
Applied egg-rr16.6%
Final simplification55.1%
(FPCore (i n) :precision binary64 (if (<= n 2.65e-17) (* n (/ 1.0 (+ 0.01 (* i -0.005)))) (* n (+ 100.0 (* i 50.0)))))
double code(double i, double n) {
double tmp;
if (n <= 2.65e-17) {
tmp = n * (1.0 / (0.01 + (i * -0.005)));
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= 2.65d-17) then
tmp = n * (1.0d0 / (0.01d0 + (i * (-0.005d0))))
else
tmp = n * (100.0d0 + (i * 50.0d0))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= 2.65e-17) {
tmp = n * (1.0 / (0.01 + (i * -0.005)));
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= 2.65e-17: tmp = n * (1.0 / (0.01 + (i * -0.005))) else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) tmp = 0.0 if (n <= 2.65e-17) tmp = Float64(n * Float64(1.0 / Float64(0.01 + Float64(i * -0.005)))); else tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= 2.65e-17) tmp = n * (1.0 / (0.01 + (i * -0.005))); else tmp = n * (100.0 + (i * 50.0)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, 2.65e-17], N[(n * N[(1.0 / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 2.65 \cdot 10^{-17}:\\
\;\;\;\;n \cdot \frac{1}{0.01 + i \cdot -0.005}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < 2.6499999999999999e-17Initial program 29.2%
associate-/r/29.2%
associate-*r*29.2%
*-commutative29.2%
associate-*r/29.2%
sub-neg29.2%
distribute-lft-in29.1%
metadata-eval29.1%
metadata-eval29.1%
metadata-eval29.1%
fma-define29.2%
metadata-eval29.2%
Simplified29.2%
Taylor expanded in n around inf 29.9%
sub-neg29.9%
metadata-eval29.9%
metadata-eval29.9%
distribute-lft-in29.9%
metadata-eval29.9%
sub-neg29.9%
expm1-define67.3%
Simplified67.3%
clear-num67.3%
inv-pow67.3%
*-un-lft-identity67.3%
times-frac67.3%
metadata-eval67.3%
Applied egg-rr67.3%
unpow-167.3%
associate-*r/67.3%
Simplified67.3%
Taylor expanded in i around 0 58.3%
*-commutative58.3%
Simplified58.3%
if 2.6499999999999999e-17 < n Initial program 30.9%
Taylor expanded in n around inf 44.6%
*-commutative44.6%
associate-/l*44.6%
expm1-define93.5%
Simplified93.5%
Taylor expanded in i around 0 71.6%
+-commutative71.6%
associate-*r*71.6%
distribute-rgt-in71.6%
*-commutative71.6%
Simplified71.6%
(FPCore (i n) :precision binary64 (* n 100.0))
double code(double i, double n) {
return n * 100.0;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = n * 100.0d0
end function
public static double code(double i, double n) {
return n * 100.0;
}
def code(i, n): return n * 100.0
function code(i, n) return Float64(n * 100.0) end
function tmp = code(i, n) tmp = n * 100.0; end
code[i_, n_] := N[(n * 100.0), $MachinePrecision]
\begin{array}{l}
\\
n \cdot 100
\end{array}
Initial program 29.7%
associate-/r/29.9%
associate-*r*29.9%
*-commutative29.9%
associate-*r/29.9%
sub-neg29.9%
distribute-lft-in29.8%
metadata-eval29.8%
metadata-eval29.8%
metadata-eval29.8%
fma-define29.9%
metadata-eval29.9%
Simplified29.9%
Taylor expanded in i around 0 48.8%
*-commutative48.8%
Simplified48.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 29.7%
associate-/r/29.9%
associate-*r*29.9%
*-commutative29.9%
associate-*r/29.9%
sub-neg29.9%
distribute-lft-in29.8%
metadata-eval29.8%
metadata-eval29.8%
metadata-eval29.8%
fma-define29.9%
metadata-eval29.9%
Simplified29.9%
Taylor expanded in i around 0 55.4%
*-commutative55.4%
associate-*r/55.4%
metadata-eval55.4%
Simplified55.4%
Taylor expanded in n around 0 2.6%
*-commutative2.6%
Simplified2.6%
(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 2024172
(FPCore (i n)
:name "Compound Interest"
:precision binary64
:alt
(! :herbie-platform default (let ((lnbase (if (== (+ 1 (/ i n)) 1) (/ i n) (/ (* (/ i n) (log (+ 1 (/ i n)))) (- (+ (/ i n) 1) 1))))) (* 100 (/ (- (exp (* n lnbase)) 1) (/ i n)))))
(* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))