
(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 14 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 (* 100.0 (/ n (/ i (expm1 i))))))
(if (<= n -4e-128)
t_0
(if (<= n -5e-310)
(/ (* 100.0 (* n (- (log (- i)) (log (- n))))) (/ i n))
(if (<= n 1.8e-41)
(* n (* 100.0 (/ n (/ i (- (log i) (log n))))))
t_0)))))
double code(double i, double n) {
double t_0 = 100.0 * (n / (i / expm1(i)));
double tmp;
if (n <= -4e-128) {
tmp = t_0;
} else if (n <= -5e-310) {
tmp = (100.0 * (n * (log(-i) - log(-n)))) / (i / n);
} else if (n <= 1.8e-41) {
tmp = n * (100.0 * (n / (i / (log(i) - log(n)))));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = 100.0 * (n / (i / Math.expm1(i)));
double tmp;
if (n <= -4e-128) {
tmp = t_0;
} else if (n <= -5e-310) {
tmp = (100.0 * (n * (Math.log(-i) - Math.log(-n)))) / (i / n);
} else if (n <= 1.8e-41) {
tmp = n * (100.0 * (n / (i / (Math.log(i) - Math.log(n)))));
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (n / (i / math.expm1(i))) tmp = 0 if n <= -4e-128: tmp = t_0 elif n <= -5e-310: tmp = (100.0 * (n * (math.log(-i) - math.log(-n)))) / (i / n) elif n <= 1.8e-41: tmp = n * (100.0 * (n / (i / (math.log(i) - math.log(n))))) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(n / Float64(i / expm1(i)))) tmp = 0.0 if (n <= -4e-128) tmp = t_0; elseif (n <= -5e-310) tmp = Float64(Float64(100.0 * Float64(n * Float64(log(Float64(-i)) - log(Float64(-n))))) / Float64(i / n)); elseif (n <= 1.8e-41) tmp = Float64(n * Float64(100.0 * Float64(n / Float64(i / Float64(log(i) - log(n)))))); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(n / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -4e-128], t$95$0, If[LessEqual[n, -5e-310], N[(N[(100.0 * N[(n * N[(N[Log[(-i)], $MachinePrecision] - N[Log[(-n)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.8e-41], N[(n * N[(100.0 * N[(n / N[(i / N[(N[Log[i], $MachinePrecision] - N[Log[n], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\
\mathbf{if}\;n \leq -4 \cdot 10^{-128}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{100 \cdot \left(n \cdot \left(\log \left(-i\right) - \log \left(-n\right)\right)\right)}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 1.8 \cdot 10^{-41}:\\
\;\;\;\;n \cdot \left(100 \cdot \frac{n}{\frac{i}{\log i - \log n}}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if n < -4.00000000000000022e-128 or 1.8e-41 < n Initial program 25.0%
associate-/r/25.3%
sub-neg25.3%
metadata-eval25.3%
Simplified25.3%
Taylor expanded in n around inf 40.3%
associate-/l*40.3%
expm1-def92.4%
Simplified92.4%
if -4.00000000000000022e-128 < n < -4.999999999999985e-310Initial program 76.3%
associate-*r/76.3%
sub-neg76.3%
distribute-lft-in76.3%
metadata-eval76.3%
metadata-eval76.3%
metadata-eval76.3%
fma-def76.3%
metadata-eval76.3%
Simplified76.3%
fma-udef76.3%
*-commutative76.3%
Applied egg-rr76.3%
Taylor expanded in n around 0 0.0%
neg-mul-10.0%
sub-neg0.0%
log-div47.3%
Simplified47.3%
frac-2neg47.3%
log-div84.3%
Applied egg-rr84.3%
if -4.999999999999985e-310 < n < 1.8e-41Initial program 25.0%
associate-/r/25.4%
associate-*r*25.4%
*-commutative25.4%
associate-*r/25.4%
sub-neg25.4%
distribute-lft-in25.4%
metadata-eval25.4%
metadata-eval25.4%
metadata-eval25.4%
fma-def25.4%
metadata-eval25.4%
Simplified25.4%
Taylor expanded in n around 0 79.5%
associate-/l*79.6%
mul-1-neg79.6%
unsub-neg79.6%
Simplified79.6%
Final simplification89.9%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (/ n (/ i (expm1 i))))))
(if (<= n -9.5e-200)
t_0
(if (<= n 4e-281)
0.0
(if (<= n 4.2e-42)
(* 100.0 (* n (/ n (/ i (- (log i) (log n))))))
t_0)))))
double code(double i, double n) {
double t_0 = 100.0 * (n / (i / expm1(i)));
double tmp;
if (n <= -9.5e-200) {
tmp = t_0;
} else if (n <= 4e-281) {
tmp = 0.0;
} else if (n <= 4.2e-42) {
tmp = 100.0 * (n * (n / (i / (log(i) - log(n)))));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = 100.0 * (n / (i / Math.expm1(i)));
double tmp;
if (n <= -9.5e-200) {
tmp = t_0;
} else if (n <= 4e-281) {
tmp = 0.0;
} else if (n <= 4.2e-42) {
tmp = 100.0 * (n * (n / (i / (Math.log(i) - Math.log(n)))));
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (n / (i / math.expm1(i))) tmp = 0 if n <= -9.5e-200: tmp = t_0 elif n <= 4e-281: tmp = 0.0 elif n <= 4.2e-42: tmp = 100.0 * (n * (n / (i / (math.log(i) - math.log(n))))) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(n / Float64(i / expm1(i)))) tmp = 0.0 if (n <= -9.5e-200) tmp = t_0; elseif (n <= 4e-281) tmp = 0.0; elseif (n <= 4.2e-42) tmp = Float64(100.0 * Float64(n * Float64(n / Float64(i / Float64(log(i) - log(n)))))); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(n / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -9.5e-200], t$95$0, If[LessEqual[n, 4e-281], 0.0, If[LessEqual[n, 4.2e-42], N[(100.0 * N[(n * N[(n / N[(i / N[(N[Log[i], $MachinePrecision] - N[Log[n], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\
\mathbf{if}\;n \leq -9.5 \cdot 10^{-200}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 4 \cdot 10^{-281}:\\
\;\;\;\;0\\
\mathbf{elif}\;n \leq 4.2 \cdot 10^{-42}:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{n}{\frac{i}{\log i - \log n}}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if n < -9.4999999999999995e-200 or 4.20000000000000013e-42 < n Initial program 25.5%
associate-/r/25.9%
sub-neg25.9%
metadata-eval25.9%
Simplified25.9%
Taylor expanded in n around inf 40.6%
associate-/l*40.6%
expm1-def91.9%
Simplified91.9%
if -9.4999999999999995e-200 < n < 4.0000000000000001e-281Initial program 68.9%
associate-*r/68.9%
sub-neg68.9%
distribute-lft-in68.9%
metadata-eval68.9%
metadata-eval68.9%
metadata-eval68.9%
fma-def68.9%
metadata-eval68.9%
Simplified68.9%
fma-udef68.9%
*-commutative68.9%
Applied egg-rr68.9%
Taylor expanded in i around 0 83.1%
Taylor expanded in i around 0 83.1%
if 4.0000000000000001e-281 < n < 4.20000000000000013e-42Initial program 23.2%
associate-/r/23.6%
sub-neg23.6%
metadata-eval23.6%
Simplified23.6%
Taylor expanded in n around 0 78.3%
associate-/l*78.4%
mul-1-neg78.4%
unsub-neg78.4%
Simplified78.4%
Final simplification89.4%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (/ n (/ i (expm1 i))))))
(if (<= n -4.3e-129)
t_0
(if (<= n -5e-310)
(* 100.0 (/ n (/ i (expm1 (* n (log (/ i n)))))))
(if (<= n 1.45e-39)
(* 100.0 (* n (/ n (/ i (- (log i) (log n))))))
t_0)))))
double code(double i, double n) {
double t_0 = 100.0 * (n / (i / expm1(i)));
double tmp;
if (n <= -4.3e-129) {
tmp = t_0;
} else if (n <= -5e-310) {
tmp = 100.0 * (n / (i / expm1((n * log((i / n))))));
} else if (n <= 1.45e-39) {
tmp = 100.0 * (n * (n / (i / (log(i) - log(n)))));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = 100.0 * (n / (i / Math.expm1(i)));
double tmp;
if (n <= -4.3e-129) {
tmp = t_0;
} else if (n <= -5e-310) {
tmp = 100.0 * (n / (i / Math.expm1((n * Math.log((i / n))))));
} else if (n <= 1.45e-39) {
tmp = 100.0 * (n * (n / (i / (Math.log(i) - Math.log(n)))));
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (n / (i / math.expm1(i))) tmp = 0 if n <= -4.3e-129: tmp = t_0 elif n <= -5e-310: tmp = 100.0 * (n / (i / math.expm1((n * math.log((i / n)))))) elif n <= 1.45e-39: tmp = 100.0 * (n * (n / (i / (math.log(i) - math.log(n))))) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(n / Float64(i / expm1(i)))) tmp = 0.0 if (n <= -4.3e-129) tmp = t_0; elseif (n <= -5e-310) tmp = Float64(100.0 * Float64(n / Float64(i / expm1(Float64(n * log(Float64(i / n))))))); elseif (n <= 1.45e-39) tmp = Float64(100.0 * Float64(n * Float64(n / Float64(i / Float64(log(i) - log(n)))))); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(n / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -4.3e-129], t$95$0, If[LessEqual[n, -5e-310], N[(100.0 * N[(n / N[(i / N[(Exp[N[(n * N[Log[N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.45e-39], N[(100.0 * N[(n * N[(n / N[(i / N[(N[Log[i], $MachinePrecision] - N[Log[n], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\
\mathbf{if}\;n \leq -4.3 \cdot 10^{-129}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq -5 \cdot 10^{-310}:\\
\;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(n \cdot \log \left(\frac{i}{n}\right)\right)}}\\
\mathbf{elif}\;n \leq 1.45 \cdot 10^{-39}:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{n}{\frac{i}{\log i - \log n}}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if n < -4.29999999999999981e-129 or 1.44999999999999994e-39 < n Initial program 25.0%
associate-/r/25.3%
sub-neg25.3%
metadata-eval25.3%
Simplified25.3%
Taylor expanded in n around inf 40.3%
associate-/l*40.3%
expm1-def92.4%
Simplified92.4%
if -4.29999999999999981e-129 < n < -4.999999999999985e-310Initial program 76.3%
*-commutative76.3%
associate-/r/76.3%
associate-*l*76.3%
sub-neg76.3%
metadata-eval76.3%
Simplified76.3%
Taylor expanded in i around inf 0.0%
expm1-def0.0%
log-rec0.0%
mul-1-neg0.0%
distribute-rgt-in0.0%
mul-1-neg0.0%
log-rec0.0%
remove-double-neg0.0%
distribute-rgt-in0.0%
+-commutative0.0%
mul-1-neg0.0%
unsub-neg0.0%
Simplified0.0%
Taylor expanded in n around inf 0.0%
associate-/l*0.0%
expm1-def0.0%
log-div84.2%
Simplified84.2%
if -4.999999999999985e-310 < n < 1.44999999999999994e-39Initial program 25.0%
associate-/r/25.4%
sub-neg25.4%
metadata-eval25.4%
Simplified25.4%
Taylor expanded in n around 0 79.1%
associate-/l*79.1%
mul-1-neg79.1%
unsub-neg79.1%
Simplified79.1%
Final simplification89.8%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (/ n (/ i (expm1 i))))))
(if (<= n -7e-128)
t_0
(if (<= n -5e-310)
(* 100.0 (/ n (/ i (expm1 (* n (log (/ i n)))))))
(if (<= n 4.2e-42)
(* n (* 100.0 (/ n (/ i (- (log i) (log n))))))
t_0)))))
double code(double i, double n) {
double t_0 = 100.0 * (n / (i / expm1(i)));
double tmp;
if (n <= -7e-128) {
tmp = t_0;
} else if (n <= -5e-310) {
tmp = 100.0 * (n / (i / expm1((n * log((i / n))))));
} else if (n <= 4.2e-42) {
tmp = n * (100.0 * (n / (i / (log(i) - log(n)))));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = 100.0 * (n / (i / Math.expm1(i)));
double tmp;
if (n <= -7e-128) {
tmp = t_0;
} else if (n <= -5e-310) {
tmp = 100.0 * (n / (i / Math.expm1((n * Math.log((i / n))))));
} else if (n <= 4.2e-42) {
tmp = n * (100.0 * (n / (i / (Math.log(i) - Math.log(n)))));
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (n / (i / math.expm1(i))) tmp = 0 if n <= -7e-128: tmp = t_0 elif n <= -5e-310: tmp = 100.0 * (n / (i / math.expm1((n * math.log((i / n)))))) elif n <= 4.2e-42: tmp = n * (100.0 * (n / (i / (math.log(i) - math.log(n))))) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(n / Float64(i / expm1(i)))) tmp = 0.0 if (n <= -7e-128) tmp = t_0; elseif (n <= -5e-310) tmp = Float64(100.0 * Float64(n / Float64(i / expm1(Float64(n * log(Float64(i / n))))))); elseif (n <= 4.2e-42) tmp = Float64(n * Float64(100.0 * Float64(n / Float64(i / Float64(log(i) - log(n)))))); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(n / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -7e-128], t$95$0, If[LessEqual[n, -5e-310], N[(100.0 * N[(n / N[(i / N[(Exp[N[(n * N[Log[N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 4.2e-42], N[(n * N[(100.0 * N[(n / N[(i / N[(N[Log[i], $MachinePrecision] - N[Log[n], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\
\mathbf{if}\;n \leq -7 \cdot 10^{-128}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq -5 \cdot 10^{-310}:\\
\;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(n \cdot \log \left(\frac{i}{n}\right)\right)}}\\
\mathbf{elif}\;n \leq 4.2 \cdot 10^{-42}:\\
\;\;\;\;n \cdot \left(100 \cdot \frac{n}{\frac{i}{\log i - \log n}}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if n < -6.99999999999999999e-128 or 4.20000000000000013e-42 < n Initial program 25.0%
associate-/r/25.3%
sub-neg25.3%
metadata-eval25.3%
Simplified25.3%
Taylor expanded in n around inf 40.3%
associate-/l*40.3%
expm1-def92.4%
Simplified92.4%
if -6.99999999999999999e-128 < n < -4.999999999999985e-310Initial program 76.3%
*-commutative76.3%
associate-/r/76.3%
associate-*l*76.3%
sub-neg76.3%
metadata-eval76.3%
Simplified76.3%
Taylor expanded in i around inf 0.0%
expm1-def0.0%
log-rec0.0%
mul-1-neg0.0%
distribute-rgt-in0.0%
mul-1-neg0.0%
log-rec0.0%
remove-double-neg0.0%
distribute-rgt-in0.0%
+-commutative0.0%
mul-1-neg0.0%
unsub-neg0.0%
Simplified0.0%
Taylor expanded in n around inf 0.0%
associate-/l*0.0%
expm1-def0.0%
log-div84.2%
Simplified84.2%
if -4.999999999999985e-310 < n < 4.20000000000000013e-42Initial program 25.0%
associate-/r/25.4%
associate-*r*25.4%
*-commutative25.4%
associate-*r/25.4%
sub-neg25.4%
distribute-lft-in25.4%
metadata-eval25.4%
metadata-eval25.4%
metadata-eval25.4%
fma-def25.4%
metadata-eval25.4%
Simplified25.4%
Taylor expanded in n around 0 79.5%
associate-/l*79.6%
mul-1-neg79.6%
unsub-neg79.6%
Simplified79.6%
Final simplification89.9%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (/ n (/ i (expm1 i))))))
(if (<= n -2.5e-205)
t_0
(if (<= n 1.96e-230)
0.0
(if (<= n 2.6e-110)
(* 100.0 (/ n (+ 1.0 (* i -0.5))))
(if (<= n 1.8e-41) (* (/ n i) (* n (* 100.0 (log (/ i n))))) t_0))))))
double code(double i, double n) {
double t_0 = 100.0 * (n / (i / expm1(i)));
double tmp;
if (n <= -2.5e-205) {
tmp = t_0;
} else if (n <= 1.96e-230) {
tmp = 0.0;
} else if (n <= 2.6e-110) {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
} else if (n <= 1.8e-41) {
tmp = (n / i) * (n * (100.0 * log((i / n))));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = 100.0 * (n / (i / Math.expm1(i)));
double tmp;
if (n <= -2.5e-205) {
tmp = t_0;
} else if (n <= 1.96e-230) {
tmp = 0.0;
} else if (n <= 2.6e-110) {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
} else if (n <= 1.8e-41) {
tmp = (n / i) * (n * (100.0 * Math.log((i / n))));
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (n / (i / math.expm1(i))) tmp = 0 if n <= -2.5e-205: tmp = t_0 elif n <= 1.96e-230: tmp = 0.0 elif n <= 2.6e-110: tmp = 100.0 * (n / (1.0 + (i * -0.5))) elif n <= 1.8e-41: tmp = (n / i) * (n * (100.0 * math.log((i / n)))) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(n / Float64(i / expm1(i)))) tmp = 0.0 if (n <= -2.5e-205) tmp = t_0; elseif (n <= 1.96e-230) tmp = 0.0; elseif (n <= 2.6e-110) tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * -0.5)))); elseif (n <= 1.8e-41) tmp = Float64(Float64(n / i) * Float64(n * Float64(100.0 * log(Float64(i / n))))); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(n / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -2.5e-205], t$95$0, If[LessEqual[n, 1.96e-230], 0.0, If[LessEqual[n, 2.6e-110], N[(100.0 * N[(n / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.8e-41], N[(N[(n / i), $MachinePrecision] * N[(n * N[(100.0 * N[Log[N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\
\mathbf{if}\;n \leq -2.5 \cdot 10^{-205}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 1.96 \cdot 10^{-230}:\\
\;\;\;\;0\\
\mathbf{elif}\;n \leq 2.6 \cdot 10^{-110}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\
\mathbf{elif}\;n \leq 1.8 \cdot 10^{-41}:\\
\;\;\;\;\frac{n}{i} \cdot \left(n \cdot \left(100 \cdot \log \left(\frac{i}{n}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if n < -2.5e-205 or 1.8e-41 < n Initial program 25.5%
associate-/r/25.9%
sub-neg25.9%
metadata-eval25.9%
Simplified25.9%
Taylor expanded in n around inf 40.6%
associate-/l*40.6%
expm1-def91.9%
Simplified91.9%
if -2.5e-205 < n < 1.96000000000000001e-230Initial program 57.7%
associate-*r/57.7%
sub-neg57.7%
distribute-lft-in57.7%
metadata-eval57.7%
metadata-eval57.7%
metadata-eval57.7%
fma-def57.7%
metadata-eval57.7%
Simplified57.7%
fma-udef57.7%
*-commutative57.7%
Applied egg-rr57.7%
Taylor expanded in i around 0 81.0%
Taylor expanded in i around 0 81.0%
if 1.96000000000000001e-230 < n < 2.5999999999999999e-110Initial program 3.7%
associate-/r/4.2%
sub-neg4.2%
metadata-eval4.2%
Simplified4.2%
Taylor expanded in n around inf 4.2%
associate-/l*4.2%
expm1-def38.1%
Simplified38.1%
Taylor expanded in i around 0 73.3%
if 2.5999999999999999e-110 < n < 1.8e-41Initial program 42.7%
associate-*r/42.7%
sub-neg42.7%
distribute-lft-in42.7%
metadata-eval42.7%
metadata-eval42.7%
metadata-eval42.7%
fma-def42.7%
metadata-eval42.7%
Simplified42.7%
fma-udef42.7%
*-commutative42.7%
Applied egg-rr42.7%
Taylor expanded in n around 0 89.9%
neg-mul-189.9%
sub-neg89.9%
log-div90.2%
Simplified90.2%
clear-num79.8%
associate-/r/90.0%
clear-num90.0%
associate-*r*89.9%
*-commutative89.9%
associate-*l*90.0%
Applied egg-rr90.0%
Final simplification89.5%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (/ n (/ i (expm1 i))))))
(if (<= n -1.45e-206)
t_0
(if (<= n 2.1e-230)
0.0
(if (<= n 2.6e-110)
(* 100.0 (/ n (+ 1.0 (* i -0.5))))
(if (<= n 4.2e-42) (/ (* 100.0 (* n (log (/ i n)))) (/ i n)) t_0))))))
double code(double i, double n) {
double t_0 = 100.0 * (n / (i / expm1(i)));
double tmp;
if (n <= -1.45e-206) {
tmp = t_0;
} else if (n <= 2.1e-230) {
tmp = 0.0;
} else if (n <= 2.6e-110) {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
} else if (n <= 4.2e-42) {
tmp = (100.0 * (n * log((i / n)))) / (i / n);
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = 100.0 * (n / (i / Math.expm1(i)));
double tmp;
if (n <= -1.45e-206) {
tmp = t_0;
} else if (n <= 2.1e-230) {
tmp = 0.0;
} else if (n <= 2.6e-110) {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
} else if (n <= 4.2e-42) {
tmp = (100.0 * (n * Math.log((i / n)))) / (i / n);
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (n / (i / math.expm1(i))) tmp = 0 if n <= -1.45e-206: tmp = t_0 elif n <= 2.1e-230: tmp = 0.0 elif n <= 2.6e-110: tmp = 100.0 * (n / (1.0 + (i * -0.5))) elif n <= 4.2e-42: tmp = (100.0 * (n * math.log((i / n)))) / (i / n) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(n / Float64(i / expm1(i)))) tmp = 0.0 if (n <= -1.45e-206) tmp = t_0; elseif (n <= 2.1e-230) tmp = 0.0; elseif (n <= 2.6e-110) tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * -0.5)))); elseif (n <= 4.2e-42) tmp = Float64(Float64(100.0 * Float64(n * log(Float64(i / n)))) / Float64(i / n)); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(n / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1.45e-206], t$95$0, If[LessEqual[n, 2.1e-230], 0.0, If[LessEqual[n, 2.6e-110], N[(100.0 * N[(n / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 4.2e-42], N[(N[(100.0 * N[(n * N[Log[N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\
\mathbf{if}\;n \leq -1.45 \cdot 10^{-206}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 2.1 \cdot 10^{-230}:\\
\;\;\;\;0\\
\mathbf{elif}\;n \leq 2.6 \cdot 10^{-110}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\
\mathbf{elif}\;n \leq 4.2 \cdot 10^{-42}:\\
\;\;\;\;\frac{100 \cdot \left(n \cdot \log \left(\frac{i}{n}\right)\right)}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if n < -1.4500000000000001e-206 or 4.20000000000000013e-42 < n Initial program 25.5%
associate-/r/25.9%
sub-neg25.9%
metadata-eval25.9%
Simplified25.9%
Taylor expanded in n around inf 40.6%
associate-/l*40.6%
expm1-def91.9%
Simplified91.9%
if -1.4500000000000001e-206 < n < 2.0999999999999998e-230Initial program 57.7%
associate-*r/57.7%
sub-neg57.7%
distribute-lft-in57.7%
metadata-eval57.7%
metadata-eval57.7%
metadata-eval57.7%
fma-def57.7%
metadata-eval57.7%
Simplified57.7%
fma-udef57.7%
*-commutative57.7%
Applied egg-rr57.7%
Taylor expanded in i around 0 81.0%
Taylor expanded in i around 0 81.0%
if 2.0999999999999998e-230 < n < 2.5999999999999999e-110Initial program 3.7%
associate-/r/4.2%
sub-neg4.2%
metadata-eval4.2%
Simplified4.2%
Taylor expanded in n around inf 4.2%
associate-/l*4.2%
expm1-def38.1%
Simplified38.1%
Taylor expanded in i around 0 73.3%
if 2.5999999999999999e-110 < n < 4.20000000000000013e-42Initial program 42.7%
associate-*r/42.7%
sub-neg42.7%
distribute-lft-in42.7%
metadata-eval42.7%
metadata-eval42.7%
metadata-eval42.7%
fma-def42.7%
metadata-eval42.7%
Simplified42.7%
fma-udef42.7%
*-commutative42.7%
Applied egg-rr42.7%
Taylor expanded in n around 0 89.9%
neg-mul-189.9%
sub-neg89.9%
log-div90.2%
Simplified90.2%
Final simplification89.5%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (/ n (/ i (expm1 i))))))
(if (<= n -1.15e-200)
t_0
(if (<= n 1.85e-230)
0.0
(if (<= n 2.1e-105)
(* 100.0 (/ n (+ 1.0 (* i -0.5))))
(if (<= n 4.2e-42) 0.0 t_0))))))
double code(double i, double n) {
double t_0 = 100.0 * (n / (i / expm1(i)));
double tmp;
if (n <= -1.15e-200) {
tmp = t_0;
} else if (n <= 1.85e-230) {
tmp = 0.0;
} else if (n <= 2.1e-105) {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
} else if (n <= 4.2e-42) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = 100.0 * (n / (i / Math.expm1(i)));
double tmp;
if (n <= -1.15e-200) {
tmp = t_0;
} else if (n <= 1.85e-230) {
tmp = 0.0;
} else if (n <= 2.1e-105) {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
} else if (n <= 4.2e-42) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (n / (i / math.expm1(i))) tmp = 0 if n <= -1.15e-200: tmp = t_0 elif n <= 1.85e-230: tmp = 0.0 elif n <= 2.1e-105: tmp = 100.0 * (n / (1.0 + (i * -0.5))) elif n <= 4.2e-42: tmp = 0.0 else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(n / Float64(i / expm1(i)))) tmp = 0.0 if (n <= -1.15e-200) tmp = t_0; elseif (n <= 1.85e-230) tmp = 0.0; elseif (n <= 2.1e-105) tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * -0.5)))); elseif (n <= 4.2e-42) tmp = 0.0; else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(n / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1.15e-200], t$95$0, If[LessEqual[n, 1.85e-230], 0.0, If[LessEqual[n, 2.1e-105], N[(100.0 * N[(n / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 4.2e-42], 0.0, t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\
\mathbf{if}\;n \leq -1.15 \cdot 10^{-200}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 1.85 \cdot 10^{-230}:\\
\;\;\;\;0\\
\mathbf{elif}\;n \leq 2.1 \cdot 10^{-105}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\
\mathbf{elif}\;n \leq 4.2 \cdot 10^{-42}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if n < -1.15000000000000004e-200 or 4.20000000000000013e-42 < n Initial program 25.5%
associate-/r/25.9%
sub-neg25.9%
metadata-eval25.9%
Simplified25.9%
Taylor expanded in n around inf 40.6%
associate-/l*40.6%
expm1-def91.9%
Simplified91.9%
if -1.15000000000000004e-200 < n < 1.84999999999999991e-230 or 2.1e-105 < n < 4.20000000000000013e-42Initial program 55.2%
associate-*r/55.2%
sub-neg55.2%
distribute-lft-in55.2%
metadata-eval55.2%
metadata-eval55.2%
metadata-eval55.2%
fma-def55.2%
metadata-eval55.2%
Simplified55.2%
fma-udef55.2%
*-commutative55.2%
Applied egg-rr55.2%
Taylor expanded in i around 0 73.2%
Taylor expanded in i around 0 73.2%
if 1.84999999999999991e-230 < n < 2.1e-105Initial program 3.7%
associate-/r/4.2%
sub-neg4.2%
metadata-eval4.2%
Simplified4.2%
Taylor expanded in n around inf 4.2%
associate-/l*4.2%
expm1-def36.2%
Simplified36.2%
Taylor expanded in i around 0 69.0%
Final simplification87.7%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (/ n (+ 1.0 (* i -0.5))))))
(if (<= n -4.3e-190)
t_0
(if (<= n 2.3e-230)
0.0
(if (<= n 2.1e-105)
t_0
(if (<= n 4.2e-42)
0.0
(+ (* i -50.0) (* n (+ 100.0 (* i 50.0))))))))))
double code(double i, double n) {
double t_0 = 100.0 * (n / (1.0 + (i * -0.5)));
double tmp;
if (n <= -4.3e-190) {
tmp = t_0;
} else if (n <= 2.3e-230) {
tmp = 0.0;
} else if (n <= 2.1e-105) {
tmp = t_0;
} else if (n <= 4.2e-42) {
tmp = 0.0;
} else {
tmp = (i * -50.0) + (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) :: t_0
real(8) :: tmp
t_0 = 100.0d0 * (n / (1.0d0 + (i * (-0.5d0))))
if (n <= (-4.3d-190)) then
tmp = t_0
else if (n <= 2.3d-230) then
tmp = 0.0d0
else if (n <= 2.1d-105) then
tmp = t_0
else if (n <= 4.2d-42) then
tmp = 0.0d0
else
tmp = (i * (-50.0d0)) + (n * (100.0d0 + (i * 50.0d0)))
end if
code = tmp
end function
public static double code(double i, double n) {
double t_0 = 100.0 * (n / (1.0 + (i * -0.5)));
double tmp;
if (n <= -4.3e-190) {
tmp = t_0;
} else if (n <= 2.3e-230) {
tmp = 0.0;
} else if (n <= 2.1e-105) {
tmp = t_0;
} else if (n <= 4.2e-42) {
tmp = 0.0;
} else {
tmp = (i * -50.0) + (n * (100.0 + (i * 50.0)));
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (n / (1.0 + (i * -0.5))) tmp = 0 if n <= -4.3e-190: tmp = t_0 elif n <= 2.3e-230: tmp = 0.0 elif n <= 2.1e-105: tmp = t_0 elif n <= 4.2e-42: tmp = 0.0 else: tmp = (i * -50.0) + (n * (100.0 + (i * 50.0))) return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * -0.5)))) tmp = 0.0 if (n <= -4.3e-190) tmp = t_0; elseif (n <= 2.3e-230) tmp = 0.0; elseif (n <= 2.1e-105) tmp = t_0; elseif (n <= 4.2e-42) tmp = 0.0; else tmp = Float64(Float64(i * -50.0) + Float64(n * Float64(100.0 + Float64(i * 50.0)))); end return tmp end
function tmp_2 = code(i, n) t_0 = 100.0 * (n / (1.0 + (i * -0.5))); tmp = 0.0; if (n <= -4.3e-190) tmp = t_0; elseif (n <= 2.3e-230) tmp = 0.0; elseif (n <= 2.1e-105) tmp = t_0; elseif (n <= 4.2e-42) tmp = 0.0; else tmp = (i * -50.0) + (n * (100.0 + (i * 50.0))); end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(n / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -4.3e-190], t$95$0, If[LessEqual[n, 2.3e-230], 0.0, If[LessEqual[n, 2.1e-105], t$95$0, If[LessEqual[n, 4.2e-42], 0.0, N[(N[(i * -50.0), $MachinePrecision] + N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \frac{n}{1 + i \cdot -0.5}\\
\mathbf{if}\;n \leq -4.3 \cdot 10^{-190}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 2.3 \cdot 10^{-230}:\\
\;\;\;\;0\\
\mathbf{elif}\;n \leq 2.1 \cdot 10^{-105}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 4.2 \cdot 10^{-42}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;i \cdot -50 + n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < -4.3e-190 or 2.2999999999999998e-230 < n < 2.1e-105Initial program 26.7%
associate-/r/27.0%
sub-neg27.0%
metadata-eval27.0%
Simplified27.0%
Taylor expanded in n around inf 38.2%
associate-/l*38.2%
expm1-def82.1%
Simplified82.1%
Taylor expanded in i around 0 58.0%
if -4.3e-190 < n < 2.2999999999999998e-230 or 2.1e-105 < n < 4.20000000000000013e-42Initial program 55.2%
associate-*r/55.2%
sub-neg55.2%
distribute-lft-in55.2%
metadata-eval55.2%
metadata-eval55.2%
metadata-eval55.2%
fma-def55.2%
metadata-eval55.2%
Simplified55.2%
fma-udef55.2%
*-commutative55.2%
Applied egg-rr55.2%
Taylor expanded in i around 0 73.2%
Taylor expanded in i around 0 73.2%
if 4.20000000000000013e-42 < n Initial program 20.3%
associate-/r/20.8%
associate-*r*20.8%
*-commutative20.8%
associate-*r/20.8%
sub-neg20.8%
distribute-lft-in20.7%
metadata-eval20.7%
metadata-eval20.7%
metadata-eval20.7%
fma-def20.8%
metadata-eval20.8%
Simplified20.8%
Taylor expanded in i around 0 73.0%
associate-*r/73.0%
metadata-eval73.0%
Simplified73.0%
Taylor expanded in n around 0 73.0%
Final simplification65.7%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* n (+ 100.0 (* i 50.0)))))
(if (<= n -5.2e-112)
t_0
(if (<= n 2.3e-230)
0.0
(if (<= n 2.1e-105)
(/ (* 100.0 i) (/ i n))
(if (<= n 4.2e-42) 0.0 t_0))))))
double code(double i, double n) {
double t_0 = n * (100.0 + (i * 50.0));
double tmp;
if (n <= -5.2e-112) {
tmp = t_0;
} else if (n <= 2.3e-230) {
tmp = 0.0;
} else if (n <= 2.1e-105) {
tmp = (100.0 * i) / (i / n);
} else if (n <= 4.2e-42) {
tmp = 0.0;
} 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))
if (n <= (-5.2d-112)) then
tmp = t_0
else if (n <= 2.3d-230) then
tmp = 0.0d0
else if (n <= 2.1d-105) then
tmp = (100.0d0 * i) / (i / n)
else if (n <= 4.2d-42) then
tmp = 0.0d0
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));
double tmp;
if (n <= -5.2e-112) {
tmp = t_0;
} else if (n <= 2.3e-230) {
tmp = 0.0;
} else if (n <= 2.1e-105) {
tmp = (100.0 * i) / (i / n);
} else if (n <= 4.2e-42) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = n * (100.0 + (i * 50.0)) tmp = 0 if n <= -5.2e-112: tmp = t_0 elif n <= 2.3e-230: tmp = 0.0 elif n <= 2.1e-105: tmp = (100.0 * i) / (i / n) elif n <= 4.2e-42: tmp = 0.0 else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(n * Float64(100.0 + Float64(i * 50.0))) tmp = 0.0 if (n <= -5.2e-112) tmp = t_0; elseif (n <= 2.3e-230) tmp = 0.0; elseif (n <= 2.1e-105) tmp = Float64(Float64(100.0 * i) / Float64(i / n)); elseif (n <= 4.2e-42) tmp = 0.0; else tmp = t_0; end return tmp end
function tmp_2 = code(i, n) t_0 = n * (100.0 + (i * 50.0)); tmp = 0.0; if (n <= -5.2e-112) tmp = t_0; elseif (n <= 2.3e-230) tmp = 0.0; elseif (n <= 2.1e-105) tmp = (100.0 * i) / (i / n); elseif (n <= 4.2e-42) tmp = 0.0; else tmp = t_0; end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -5.2e-112], t$95$0, If[LessEqual[n, 2.3e-230], 0.0, If[LessEqual[n, 2.1e-105], N[(N[(100.0 * i), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 4.2e-42], 0.0, t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{if}\;n \leq -5.2 \cdot 10^{-112}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 2.3 \cdot 10^{-230}:\\
\;\;\;\;0\\
\mathbf{elif}\;n \leq 2.1 \cdot 10^{-105}:\\
\;\;\;\;\frac{100 \cdot i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 4.2 \cdot 10^{-42}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if n < -5.19999999999999983e-112 or 4.20000000000000013e-42 < n Initial program 24.7%
associate-/r/25.1%
sub-neg25.1%
metadata-eval25.1%
Simplified25.1%
Taylor expanded in n around inf 40.2%
associate-/l*40.2%
expm1-def92.4%
Simplified92.4%
Taylor expanded in i around 0 62.7%
+-commutative62.7%
associate-*r*62.7%
distribute-rgt-in62.7%
*-commutative62.7%
Simplified62.7%
if -5.19999999999999983e-112 < n < 2.2999999999999998e-230 or 2.1e-105 < n < 4.20000000000000013e-42Initial program 54.9%
associate-*r/54.9%
sub-neg54.9%
distribute-lft-in54.9%
metadata-eval54.9%
metadata-eval54.9%
metadata-eval54.9%
fma-def54.9%
metadata-eval54.9%
Simplified54.9%
fma-udef54.9%
*-commutative54.9%
Applied egg-rr54.9%
Taylor expanded in i around 0 70.5%
Taylor expanded in i around 0 70.5%
if 2.2999999999999998e-230 < n < 2.1e-105Initial program 3.7%
associate-*r/3.7%
sub-neg3.7%
distribute-lft-in3.7%
metadata-eval3.7%
metadata-eval3.7%
metadata-eval3.7%
fma-def3.7%
metadata-eval3.7%
Simplified3.7%
Taylor expanded in i around 0 68.9%
*-commutative68.9%
Simplified68.9%
Final simplification64.4%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (/ n (+ 1.0 (* i -0.5))))))
(if (<= n -3e-209)
t_0
(if (<= n 1.96e-230)
0.0
(if (<= n 2.1e-105)
t_0
(if (<= n 4.2e-42) 0.0 (* n (+ 100.0 (* i 50.0)))))))))
double code(double i, double n) {
double t_0 = 100.0 * (n / (1.0 + (i * -0.5)));
double tmp;
if (n <= -3e-209) {
tmp = t_0;
} else if (n <= 1.96e-230) {
tmp = 0.0;
} else if (n <= 2.1e-105) {
tmp = t_0;
} else if (n <= 4.2e-42) {
tmp = 0.0;
} 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) :: t_0
real(8) :: tmp
t_0 = 100.0d0 * (n / (1.0d0 + (i * (-0.5d0))))
if (n <= (-3d-209)) then
tmp = t_0
else if (n <= 1.96d-230) then
tmp = 0.0d0
else if (n <= 2.1d-105) then
tmp = t_0
else if (n <= 4.2d-42) then
tmp = 0.0d0
else
tmp = n * (100.0d0 + (i * 50.0d0))
end if
code = tmp
end function
public static double code(double i, double n) {
double t_0 = 100.0 * (n / (1.0 + (i * -0.5)));
double tmp;
if (n <= -3e-209) {
tmp = t_0;
} else if (n <= 1.96e-230) {
tmp = 0.0;
} else if (n <= 2.1e-105) {
tmp = t_0;
} else if (n <= 4.2e-42) {
tmp = 0.0;
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (n / (1.0 + (i * -0.5))) tmp = 0 if n <= -3e-209: tmp = t_0 elif n <= 1.96e-230: tmp = 0.0 elif n <= 2.1e-105: tmp = t_0 elif n <= 4.2e-42: tmp = 0.0 else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * -0.5)))) tmp = 0.0 if (n <= -3e-209) tmp = t_0; elseif (n <= 1.96e-230) tmp = 0.0; elseif (n <= 2.1e-105) tmp = t_0; elseif (n <= 4.2e-42) tmp = 0.0; else tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); end return tmp end
function tmp_2 = code(i, n) t_0 = 100.0 * (n / (1.0 + (i * -0.5))); tmp = 0.0; if (n <= -3e-209) tmp = t_0; elseif (n <= 1.96e-230) tmp = 0.0; elseif (n <= 2.1e-105) tmp = t_0; elseif (n <= 4.2e-42) tmp = 0.0; else tmp = n * (100.0 + (i * 50.0)); end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(n / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -3e-209], t$95$0, If[LessEqual[n, 1.96e-230], 0.0, If[LessEqual[n, 2.1e-105], t$95$0, If[LessEqual[n, 4.2e-42], 0.0, N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \frac{n}{1 + i \cdot -0.5}\\
\mathbf{if}\;n \leq -3 \cdot 10^{-209}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 1.96 \cdot 10^{-230}:\\
\;\;\;\;0\\
\mathbf{elif}\;n \leq 2.1 \cdot 10^{-105}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 4.2 \cdot 10^{-42}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < -2.9999999999999999e-209 or 1.96000000000000001e-230 < n < 2.1e-105Initial program 26.7%
associate-/r/27.0%
sub-neg27.0%
metadata-eval27.0%
Simplified27.0%
Taylor expanded in n around inf 38.2%
associate-/l*38.2%
expm1-def82.1%
Simplified82.1%
Taylor expanded in i around 0 58.0%
if -2.9999999999999999e-209 < n < 1.96000000000000001e-230 or 2.1e-105 < n < 4.20000000000000013e-42Initial program 55.2%
associate-*r/55.2%
sub-neg55.2%
distribute-lft-in55.2%
metadata-eval55.2%
metadata-eval55.2%
metadata-eval55.2%
fma-def55.2%
metadata-eval55.2%
Simplified55.2%
fma-udef55.2%
*-commutative55.2%
Applied egg-rr55.2%
Taylor expanded in i around 0 73.2%
Taylor expanded in i around 0 73.2%
if 4.20000000000000013e-42 < n Initial program 20.3%
associate-/r/20.8%
sub-neg20.8%
metadata-eval20.8%
Simplified20.8%
Taylor expanded in n around inf 37.9%
associate-/l*37.9%
expm1-def96.3%
Simplified96.3%
Taylor expanded in i around 0 72.6%
+-commutative72.6%
associate-*r*72.6%
distribute-rgt-in72.6%
*-commutative72.6%
Simplified72.6%
Final simplification65.5%
(FPCore (i n) :precision binary64 (if (<= i -3.2e+74) 0.0 (if (<= i 2.0) (* n 100.0) (if (<= i 4.5e+110) (* 50.0 (* n i)) 0.0))))
double code(double i, double n) {
double tmp;
if (i <= -3.2e+74) {
tmp = 0.0;
} else if (i <= 2.0) {
tmp = n * 100.0;
} else if (i <= 4.5e+110) {
tmp = 50.0 * (n * i);
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= (-3.2d+74)) then
tmp = 0.0d0
else if (i <= 2.0d0) then
tmp = n * 100.0d0
else if (i <= 4.5d+110) then
tmp = 50.0d0 * (n * i)
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= -3.2e+74) {
tmp = 0.0;
} else if (i <= 2.0) {
tmp = n * 100.0;
} else if (i <= 4.5e+110) {
tmp = 50.0 * (n * i);
} else {
tmp = 0.0;
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -3.2e+74: tmp = 0.0 elif i <= 2.0: tmp = n * 100.0 elif i <= 4.5e+110: tmp = 50.0 * (n * i) else: tmp = 0.0 return tmp
function code(i, n) tmp = 0.0 if (i <= -3.2e+74) tmp = 0.0; elseif (i <= 2.0) tmp = Float64(n * 100.0); elseif (i <= 4.5e+110) tmp = Float64(50.0 * Float64(n * i)); else tmp = 0.0; end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -3.2e+74) tmp = 0.0; elseif (i <= 2.0) tmp = n * 100.0; elseif (i <= 4.5e+110) tmp = 50.0 * (n * i); else tmp = 0.0; end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -3.2e+74], 0.0, If[LessEqual[i, 2.0], N[(n * 100.0), $MachinePrecision], If[LessEqual[i, 4.5e+110], N[(50.0 * N[(n * i), $MachinePrecision]), $MachinePrecision], 0.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -3.2 \cdot 10^{+74}:\\
\;\;\;\;0\\
\mathbf{elif}\;i \leq 2:\\
\;\;\;\;n \cdot 100\\
\mathbf{elif}\;i \leq 4.5 \cdot 10^{+110}:\\
\;\;\;\;50 \cdot \left(n \cdot i\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if i < -3.19999999999999995e74 or 4.5000000000000003e110 < i Initial program 64.7%
associate-*r/64.7%
sub-neg64.7%
distribute-lft-in64.7%
metadata-eval64.7%
metadata-eval64.7%
metadata-eval64.7%
fma-def64.7%
metadata-eval64.7%
Simplified64.7%
fma-udef64.7%
*-commutative64.7%
Applied egg-rr64.7%
Taylor expanded in i around 0 35.5%
Taylor expanded in i around 0 35.5%
if -3.19999999999999995e74 < i < 2Initial program 10.8%
associate-/r/11.3%
sub-neg11.3%
metadata-eval11.3%
Simplified11.3%
Taylor expanded in i around 0 76.8%
*-commutative76.8%
Simplified76.8%
if 2 < i < 4.5000000000000003e110Initial program 32.1%
associate-/r/32.1%
associate-*r*32.1%
*-commutative32.1%
associate-*r/32.1%
sub-neg32.1%
distribute-lft-in32.1%
metadata-eval32.1%
metadata-eval32.1%
metadata-eval32.1%
fma-def32.1%
metadata-eval32.1%
Simplified32.1%
Taylor expanded in i around 0 27.6%
associate-*r/27.6%
metadata-eval27.6%
Simplified27.6%
Taylor expanded in n around 0 27.6%
Taylor expanded in i around inf 27.6%
Taylor expanded in n around inf 27.8%
Final simplification59.7%
(FPCore (i n) :precision binary64 (if (or (<= n -5.2e-112) (not (<= n 4.2e-42))) (* n (+ 100.0 (* i 50.0))) 0.0))
double code(double i, double n) {
double tmp;
if ((n <= -5.2e-112) || !(n <= 4.2e-42)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-5.2d-112)) .or. (.not. (n <= 4.2d-42))) then
tmp = n * (100.0d0 + (i * 50.0d0))
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -5.2e-112) || !(n <= 4.2e-42)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 0.0;
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -5.2e-112) or not (n <= 4.2e-42): tmp = n * (100.0 + (i * 50.0)) else: tmp = 0.0 return tmp
function code(i, n) tmp = 0.0 if ((n <= -5.2e-112) || !(n <= 4.2e-42)) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); else tmp = 0.0; end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -5.2e-112) || ~((n <= 4.2e-42))) tmp = n * (100.0 + (i * 50.0)); else tmp = 0.0; end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -5.2e-112], N[Not[LessEqual[n, 4.2e-42]], $MachinePrecision]], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -5.2 \cdot 10^{-112} \lor \neg \left(n \leq 4.2 \cdot 10^{-42}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if n < -5.19999999999999983e-112 or 4.20000000000000013e-42 < n Initial program 24.7%
associate-/r/25.1%
sub-neg25.1%
metadata-eval25.1%
Simplified25.1%
Taylor expanded in n around inf 40.2%
associate-/l*40.2%
expm1-def92.4%
Simplified92.4%
Taylor expanded in i around 0 62.7%
+-commutative62.7%
associate-*r*62.7%
distribute-rgt-in62.7%
*-commutative62.7%
Simplified62.7%
if -5.19999999999999983e-112 < n < 4.20000000000000013e-42Initial program 42.1%
associate-*r/42.1%
sub-neg42.1%
distribute-lft-in42.1%
metadata-eval42.1%
metadata-eval42.1%
metadata-eval42.1%
fma-def42.1%
metadata-eval42.1%
Simplified42.1%
fma-udef42.1%
*-commutative42.1%
Applied egg-rr42.1%
Taylor expanded in i around 0 62.1%
Taylor expanded in i around 0 62.1%
Final simplification62.5%
(FPCore (i n) :precision binary64 (if (or (<= n -6e-112) (not (<= n 4.2e-42))) (* n 100.0) 0.0))
double code(double i, double n) {
double tmp;
if ((n <= -6e-112) || !(n <= 4.2e-42)) {
tmp = n * 100.0;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-6d-112)) .or. (.not. (n <= 4.2d-42))) then
tmp = n * 100.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -6e-112) || !(n <= 4.2e-42)) {
tmp = n * 100.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -6e-112) or not (n <= 4.2e-42): tmp = n * 100.0 else: tmp = 0.0 return tmp
function code(i, n) tmp = 0.0 if ((n <= -6e-112) || !(n <= 4.2e-42)) tmp = Float64(n * 100.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -6e-112) || ~((n <= 4.2e-42))) tmp = n * 100.0; else tmp = 0.0; end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -6e-112], N[Not[LessEqual[n, 4.2e-42]], $MachinePrecision]], N[(n * 100.0), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -6 \cdot 10^{-112} \lor \neg \left(n \leq 4.2 \cdot 10^{-42}\right):\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if n < -6.0000000000000002e-112 or 4.20000000000000013e-42 < n Initial program 24.7%
associate-/r/25.1%
sub-neg25.1%
metadata-eval25.1%
Simplified25.1%
Taylor expanded in i around 0 56.9%
*-commutative56.9%
Simplified56.9%
if -6.0000000000000002e-112 < n < 4.20000000000000013e-42Initial program 42.1%
associate-*r/42.1%
sub-neg42.1%
distribute-lft-in42.1%
metadata-eval42.1%
metadata-eval42.1%
metadata-eval42.1%
fma-def42.1%
metadata-eval42.1%
Simplified42.1%
fma-udef42.1%
*-commutative42.1%
Applied egg-rr42.1%
Taylor expanded in i around 0 62.1%
Taylor expanded in i around 0 62.1%
Final simplification58.1%
(FPCore (i n) :precision binary64 0.0)
double code(double i, double n) {
return 0.0;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 0.0d0
end function
public static double code(double i, double n) {
return 0.0;
}
def code(i, n): return 0.0
function code(i, n) return 0.0 end
function tmp = code(i, n) tmp = 0.0; end
code[i_, n_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 28.8%
associate-*r/28.8%
sub-neg28.8%
distribute-lft-in28.7%
metadata-eval28.7%
metadata-eval28.7%
metadata-eval28.7%
fma-def28.8%
metadata-eval28.8%
Simplified28.8%
fma-udef28.7%
*-commutative28.7%
Applied egg-rr28.7%
Taylor expanded in i around 0 16.6%
Taylor expanded in i around 0 16.9%
Final simplification16.9%
(FPCore (i n)
:precision binary64
(let* ((t_0 (+ 1.0 (/ i n))))
(*
100.0
(/
(-
(exp
(*
n
(if (== t_0 1.0)
(/ i n)
(/ (* (/ i n) (log t_0)) (- (+ (/ i n) 1.0) 1.0)))))
1.0)
(/ i n)))))
double code(double i, double n) {
double t_0 = 1.0 + (i / n);
double tmp;
if (t_0 == 1.0) {
tmp = i / n;
} else {
tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0) - 1.0);
}
return 100.0 * ((exp((n * tmp)) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + (i / n)
if (t_0 == 1.0d0) then
tmp = i / n
else
tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0d0) - 1.0d0)
end if
code = 100.0d0 * ((exp((n * tmp)) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
double t_0 = 1.0 + (i / n);
double tmp;
if (t_0 == 1.0) {
tmp = i / n;
} else {
tmp = ((i / n) * Math.log(t_0)) / (((i / n) + 1.0) - 1.0);
}
return 100.0 * ((Math.exp((n * tmp)) - 1.0) / (i / n));
}
def code(i, n): t_0 = 1.0 + (i / n) tmp = 0 if t_0 == 1.0: tmp = i / n else: tmp = ((i / n) * math.log(t_0)) / (((i / n) + 1.0) - 1.0) return 100.0 * ((math.exp((n * tmp)) - 1.0) / (i / n))
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) tmp = 0.0 if (t_0 == 1.0) tmp = Float64(i / n); else tmp = Float64(Float64(Float64(i / n) * log(t_0)) / Float64(Float64(Float64(i / n) + 1.0) - 1.0)); end return Float64(100.0 * Float64(Float64(exp(Float64(n * tmp)) - 1.0) / Float64(i / n))) end
function tmp_2 = code(i, n) t_0 = 1.0 + (i / n); tmp = 0.0; if (t_0 == 1.0) tmp = i / n; else tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0) - 1.0); end tmp_2 = 100.0 * ((exp((n * tmp)) - 1.0) / (i / n)); end
code[i_, n_] := Block[{t$95$0 = N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision]}, N[(100.0 * N[(N[(N[Exp[N[(n * If[Equal[t$95$0, 1.0], N[(i / n), $MachinePrecision], N[(N[(N[(i / n), $MachinePrecision] * N[Log[t$95$0], $MachinePrecision]), $MachinePrecision] / N[(N[(N[(i / n), $MachinePrecision] + 1.0), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{i}{n}\\
100 \cdot \frac{e^{n \cdot \begin{array}{l}
\mathbf{if}\;t_0 = 1:\\
\;\;\;\;\frac{i}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{i}{n} \cdot \log t_0}{\left(\frac{i}{n} + 1\right) - 1}\\
\end{array}} - 1}{\frac{i}{n}}
\end{array}
\end{array}
herbie shell --seed 2024023
(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))))