
(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 20 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 -5e-164)
(* t_0 100.0)
(if (<= t_0 0.0)
(/ 100.0 (/ (/ i n) (expm1 (* n (log1p (/ i n))))))
(if (<= t_0 INFINITY)
(/ (* n (- (* 100.0 (pow (/ i n) n)) 100.0)) i)
(/
100.0
(+
(/ 1.0 n)
(* i (+ (* 0.5 (/ 1.0 (pow n 2.0))) (* 0.5 (/ -1.0 n)))))))))))
double code(double i, double n) {
double t_0 = (pow((1.0 + (i / n)), n) + -1.0) / (i / n);
double tmp;
if (t_0 <= -5e-164) {
tmp = t_0 * 100.0;
} else if (t_0 <= 0.0) {
tmp = 100.0 / ((i / n) / expm1((n * log1p((i / n)))));
} else if (t_0 <= ((double) INFINITY)) {
tmp = (n * ((100.0 * pow((i / n), n)) - 100.0)) / i;
} else {
tmp = 100.0 / ((1.0 / n) + (i * ((0.5 * (1.0 / pow(n, 2.0))) + (0.5 * (-1.0 / n)))));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = (Math.pow((1.0 + (i / n)), n) + -1.0) / (i / n);
double tmp;
if (t_0 <= -5e-164) {
tmp = t_0 * 100.0;
} else if (t_0 <= 0.0) {
tmp = 100.0 / ((i / n) / Math.expm1((n * Math.log1p((i / n)))));
} else if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = (n * ((100.0 * Math.pow((i / n), n)) - 100.0)) / i;
} else {
tmp = 100.0 / ((1.0 / n) + (i * ((0.5 * (1.0 / Math.pow(n, 2.0))) + (0.5 * (-1.0 / n)))));
}
return tmp;
}
def code(i, n): t_0 = (math.pow((1.0 + (i / n)), n) + -1.0) / (i / n) tmp = 0 if t_0 <= -5e-164: tmp = t_0 * 100.0 elif t_0 <= 0.0: tmp = 100.0 / ((i / n) / math.expm1((n * math.log1p((i / n))))) elif t_0 <= math.inf: tmp = (n * ((100.0 * math.pow((i / n), n)) - 100.0)) / i else: tmp = 100.0 / ((1.0 / n) + (i * ((0.5 * (1.0 / math.pow(n, 2.0))) + (0.5 * (-1.0 / n))))) 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 <= -5e-164) tmp = Float64(t_0 * 100.0); elseif (t_0 <= 0.0) tmp = Float64(100.0 / Float64(Float64(i / n) / expm1(Float64(n * log1p(Float64(i / n)))))); elseif (t_0 <= Inf) tmp = Float64(Float64(n * Float64(Float64(100.0 * (Float64(i / n) ^ n)) - 100.0)) / i); else tmp = Float64(100.0 / Float64(Float64(1.0 / n) + Float64(i * Float64(Float64(0.5 * Float64(1.0 / (n ^ 2.0))) + Float64(0.5 * Float64(-1.0 / n)))))); 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, -5e-164], N[(t$95$0 * 100.0), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(100.0 / N[(N[(i / n), $MachinePrecision] / N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(N[(n * N[(N[(100.0 * N[Power[N[(i / n), $MachinePrecision], n], $MachinePrecision]), $MachinePrecision] - 100.0), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision], N[(100.0 / N[(N[(1.0 / n), $MachinePrecision] + N[(i * N[(N[(0.5 * N[(1.0 / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(-1.0 / n), $MachinePrecision]), $MachinePrecision]), $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 -5 \cdot 10^{-164}:\\
\;\;\;\;t\_0 \cdot 100\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{100}{\frac{\frac{i}{n}}{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}}\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\frac{n \cdot \left(100 \cdot {\left(\frac{i}{n}\right)}^{n} - 100\right)}{i}\\
\mathbf{else}:\\
\;\;\;\;\frac{100}{\frac{1}{n} + i \cdot \left(0.5 \cdot \frac{1}{{n}^{2}} + 0.5 \cdot \frac{-1}{n}\right)}\\
\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)) < -4.99999999999999962e-164Initial program 100.0%
if -4.99999999999999962e-164 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 0.0Initial program 21.8%
associate-/r/21.6%
associate-*r*21.6%
*-commutative21.6%
associate-*r/21.6%
sub-neg21.6%
distribute-lft-in21.6%
metadata-eval21.6%
metadata-eval21.6%
metadata-eval21.6%
fma-define21.6%
metadata-eval21.6%
Simplified21.6%
*-commutative21.6%
fma-undefine21.6%
*-commutative21.6%
associate-/r/21.8%
metadata-eval21.8%
metadata-eval21.8%
distribute-rgt-in21.8%
sub-neg21.8%
associate-*r/21.8%
clear-num21.8%
un-div-inv21.8%
add-exp-log21.8%
expm1-define21.8%
log-pow37.4%
log1p-define99.5%
Applied egg-rr99.5%
if 0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 99.6%
associate-*r/99.8%
sub-neg99.8%
distribute-rgt-in99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in i around inf 99.8%
Taylor expanded in n around inf 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%
*-commutative1.9%
fma-undefine1.9%
*-commutative1.9%
associate-/r/0.0%
metadata-eval0.0%
metadata-eval0.0%
distribute-rgt-in0.0%
sub-neg0.0%
associate-*r/0.0%
clear-num0.0%
un-div-inv0.0%
add-exp-log0.0%
expm1-define0.0%
log-pow0.0%
log1p-define0.0%
Applied egg-rr0.0%
Taylor expanded in i around 0 99.7%
Final simplification99.6%
(FPCore (i n)
:precision binary64
(let* ((t_0 (/ (+ (pow (+ 1.0 (/ i n)) n) -1.0) (/ i n))))
(if (<= t_0 -1e-175)
(* t_0 100.0)
(if (<= t_0 0.0)
(* n (/ (* 100.0 (expm1 (* n (log1p (/ i n))))) i))
(if (<= t_0 INFINITY)
(/ (* n (- (* 100.0 (pow (/ i n) n)) 100.0)) i)
(/
100.0
(+
(/ 1.0 n)
(* i (+ (* 0.5 (/ 1.0 (pow n 2.0))) (* 0.5 (/ -1.0 n)))))))))))
double code(double i, double n) {
double t_0 = (pow((1.0 + (i / n)), n) + -1.0) / (i / n);
double tmp;
if (t_0 <= -1e-175) {
tmp = t_0 * 100.0;
} else if (t_0 <= 0.0) {
tmp = n * ((100.0 * expm1((n * log1p((i / n))))) / i);
} else if (t_0 <= ((double) INFINITY)) {
tmp = (n * ((100.0 * pow((i / n), n)) - 100.0)) / i;
} else {
tmp = 100.0 / ((1.0 / n) + (i * ((0.5 * (1.0 / pow(n, 2.0))) + (0.5 * (-1.0 / n)))));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = (Math.pow((1.0 + (i / n)), n) + -1.0) / (i / n);
double tmp;
if (t_0 <= -1e-175) {
tmp = t_0 * 100.0;
} else if (t_0 <= 0.0) {
tmp = n * ((100.0 * Math.expm1((n * Math.log1p((i / n))))) / i);
} else if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = (n * ((100.0 * Math.pow((i / n), n)) - 100.0)) / i;
} else {
tmp = 100.0 / ((1.0 / n) + (i * ((0.5 * (1.0 / Math.pow(n, 2.0))) + (0.5 * (-1.0 / n)))));
}
return tmp;
}
def code(i, n): t_0 = (math.pow((1.0 + (i / n)), n) + -1.0) / (i / n) tmp = 0 if t_0 <= -1e-175: tmp = t_0 * 100.0 elif t_0 <= 0.0: tmp = n * ((100.0 * math.expm1((n * math.log1p((i / n))))) / i) elif t_0 <= math.inf: tmp = (n * ((100.0 * math.pow((i / n), n)) - 100.0)) / i else: tmp = 100.0 / ((1.0 / n) + (i * ((0.5 * (1.0 / math.pow(n, 2.0))) + (0.5 * (-1.0 / n))))) 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 <= -1e-175) tmp = Float64(t_0 * 100.0); elseif (t_0 <= 0.0) tmp = Float64(n * Float64(Float64(100.0 * expm1(Float64(n * log1p(Float64(i / n))))) / i)); elseif (t_0 <= Inf) tmp = Float64(Float64(n * Float64(Float64(100.0 * (Float64(i / n) ^ n)) - 100.0)) / i); else tmp = Float64(100.0 / Float64(Float64(1.0 / n) + Float64(i * Float64(Float64(0.5 * Float64(1.0 / (n ^ 2.0))) + Float64(0.5 * Float64(-1.0 / n)))))); 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, -1e-175], N[(t$95$0 * 100.0), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(n * N[(N[(100.0 * N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(N[(n * N[(N[(100.0 * N[Power[N[(i / n), $MachinePrecision], n], $MachinePrecision]), $MachinePrecision] - 100.0), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision], N[(100.0 / N[(N[(1.0 / n), $MachinePrecision] + N[(i * N[(N[(0.5 * N[(1.0 / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(-1.0 / n), $MachinePrecision]), $MachinePrecision]), $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 -1 \cdot 10^{-175}:\\
\;\;\;\;t\_0 \cdot 100\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;n \cdot \frac{100 \cdot \mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{i}\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\frac{n \cdot \left(100 \cdot {\left(\frac{i}{n}\right)}^{n} - 100\right)}{i}\\
\mathbf{else}:\\
\;\;\;\;\frac{100}{\frac{1}{n} + i \cdot \left(0.5 \cdot \frac{1}{{n}^{2}} + 0.5 \cdot \frac{-1}{n}\right)}\\
\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)) < -1e-175Initial program 100.0%
if -1e-175 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 0.0Initial program 21.4%
associate-/r/21.2%
associate-*r*21.2%
*-commutative21.2%
associate-*r/21.2%
sub-neg21.2%
distribute-lft-in21.2%
metadata-eval21.2%
metadata-eval21.2%
metadata-eval21.2%
fma-define21.2%
metadata-eval21.2%
Simplified21.2%
fma-undefine21.2%
metadata-eval21.2%
metadata-eval21.2%
distribute-lft-in21.2%
sub-neg21.2%
*-commutative21.2%
add-exp-log21.2%
expm1-define21.2%
log-pow36.8%
log1p-define99.1%
Applied egg-rr99.1%
if 0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 99.6%
associate-*r/99.8%
sub-neg99.8%
distribute-rgt-in99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in i around inf 99.8%
Taylor expanded in n around inf 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%
*-commutative1.9%
fma-undefine1.9%
*-commutative1.9%
associate-/r/0.0%
metadata-eval0.0%
metadata-eval0.0%
distribute-rgt-in0.0%
sub-neg0.0%
associate-*r/0.0%
clear-num0.0%
un-div-inv0.0%
add-exp-log0.0%
expm1-define0.0%
log-pow0.0%
log1p-define0.0%
Applied egg-rr0.0%
Taylor expanded in i around 0 99.7%
Final simplification99.3%
(FPCore (i n)
:precision binary64
(let* ((t_0 (/ (+ (pow (+ 1.0 (/ i n)) n) -1.0) (/ i n))))
(if (<= t_0 -1e-175)
(* t_0 100.0)
(if (<= t_0 0.0)
(* n (* (expm1 (* n (log1p (/ i n)))) (/ 100.0 i)))
(if (<= t_0 INFINITY)
(/ (* n (- (* 100.0 (pow (/ i n) n)) 100.0)) i)
(/
100.0
(+
(/ 1.0 n)
(* i (+ (* 0.5 (/ 1.0 (pow n 2.0))) (* 0.5 (/ -1.0 n)))))))))))
double code(double i, double n) {
double t_0 = (pow((1.0 + (i / n)), n) + -1.0) / (i / n);
double tmp;
if (t_0 <= -1e-175) {
tmp = t_0 * 100.0;
} else if (t_0 <= 0.0) {
tmp = n * (expm1((n * log1p((i / n)))) * (100.0 / i));
} else if (t_0 <= ((double) INFINITY)) {
tmp = (n * ((100.0 * pow((i / n), n)) - 100.0)) / i;
} else {
tmp = 100.0 / ((1.0 / n) + (i * ((0.5 * (1.0 / pow(n, 2.0))) + (0.5 * (-1.0 / n)))));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = (Math.pow((1.0 + (i / n)), n) + -1.0) / (i / n);
double tmp;
if (t_0 <= -1e-175) {
tmp = t_0 * 100.0;
} else if (t_0 <= 0.0) {
tmp = n * (Math.expm1((n * Math.log1p((i / n)))) * (100.0 / i));
} else if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = (n * ((100.0 * Math.pow((i / n), n)) - 100.0)) / i;
} else {
tmp = 100.0 / ((1.0 / n) + (i * ((0.5 * (1.0 / Math.pow(n, 2.0))) + (0.5 * (-1.0 / n)))));
}
return tmp;
}
def code(i, n): t_0 = (math.pow((1.0 + (i / n)), n) + -1.0) / (i / n) tmp = 0 if t_0 <= -1e-175: tmp = t_0 * 100.0 elif t_0 <= 0.0: tmp = n * (math.expm1((n * math.log1p((i / n)))) * (100.0 / i)) elif t_0 <= math.inf: tmp = (n * ((100.0 * math.pow((i / n), n)) - 100.0)) / i else: tmp = 100.0 / ((1.0 / n) + (i * ((0.5 * (1.0 / math.pow(n, 2.0))) + (0.5 * (-1.0 / n))))) 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 <= -1e-175) tmp = Float64(t_0 * 100.0); elseif (t_0 <= 0.0) tmp = Float64(n * Float64(expm1(Float64(n * log1p(Float64(i / n)))) * Float64(100.0 / i))); elseif (t_0 <= Inf) tmp = Float64(Float64(n * Float64(Float64(100.0 * (Float64(i / n) ^ n)) - 100.0)) / i); else tmp = Float64(100.0 / Float64(Float64(1.0 / n) + Float64(i * Float64(Float64(0.5 * Float64(1.0 / (n ^ 2.0))) + Float64(0.5 * Float64(-1.0 / n)))))); 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, -1e-175], N[(t$95$0 * 100.0), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(n * N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] * N[(100.0 / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(N[(n * N[(N[(100.0 * N[Power[N[(i / n), $MachinePrecision], n], $MachinePrecision]), $MachinePrecision] - 100.0), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision], N[(100.0 / N[(N[(1.0 / n), $MachinePrecision] + N[(i * N[(N[(0.5 * N[(1.0 / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(-1.0 / n), $MachinePrecision]), $MachinePrecision]), $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 -1 \cdot 10^{-175}:\\
\;\;\;\;t\_0 \cdot 100\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;n \cdot \left(\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot \frac{100}{i}\right)\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\frac{n \cdot \left(100 \cdot {\left(\frac{i}{n}\right)}^{n} - 100\right)}{i}\\
\mathbf{else}:\\
\;\;\;\;\frac{100}{\frac{1}{n} + i \cdot \left(0.5 \cdot \frac{1}{{n}^{2}} + 0.5 \cdot \frac{-1}{n}\right)}\\
\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)) < -1e-175Initial program 100.0%
if -1e-175 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 0.0Initial program 21.4%
associate-/r/21.2%
associate-*r*21.2%
*-commutative21.2%
associate-*r/21.2%
sub-neg21.2%
distribute-lft-in21.2%
metadata-eval21.2%
metadata-eval21.2%
metadata-eval21.2%
fma-define21.2%
metadata-eval21.2%
Simplified21.2%
fma-undefine21.2%
metadata-eval21.2%
metadata-eval21.2%
distribute-lft-in21.2%
sub-neg21.2%
*-commutative21.2%
add-exp-log21.2%
expm1-define21.2%
log-pow36.8%
log1p-define99.1%
Applied egg-rr99.1%
associate-/l*99.1%
Applied egg-rr99.1%
if 0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 99.6%
associate-*r/99.8%
sub-neg99.8%
distribute-rgt-in99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in i around inf 99.8%
Taylor expanded in n around inf 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%
*-commutative1.9%
fma-undefine1.9%
*-commutative1.9%
associate-/r/0.0%
metadata-eval0.0%
metadata-eval0.0%
distribute-rgt-in0.0%
sub-neg0.0%
associate-*r/0.0%
clear-num0.0%
un-div-inv0.0%
add-exp-log0.0%
expm1-define0.0%
log-pow0.0%
log1p-define0.0%
Applied egg-rr0.0%
Taylor expanded in i around 0 99.7%
Final simplification99.3%
(FPCore (i n)
:precision binary64
(if (<= n -8.2e-235)
(* 100.0 (* n (/ (expm1 i) i)))
(if (<= n 2.2e+16)
(/
100.0
(+ (/ 1.0 n) (* i (+ (* 0.5 (/ 1.0 (pow n 2.0))) (* 0.5 (/ -1.0 n))))))
(* n (/ (* 100.0 (expm1 i)) i)))))
double code(double i, double n) {
double tmp;
if (n <= -8.2e-235) {
tmp = 100.0 * (n * (expm1(i) / i));
} else if (n <= 2.2e+16) {
tmp = 100.0 / ((1.0 / n) + (i * ((0.5 * (1.0 / pow(n, 2.0))) + (0.5 * (-1.0 / n)))));
} else {
tmp = n * ((100.0 * expm1(i)) / i);
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if (n <= -8.2e-235) {
tmp = 100.0 * (n * (Math.expm1(i) / i));
} else if (n <= 2.2e+16) {
tmp = 100.0 / ((1.0 / n) + (i * ((0.5 * (1.0 / Math.pow(n, 2.0))) + (0.5 * (-1.0 / n)))));
} else {
tmp = n * ((100.0 * Math.expm1(i)) / i);
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -8.2e-235: tmp = 100.0 * (n * (math.expm1(i) / i)) elif n <= 2.2e+16: tmp = 100.0 / ((1.0 / n) + (i * ((0.5 * (1.0 / math.pow(n, 2.0))) + (0.5 * (-1.0 / n))))) else: tmp = n * ((100.0 * math.expm1(i)) / i) return tmp
function code(i, n) tmp = 0.0 if (n <= -8.2e-235) tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); elseif (n <= 2.2e+16) tmp = Float64(100.0 / Float64(Float64(1.0 / n) + Float64(i * Float64(Float64(0.5 * Float64(1.0 / (n ^ 2.0))) + Float64(0.5 * Float64(-1.0 / n)))))); else tmp = Float64(n * Float64(Float64(100.0 * expm1(i)) / i)); end return tmp end
code[i_, n_] := If[LessEqual[n, -8.2e-235], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.2e+16], N[(100.0 / N[(N[(1.0 / n), $MachinePrecision] + N[(i * N[(N[(0.5 * N[(1.0 / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(-1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(N[(100.0 * N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -8.2 \cdot 10^{-235}:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;n \leq 2.2 \cdot 10^{+16}:\\
\;\;\;\;\frac{100}{\frac{1}{n} + i \cdot \left(0.5 \cdot \frac{1}{{n}^{2}} + 0.5 \cdot \frac{-1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \frac{100 \cdot \mathsf{expm1}\left(i\right)}{i}\\
\end{array}
\end{array}
if n < -8.19999999999999993e-235Initial program 25.9%
Taylor expanded in n around inf 32.8%
*-commutative32.8%
associate-/l*32.8%
expm1-define79.6%
Simplified79.6%
if -8.19999999999999993e-235 < n < 2.2e16Initial program 39.2%
associate-/r/38.9%
associate-*r*38.8%
*-commutative38.8%
associate-*r/38.8%
sub-neg38.8%
distribute-lft-in38.8%
metadata-eval38.8%
metadata-eval38.8%
metadata-eval38.8%
fma-define38.8%
metadata-eval38.8%
Simplified38.8%
*-commutative38.8%
fma-undefine38.8%
*-commutative38.8%
associate-/r/39.2%
metadata-eval39.2%
metadata-eval39.2%
distribute-rgt-in39.2%
sub-neg39.2%
associate-*r/39.2%
clear-num39.2%
un-div-inv39.2%
add-exp-log39.0%
expm1-define39.0%
log-pow60.0%
log1p-define85.6%
Applied egg-rr85.6%
Taylor expanded in i around 0 75.4%
if 2.2e16 < n Initial program 18.2%
associate-/r/18.7%
associate-*r*18.7%
*-commutative18.7%
associate-*r/18.7%
sub-neg18.7%
distribute-lft-in18.7%
metadata-eval18.7%
metadata-eval18.7%
metadata-eval18.7%
fma-define18.7%
metadata-eval18.7%
Simplified18.7%
Taylor expanded in n around inf 41.6%
sub-neg41.6%
metadata-eval41.6%
metadata-eval41.6%
distribute-lft-in41.6%
metadata-eval41.6%
sub-neg41.6%
expm1-define94.2%
Simplified94.2%
Final simplification82.5%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (/ (* n (expm1 i)) i))))
(if (<= n -7.8e-45)
t_0
(if (<= n -4.3e-234)
(* 100.0 (/ (expm1 i) (/ i n)))
(if (<= n 4.6e-150) (/ 0.0 (/ i n)) t_0)))))
double code(double i, double n) {
double t_0 = 100.0 * ((n * expm1(i)) / i);
double tmp;
if (n <= -7.8e-45) {
tmp = t_0;
} else if (n <= -4.3e-234) {
tmp = 100.0 * (expm1(i) / (i / n));
} else if (n <= 4.6e-150) {
tmp = 0.0 / (i / n);
} 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 <= -7.8e-45) {
tmp = t_0;
} else if (n <= -4.3e-234) {
tmp = 100.0 * (Math.expm1(i) / (i / n));
} else if (n <= 4.6e-150) {
tmp = 0.0 / (i / n);
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * ((n * math.expm1(i)) / i) tmp = 0 if n <= -7.8e-45: tmp = t_0 elif n <= -4.3e-234: tmp = 100.0 * (math.expm1(i) / (i / n)) elif n <= 4.6e-150: tmp = 0.0 / (i / n) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(Float64(n * expm1(i)) / i)) tmp = 0.0 if (n <= -7.8e-45) tmp = t_0; elseif (n <= -4.3e-234) tmp = Float64(100.0 * Float64(expm1(i) / Float64(i / n))); elseif (n <= 4.6e-150) tmp = Float64(0.0 / Float64(i / n)); 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]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -7.8e-45], t$95$0, If[LessEqual[n, -4.3e-234], N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 4.6e-150], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \frac{n \cdot \mathsf{expm1}\left(i\right)}{i}\\
\mathbf{if}\;n \leq -7.8 \cdot 10^{-45}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq -4.3 \cdot 10^{-234}:\\
\;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 4.6 \cdot 10^{-150}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -7.7999999999999999e-45 or 4.60000000000000006e-150 < n Initial program 19.6%
associate-/r/19.9%
associate-*r*19.9%
*-commutative19.9%
associate-*r/19.9%
sub-neg19.9%
distribute-lft-in19.9%
metadata-eval19.9%
metadata-eval19.9%
metadata-eval19.9%
fma-define19.9%
metadata-eval19.9%
Simplified19.9%
fma-undefine19.9%
metadata-eval19.9%
metadata-eval19.9%
distribute-lft-in19.9%
sub-neg19.9%
*-commutative19.9%
add-exp-log19.9%
expm1-define19.9%
log-pow20.0%
log1p-define73.9%
Applied egg-rr73.9%
Taylor expanded in n around inf 34.1%
expm1-define86.7%
Simplified86.7%
if -7.7999999999999999e-45 < n < -4.3000000000000001e-234Initial program 31.7%
Taylor expanded in n around inf 17.2%
expm1-define49.0%
Simplified49.0%
if -4.3000000000000001e-234 < n < 4.60000000000000006e-150Initial program 57.6%
associate-*r/57.6%
sub-neg57.6%
distribute-rgt-in57.6%
metadata-eval57.6%
metadata-eval57.6%
Simplified57.6%
Taylor expanded in i around inf 57.3%
Taylor expanded in n around 0 75.3%
Final simplification81.0%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (/ (expm1 i) (/ i n)))))
(if (<= i -2.5e-5)
t_0
(if (<= i -1e-173)
(* 100.0 (/ (* n (* i (+ 1.0 (* i 0.5)))) i))
(if (<= i 5e-28)
(*
n
(+
100.0
(*
i
(*
100.0
(+
(-
(* i 0.16666666666666666)
(/ (+ (* i 0.5) (* (/ i n) -0.3333333333333333)) n))
(- 0.5 (/ 0.5 n)))))))
t_0)))))
double code(double i, double n) {
double t_0 = 100.0 * (expm1(i) / (i / n));
double tmp;
if (i <= -2.5e-5) {
tmp = t_0;
} else if (i <= -1e-173) {
tmp = 100.0 * ((n * (i * (1.0 + (i * 0.5)))) / i);
} else if (i <= 5e-28) {
tmp = n * (100.0 + (i * (100.0 * (((i * 0.16666666666666666) - (((i * 0.5) + ((i / n) * -0.3333333333333333)) / n)) + (0.5 - (0.5 / n))))));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = 100.0 * (Math.expm1(i) / (i / n));
double tmp;
if (i <= -2.5e-5) {
tmp = t_0;
} else if (i <= -1e-173) {
tmp = 100.0 * ((n * (i * (1.0 + (i * 0.5)))) / i);
} else if (i <= 5e-28) {
tmp = n * (100.0 + (i * (100.0 * (((i * 0.16666666666666666) - (((i * 0.5) + ((i / n) * -0.3333333333333333)) / n)) + (0.5 - (0.5 / n))))));
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (math.expm1(i) / (i / n)) tmp = 0 if i <= -2.5e-5: tmp = t_0 elif i <= -1e-173: tmp = 100.0 * ((n * (i * (1.0 + (i * 0.5)))) / i) elif i <= 5e-28: tmp = n * (100.0 + (i * (100.0 * (((i * 0.16666666666666666) - (((i * 0.5) + ((i / n) * -0.3333333333333333)) / n)) + (0.5 - (0.5 / n)))))) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(expm1(i) / Float64(i / n))) tmp = 0.0 if (i <= -2.5e-5) tmp = t_0; elseif (i <= -1e-173) tmp = Float64(100.0 * Float64(Float64(n * Float64(i * Float64(1.0 + Float64(i * 0.5)))) / i)); elseif (i <= 5e-28) tmp = Float64(n * Float64(100.0 + Float64(i * Float64(100.0 * Float64(Float64(Float64(i * 0.16666666666666666) - Float64(Float64(Float64(i * 0.5) + Float64(Float64(i / n) * -0.3333333333333333)) / n)) + Float64(0.5 - Float64(0.5 / n))))))); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[i, -2.5e-5], t$95$0, If[LessEqual[i, -1e-173], N[(100.0 * N[(N[(n * N[(i * N[(1.0 + N[(i * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 5e-28], N[(n * N[(100.0 + N[(i * N[(100.0 * N[(N[(N[(i * 0.16666666666666666), $MachinePrecision] - N[(N[(N[(i * 0.5), $MachinePrecision] + N[(N[(i / n), $MachinePrecision] * -0.3333333333333333), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] + N[(0.5 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\
\mathbf{if}\;i \leq -2.5 \cdot 10^{-5}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;i \leq -1 \cdot 10^{-173}:\\
\;\;\;\;100 \cdot \frac{n \cdot \left(i \cdot \left(1 + i \cdot 0.5\right)\right)}{i}\\
\mathbf{elif}\;i \leq 5 \cdot 10^{-28}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(100 \cdot \left(\left(i \cdot 0.16666666666666666 - \frac{i \cdot 0.5 + \frac{i}{n} \cdot -0.3333333333333333}{n}\right) + \left(0.5 - \frac{0.5}{n}\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if i < -2.50000000000000012e-5 or 5.0000000000000002e-28 < i Initial program 48.3%
Taylor expanded in n around inf 64.1%
expm1-define66.9%
Simplified66.9%
if -2.50000000000000012e-5 < i < -1e-173Initial program 17.7%
associate-/r/17.9%
associate-*r*17.9%
*-commutative17.9%
associate-*r/17.9%
sub-neg17.9%
distribute-lft-in17.9%
metadata-eval17.9%
metadata-eval17.9%
metadata-eval17.9%
fma-define17.9%
metadata-eval17.9%
Simplified17.9%
fma-undefine17.9%
metadata-eval17.9%
metadata-eval17.9%
distribute-lft-in17.9%
sub-neg17.9%
*-commutative17.9%
add-exp-log17.9%
expm1-define17.9%
log-pow31.4%
log1p-define89.3%
Applied egg-rr89.3%
Taylor expanded in n around inf 17.1%
expm1-define84.8%
Simplified84.8%
Taylor expanded in i around 0 84.8%
*-commutative84.8%
Simplified84.8%
if -1e-173 < i < 5.0000000000000002e-28Initial program 7.6%
associate-/r/8.2%
associate-*r*8.2%
*-commutative8.2%
associate-*r/8.2%
sub-neg8.2%
distribute-lft-in8.2%
metadata-eval8.2%
metadata-eval8.2%
metadata-eval8.2%
fma-define8.2%
metadata-eval8.2%
Simplified8.2%
Taylor expanded in i around 0 72.5%
distribute-lft-out72.5%
associate--l+72.5%
associate-*r/72.5%
metadata-eval72.5%
associate-*r/72.5%
metadata-eval72.5%
associate-*r/72.5%
metadata-eval72.5%
Simplified72.5%
Taylor expanded in n around -inf 84.4%
Final simplification76.6%
(FPCore (i n) :precision binary64 (if (or (<= n -4.4e-234) (not (<= n 1.2e-153))) (* n (/ (* 100.0 (expm1 i)) i)) (/ 0.0 (/ i n))))
double code(double i, double n) {
double tmp;
if ((n <= -4.4e-234) || !(n <= 1.2e-153)) {
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 <= -4.4e-234) || !(n <= 1.2e-153)) {
tmp = n * ((100.0 * Math.expm1(i)) / i);
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -4.4e-234) or not (n <= 1.2e-153): 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 <= -4.4e-234) || !(n <= 1.2e-153)) 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, -4.4e-234], N[Not[LessEqual[n, 1.2e-153]], $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 -4.4 \cdot 10^{-234} \lor \neg \left(n \leq 1.2 \cdot 10^{-153}\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 < -4.3999999999999998e-234 or 1.2000000000000001e-153 < n Initial program 21.0%
associate-/r/21.3%
associate-*r*21.3%
*-commutative21.3%
associate-*r/21.3%
sub-neg21.3%
distribute-lft-in21.3%
metadata-eval21.3%
metadata-eval21.3%
metadata-eval21.3%
fma-define21.3%
metadata-eval21.3%
Simplified21.3%
Taylor expanded in n around inf 32.1%
sub-neg32.1%
metadata-eval32.1%
metadata-eval32.1%
distribute-lft-in32.1%
metadata-eval32.1%
sub-neg32.1%
expm1-define82.4%
Simplified82.4%
if -4.3999999999999998e-234 < n < 1.2000000000000001e-153Initial program 57.6%
associate-*r/57.6%
sub-neg57.6%
distribute-rgt-in57.6%
metadata-eval57.6%
metadata-eval57.6%
Simplified57.6%
Taylor expanded in i around inf 57.3%
Taylor expanded in n around 0 75.3%
Final simplification81.1%
(FPCore (i n) :precision binary64 (if (<= n -4.4e-234) (* 100.0 (* n (/ (expm1 i) i))) (if (<= n 4.5e-154) (/ 0.0 (/ i n)) (* n (/ (* 100.0 (expm1 i)) i)))))
double code(double i, double n) {
double tmp;
if (n <= -4.4e-234) {
tmp = 100.0 * (n * (expm1(i) / i));
} else if (n <= 4.5e-154) {
tmp = 0.0 / (i / n);
} else {
tmp = n * ((100.0 * expm1(i)) / i);
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if (n <= -4.4e-234) {
tmp = 100.0 * (n * (Math.expm1(i) / i));
} else if (n <= 4.5e-154) {
tmp = 0.0 / (i / n);
} else {
tmp = n * ((100.0 * Math.expm1(i)) / i);
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -4.4e-234: tmp = 100.0 * (n * (math.expm1(i) / i)) elif n <= 4.5e-154: tmp = 0.0 / (i / n) else: tmp = n * ((100.0 * math.expm1(i)) / i) return tmp
function code(i, n) tmp = 0.0 if (n <= -4.4e-234) tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); elseif (n <= 4.5e-154) tmp = Float64(0.0 / Float64(i / n)); else tmp = Float64(n * Float64(Float64(100.0 * expm1(i)) / i)); end return tmp end
code[i_, n_] := If[LessEqual[n, -4.4e-234], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 4.5e-154], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(n * N[(N[(100.0 * N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -4.4 \cdot 10^{-234}:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;n \leq 4.5 \cdot 10^{-154}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \frac{100 \cdot \mathsf{expm1}\left(i\right)}{i}\\
\end{array}
\end{array}
if n < -4.3999999999999998e-234Initial program 25.9%
Taylor expanded in n around inf 32.8%
*-commutative32.8%
associate-/l*32.8%
expm1-define79.6%
Simplified79.6%
if -4.3999999999999998e-234 < n < 4.4999999999999997e-154Initial program 57.6%
associate-*r/57.6%
sub-neg57.6%
distribute-rgt-in57.6%
metadata-eval57.6%
metadata-eval57.6%
Simplified57.6%
Taylor expanded in i around inf 57.3%
Taylor expanded in n around 0 75.3%
if 4.4999999999999997e-154 < n Initial program 15.3%
associate-/r/15.7%
associate-*r*15.7%
*-commutative15.7%
associate-*r/15.7%
sub-neg15.7%
distribute-lft-in15.7%
metadata-eval15.7%
metadata-eval15.7%
metadata-eval15.7%
fma-define15.7%
metadata-eval15.7%
Simplified15.7%
Taylor expanded in n around inf 31.4%
sub-neg31.4%
metadata-eval31.4%
metadata-eval31.4%
distribute-lft-in31.4%
metadata-eval31.4%
sub-neg31.4%
expm1-define85.8%
Simplified85.8%
Final simplification81.2%
(FPCore (i n) :precision binary64 (if (<= n -8.5e-235) (* n (* (/ 100.0 i) (expm1 i))) (if (<= n 4.6e-150) (/ 0.0 (/ i n)) (* 100.0 (/ (* n (expm1 i)) i)))))
double code(double i, double n) {
double tmp;
if (n <= -8.5e-235) {
tmp = n * ((100.0 / i) * expm1(i));
} else if (n <= 4.6e-150) {
tmp = 0.0 / (i / n);
} else {
tmp = 100.0 * ((n * expm1(i)) / i);
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if (n <= -8.5e-235) {
tmp = n * ((100.0 / i) * Math.expm1(i));
} else if (n <= 4.6e-150) {
tmp = 0.0 / (i / n);
} else {
tmp = 100.0 * ((n * Math.expm1(i)) / i);
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -8.5e-235: tmp = n * ((100.0 / i) * math.expm1(i)) elif n <= 4.6e-150: tmp = 0.0 / (i / n) else: tmp = 100.0 * ((n * math.expm1(i)) / i) return tmp
function code(i, n) tmp = 0.0 if (n <= -8.5e-235) tmp = Float64(n * Float64(Float64(100.0 / i) * expm1(i))); elseif (n <= 4.6e-150) tmp = Float64(0.0 / Float64(i / n)); else tmp = Float64(100.0 * Float64(Float64(n * expm1(i)) / i)); end return tmp end
code[i_, n_] := If[LessEqual[n, -8.5e-235], N[(n * N[(N[(100.0 / i), $MachinePrecision] * N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 4.6e-150], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(N[(n * N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -8.5 \cdot 10^{-235}:\\
\;\;\;\;n \cdot \left(\frac{100}{i} \cdot \mathsf{expm1}\left(i\right)\right)\\
\mathbf{elif}\;n \leq 4.6 \cdot 10^{-150}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n \cdot \mathsf{expm1}\left(i\right)}{i}\\
\end{array}
\end{array}
if n < -8.49999999999999964e-235Initial program 25.9%
associate-/r/26.1%
associate-*r*26.1%
*-commutative26.1%
associate-*r/26.1%
sub-neg26.1%
distribute-lft-in26.1%
metadata-eval26.1%
metadata-eval26.1%
metadata-eval26.1%
fma-define26.1%
metadata-eval26.1%
Simplified26.1%
fma-undefine26.1%
metadata-eval26.1%
metadata-eval26.1%
distribute-lft-in26.1%
sub-neg26.1%
*-commutative26.1%
add-exp-log26.1%
expm1-define26.1%
log-pow31.5%
log1p-define78.7%
Applied egg-rr78.7%
associate-/l*78.6%
Applied egg-rr78.6%
Taylor expanded in n around inf 32.7%
expm1-define79.5%
Simplified79.5%
if -8.49999999999999964e-235 < n < 4.60000000000000006e-150Initial program 57.6%
associate-*r/57.6%
sub-neg57.6%
distribute-rgt-in57.6%
metadata-eval57.6%
metadata-eval57.6%
Simplified57.6%
Taylor expanded in i around inf 57.3%
Taylor expanded in n around 0 75.3%
if 4.60000000000000006e-150 < n Initial program 15.3%
associate-/r/15.7%
associate-*r*15.7%
*-commutative15.7%
associate-*r/15.7%
sub-neg15.7%
distribute-lft-in15.7%
metadata-eval15.7%
metadata-eval15.7%
metadata-eval15.7%
fma-define15.7%
metadata-eval15.7%
Simplified15.7%
fma-undefine15.7%
metadata-eval15.7%
metadata-eval15.7%
distribute-lft-in15.7%
sub-neg15.7%
*-commutative15.7%
add-exp-log15.6%
expm1-define15.6%
log-pow19.3%
log1p-define75.0%
Applied egg-rr75.0%
Taylor expanded in n around inf 31.4%
expm1-define85.3%
Simplified85.3%
Final simplification81.0%
(FPCore (i n)
:precision binary64
(let* ((t_0
(*
100.0
(/
(*
n
(*
i
(+
1.0
(*
i
(+
0.5
(* i (+ 0.16666666666666666 (* i 0.041666666666666664))))))))
i))))
(if (<= n -1.05e+48)
t_0
(if (<= n -2.3e-235)
(* 100.0 (/ i (/ i n)))
(if (<= n 4.6e-150) (/ 0.0 (/ i n)) t_0)))))
double code(double i, double n) {
double t_0 = 100.0 * ((n * (i * (1.0 + (i * (0.5 + (i * (0.16666666666666666 + (i * 0.041666666666666664)))))))) / i);
double tmp;
if (n <= -1.05e+48) {
tmp = t_0;
} else if (n <= -2.3e-235) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 4.6e-150) {
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 = 100.0d0 * ((n * (i * (1.0d0 + (i * (0.5d0 + (i * (0.16666666666666666d0 + (i * 0.041666666666666664d0)))))))) / i)
if (n <= (-1.05d+48)) then
tmp = t_0
else if (n <= (-2.3d-235)) then
tmp = 100.0d0 * (i / (i / n))
else if (n <= 4.6d-150) 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 = 100.0 * ((n * (i * (1.0 + (i * (0.5 + (i * (0.16666666666666666 + (i * 0.041666666666666664)))))))) / i);
double tmp;
if (n <= -1.05e+48) {
tmp = t_0;
} else if (n <= -2.3e-235) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 4.6e-150) {
tmp = 0.0 / (i / n);
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * ((n * (i * (1.0 + (i * (0.5 + (i * (0.16666666666666666 + (i * 0.041666666666666664)))))))) / i) tmp = 0 if n <= -1.05e+48: tmp = t_0 elif n <= -2.3e-235: tmp = 100.0 * (i / (i / n)) elif n <= 4.6e-150: tmp = 0.0 / (i / n) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(Float64(n * Float64(i * Float64(1.0 + Float64(i * Float64(0.5 + Float64(i * Float64(0.16666666666666666 + Float64(i * 0.041666666666666664)))))))) / i)) tmp = 0.0 if (n <= -1.05e+48) tmp = t_0; elseif (n <= -2.3e-235) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (n <= 4.6e-150) tmp = Float64(0.0 / Float64(i / n)); else tmp = t_0; end return tmp end
function tmp_2 = code(i, n) t_0 = 100.0 * ((n * (i * (1.0 + (i * (0.5 + (i * (0.16666666666666666 + (i * 0.041666666666666664)))))))) / i); tmp = 0.0; if (n <= -1.05e+48) tmp = t_0; elseif (n <= -2.3e-235) tmp = 100.0 * (i / (i / n)); elseif (n <= 4.6e-150) tmp = 0.0 / (i / n); else tmp = t_0; end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = 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]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1.05e+48], t$95$0, If[LessEqual[n, -2.3e-235], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 4.6e-150], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \frac{n \cdot \left(i \cdot \left(1 + i \cdot \left(0.5 + i \cdot \left(0.16666666666666666 + i \cdot 0.041666666666666664\right)\right)\right)\right)}{i}\\
\mathbf{if}\;n \leq -1.05 \cdot 10^{+48}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq -2.3 \cdot 10^{-235}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 4.6 \cdot 10^{-150}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -1.0499999999999999e48 or 4.60000000000000006e-150 < n Initial program 19.1%
associate-/r/19.6%
associate-*r*19.6%
*-commutative19.6%
associate-*r/19.6%
sub-neg19.6%
distribute-lft-in19.6%
metadata-eval19.6%
metadata-eval19.6%
metadata-eval19.6%
fma-define19.6%
metadata-eval19.6%
Simplified19.6%
fma-undefine19.6%
metadata-eval19.6%
metadata-eval19.6%
distribute-lft-in19.6%
sub-neg19.6%
*-commutative19.6%
add-exp-log19.5%
expm1-define19.5%
log-pow18.6%
log1p-define70.8%
Applied egg-rr70.8%
Taylor expanded in n around inf 37.5%
expm1-define87.9%
Simplified87.9%
Taylor expanded in i around 0 68.6%
*-commutative68.6%
Simplified68.6%
if -1.0499999999999999e48 < n < -2.29999999999999997e-235Initial program 26.7%
Taylor expanded in i around 0 60.8%
if -2.29999999999999997e-235 < n < 4.60000000000000006e-150Initial program 57.6%
associate-*r/57.6%
sub-neg57.6%
distribute-rgt-in57.6%
metadata-eval57.6%
metadata-eval57.6%
Simplified57.6%
Taylor expanded in i around inf 57.3%
Taylor expanded in n around 0 75.3%
Final simplification68.2%
(FPCore (i n)
:precision binary64
(if (<= n -9.6e+47)
(*
n
(+
100.0
(* i (+ 50.0 (* i (+ 16.666666666666668 (* i 4.166666666666667)))))))
(if (<= n -7.5e-235)
(* 100.0 (/ i (/ i n)))
(if (<= n 2.7e-151)
(/ 0.0 (/ i n))
(*
100.0
(+
n
(*
i
(+
(* n 0.5)
(*
i
(+
(* 0.041666666666666664 (* i n))
(* n 0.16666666666666666)))))))))))
double code(double i, double n) {
double tmp;
if (n <= -9.6e+47) {
tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
} else if (n <= -7.5e-235) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 2.7e-151) {
tmp = 0.0 / (i / n);
} else {
tmp = 100.0 * (n + (i * ((n * 0.5) + (i * ((0.041666666666666664 * (i * n)) + (n * 0.16666666666666666))))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-9.6d+47)) then
tmp = n * (100.0d0 + (i * (50.0d0 + (i * (16.666666666666668d0 + (i * 4.166666666666667d0))))))
else if (n <= (-7.5d-235)) then
tmp = 100.0d0 * (i / (i / n))
else if (n <= 2.7d-151) then
tmp = 0.0d0 / (i / n)
else
tmp = 100.0d0 * (n + (i * ((n * 0.5d0) + (i * ((0.041666666666666664d0 * (i * n)) + (n * 0.16666666666666666d0))))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -9.6e+47) {
tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
} else if (n <= -7.5e-235) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 2.7e-151) {
tmp = 0.0 / (i / n);
} else {
tmp = 100.0 * (n + (i * ((n * 0.5) + (i * ((0.041666666666666664 * (i * n)) + (n * 0.16666666666666666))))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -9.6e+47: tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667)))))) elif n <= -7.5e-235: tmp = 100.0 * (i / (i / n)) elif n <= 2.7e-151: tmp = 0.0 / (i / n) else: tmp = 100.0 * (n + (i * ((n * 0.5) + (i * ((0.041666666666666664 * (i * n)) + (n * 0.16666666666666666)))))) return tmp
function code(i, n) tmp = 0.0 if (n <= -9.6e+47) tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * Float64(16.666666666666668 + Float64(i * 4.166666666666667))))))); elseif (n <= -7.5e-235) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (n <= 2.7e-151) tmp = Float64(0.0 / Float64(i / n)); else tmp = Float64(100.0 * Float64(n + Float64(i * Float64(Float64(n * 0.5) + Float64(i * Float64(Float64(0.041666666666666664 * Float64(i * n)) + Float64(n * 0.16666666666666666))))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -9.6e+47) tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667)))))); elseif (n <= -7.5e-235) tmp = 100.0 * (i / (i / n)); elseif (n <= 2.7e-151) tmp = 0.0 / (i / n); else tmp = 100.0 * (n + (i * ((n * 0.5) + (i * ((0.041666666666666664 * (i * n)) + (n * 0.16666666666666666)))))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -9.6e+47], 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], If[LessEqual[n, -7.5e-235], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.7e-151], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n + N[(i * N[(N[(n * 0.5), $MachinePrecision] + N[(i * N[(N[(0.041666666666666664 * N[(i * n), $MachinePrecision]), $MachinePrecision] + N[(n * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -9.6 \cdot 10^{+47}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot \left(16.666666666666668 + i \cdot 4.166666666666667\right)\right)\right)\\
\mathbf{elif}\;n \leq -7.5 \cdot 10^{-235}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 2.7 \cdot 10^{-151}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n + i \cdot \left(n \cdot 0.5 + i \cdot \left(0.041666666666666664 \cdot \left(i \cdot n\right) + n \cdot 0.16666666666666666\right)\right)\right)\\
\end{array}
\end{array}
if n < -9.60000000000000075e47Initial program 25.2%
Taylor expanded in n around inf 46.5%
expm1-define65.5%
Simplified65.5%
Taylor expanded in i around 0 60.2%
Taylor expanded in n around 0 60.3%
*-commutative60.3%
Simplified60.3%
if -9.60000000000000075e47 < n < -7.49999999999999968e-235Initial program 26.7%
Taylor expanded in i around 0 60.8%
if -7.49999999999999968e-235 < n < 2.70000000000000007e-151Initial program 57.6%
associate-*r/57.6%
sub-neg57.6%
distribute-rgt-in57.6%
metadata-eval57.6%
metadata-eval57.6%
Simplified57.6%
Taylor expanded in i around inf 57.3%
Taylor expanded in n around 0 75.3%
if 2.70000000000000007e-151 < n Initial program 15.3%
Taylor expanded in n around inf 31.0%
expm1-define68.2%
Simplified68.2%
Taylor expanded in i around 0 72.6%
Final simplification67.7%
(FPCore (i n)
:precision binary64
(let* ((t_0
(*
n
(+
100.0
(*
i
(+ 50.0 (* i (+ 16.666666666666668 (* i 4.166666666666667)))))))))
(if (<= n -1e+48)
t_0
(if (<= n -4.4e-234)
(* 100.0 (/ i (/ i n)))
(if (<= n 3.8e-154) (/ 0.0 (/ i n)) t_0)))))
double code(double i, double n) {
double t_0 = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
double tmp;
if (n <= -1e+48) {
tmp = t_0;
} else if (n <= -4.4e-234) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 3.8e-154) {
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 + (i * 4.166666666666667d0))))))
if (n <= (-1d+48)) then
tmp = t_0
else if (n <= (-4.4d-234)) then
tmp = 100.0d0 * (i / (i / n))
else if (n <= 3.8d-154) 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 + (i * 4.166666666666667))))));
double tmp;
if (n <= -1e+48) {
tmp = t_0;
} else if (n <= -4.4e-234) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 3.8e-154) {
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 + (i * 4.166666666666667)))))) tmp = 0 if n <= -1e+48: tmp = t_0 elif n <= -4.4e-234: tmp = 100.0 * (i / (i / n)) elif n <= 3.8e-154: 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 * Float64(16.666666666666668 + Float64(i * 4.166666666666667))))))) tmp = 0.0 if (n <= -1e+48) tmp = t_0; elseif (n <= -4.4e-234) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (n <= 3.8e-154) 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 + (i * 4.166666666666667)))))); tmp = 0.0; if (n <= -1e+48) tmp = t_0; elseif (n <= -4.4e-234) tmp = 100.0 * (i / (i / n)); elseif (n <= 3.8e-154) 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 * N[(16.666666666666668 + N[(i * 4.166666666666667), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1e+48], t$95$0, If[LessEqual[n, -4.4e-234], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 3.8e-154], 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 \left(16.666666666666668 + i \cdot 4.166666666666667\right)\right)\right)\\
\mathbf{if}\;n \leq -1 \cdot 10^{+48}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq -4.4 \cdot 10^{-234}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 3.8 \cdot 10^{-154}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -1.00000000000000004e48 or 3.8000000000000001e-154 < n Initial program 19.1%
Taylor expanded in n around inf 37.0%
expm1-define67.2%
Simplified67.2%
Taylor expanded in i around 0 67.8%
Taylor expanded in n around 0 67.8%
*-commutative67.8%
Simplified67.8%
if -1.00000000000000004e48 < n < -4.3999999999999998e-234Initial program 26.7%
Taylor expanded in i around 0 60.8%
if -4.3999999999999998e-234 < n < 3.8000000000000001e-154Initial program 57.6%
associate-*r/57.6%
sub-neg57.6%
distribute-rgt-in57.6%
metadata-eval57.6%
metadata-eval57.6%
Simplified57.6%
Taylor expanded in i around inf 57.3%
Taylor expanded in n around 0 75.3%
Final simplification67.7%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (+ n (* i (* n (+ 0.5 (* i 0.16666666666666666))))))))
(if (<= n -1e+48)
t_0
(if (<= n -2.75e-235)
(* 100.0 (/ i (/ i n)))
(if (<= n 5.8e-154) (/ 0.0 (/ i n)) t_0)))))
double code(double i, double n) {
double t_0 = 100.0 * (n + (i * (n * (0.5 + (i * 0.16666666666666666)))));
double tmp;
if (n <= -1e+48) {
tmp = t_0;
} else if (n <= -2.75e-235) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 5.8e-154) {
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 = 100.0d0 * (n + (i * (n * (0.5d0 + (i * 0.16666666666666666d0)))))
if (n <= (-1d+48)) then
tmp = t_0
else if (n <= (-2.75d-235)) then
tmp = 100.0d0 * (i / (i / n))
else if (n <= 5.8d-154) 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 = 100.0 * (n + (i * (n * (0.5 + (i * 0.16666666666666666)))));
double tmp;
if (n <= -1e+48) {
tmp = t_0;
} else if (n <= -2.75e-235) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 5.8e-154) {
tmp = 0.0 / (i / n);
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (n + (i * (n * (0.5 + (i * 0.16666666666666666))))) tmp = 0 if n <= -1e+48: tmp = t_0 elif n <= -2.75e-235: tmp = 100.0 * (i / (i / n)) elif n <= 5.8e-154: tmp = 0.0 / (i / n) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(n + Float64(i * Float64(n * Float64(0.5 + Float64(i * 0.16666666666666666)))))) tmp = 0.0 if (n <= -1e+48) tmp = t_0; elseif (n <= -2.75e-235) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (n <= 5.8e-154) tmp = Float64(0.0 / Float64(i / n)); else tmp = t_0; end return tmp end
function tmp_2 = code(i, n) t_0 = 100.0 * (n + (i * (n * (0.5 + (i * 0.16666666666666666))))); tmp = 0.0; if (n <= -1e+48) tmp = t_0; elseif (n <= -2.75e-235) tmp = 100.0 * (i / (i / n)); elseif (n <= 5.8e-154) tmp = 0.0 / (i / n); else tmp = t_0; end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(n + N[(i * N[(n * N[(0.5 + N[(i * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1e+48], t$95$0, If[LessEqual[n, -2.75e-235], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 5.8e-154], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \left(n + i \cdot \left(n \cdot \left(0.5 + i \cdot 0.16666666666666666\right)\right)\right)\\
\mathbf{if}\;n \leq -1 \cdot 10^{+48}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq -2.75 \cdot 10^{-235}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 5.8 \cdot 10^{-154}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -1.00000000000000004e48 or 5.8e-154 < n Initial program 19.1%
Taylor expanded in n around inf 37.0%
expm1-define67.2%
Simplified67.2%
Taylor expanded in i around 0 66.0%
+-commutative66.0%
associate-*r*66.0%
distribute-rgt-in66.0%
associate-*r*66.0%
*-commutative66.0%
*-commutative66.0%
Simplified66.0%
Taylor expanded in n around 0 66.0%
if -1.00000000000000004e48 < n < -2.7499999999999999e-235Initial program 26.7%
Taylor expanded in i around 0 60.8%
if -2.7499999999999999e-235 < n < 5.8e-154Initial program 57.6%
associate-*r/57.6%
sub-neg57.6%
distribute-rgt-in57.6%
metadata-eval57.6%
metadata-eval57.6%
Simplified57.6%
Taylor expanded in i around inf 57.3%
Taylor expanded in n around 0 75.3%
Final simplification66.6%
(FPCore (i n)
:precision binary64
(if (<= n -5e-19)
(* 100.0 (/ (* i n) i))
(if (<= n -1.95e-234)
(* 100.0 (/ i (/ i n)))
(if (<= n 3.3e-154) (/ 0.0 (/ i n)) (+ (* 50.0 (* i n)) (* n 100.0))))))
double code(double i, double n) {
double tmp;
if (n <= -5e-19) {
tmp = 100.0 * ((i * n) / i);
} else if (n <= -1.95e-234) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 3.3e-154) {
tmp = 0.0 / (i / n);
} else {
tmp = (50.0 * (i * n)) + (n * 100.0);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-5d-19)) then
tmp = 100.0d0 * ((i * n) / i)
else if (n <= (-1.95d-234)) then
tmp = 100.0d0 * (i / (i / n))
else if (n <= 3.3d-154) then
tmp = 0.0d0 / (i / n)
else
tmp = (50.0d0 * (i * n)) + (n * 100.0d0)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -5e-19) {
tmp = 100.0 * ((i * n) / i);
} else if (n <= -1.95e-234) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 3.3e-154) {
tmp = 0.0 / (i / n);
} else {
tmp = (50.0 * (i * n)) + (n * 100.0);
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -5e-19: tmp = 100.0 * ((i * n) / i) elif n <= -1.95e-234: tmp = 100.0 * (i / (i / n)) elif n <= 3.3e-154: tmp = 0.0 / (i / n) else: tmp = (50.0 * (i * n)) + (n * 100.0) return tmp
function code(i, n) tmp = 0.0 if (n <= -5e-19) tmp = Float64(100.0 * Float64(Float64(i * n) / i)); elseif (n <= -1.95e-234) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (n <= 3.3e-154) tmp = Float64(0.0 / Float64(i / n)); else tmp = Float64(Float64(50.0 * Float64(i * n)) + Float64(n * 100.0)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -5e-19) tmp = 100.0 * ((i * n) / i); elseif (n <= -1.95e-234) tmp = 100.0 * (i / (i / n)); elseif (n <= 3.3e-154) tmp = 0.0 / (i / n); else tmp = (50.0 * (i * n)) + (n * 100.0); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -5e-19], N[(100.0 * N[(N[(i * n), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -1.95e-234], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 3.3e-154], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision] + N[(n * 100.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -5 \cdot 10^{-19}:\\
\;\;\;\;100 \cdot \frac{i \cdot n}{i}\\
\mathbf{elif}\;n \leq -1.95 \cdot 10^{-234}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 3.3 \cdot 10^{-154}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;50 \cdot \left(i \cdot n\right) + n \cdot 100\\
\end{array}
\end{array}
if n < -5.0000000000000004e-19Initial program 24.0%
associate-/r/24.4%
associate-*r*24.3%
*-commutative24.3%
associate-*r/24.4%
sub-neg24.4%
distribute-lft-in24.4%
metadata-eval24.4%
metadata-eval24.4%
metadata-eval24.4%
fma-define24.4%
metadata-eval24.4%
Simplified24.4%
fma-undefine24.4%
metadata-eval24.4%
metadata-eval24.4%
distribute-lft-in24.4%
sub-neg24.4%
*-commutative24.4%
add-exp-log24.4%
expm1-define24.4%
log-pow17.0%
log1p-define71.5%
Applied egg-rr71.5%
Taylor expanded in n around inf 37.5%
expm1-define90.6%
Simplified90.6%
Taylor expanded in i around 0 64.3%
*-commutative64.3%
Simplified64.3%
if -5.0000000000000004e-19 < n < -1.9500000000000001e-234Initial program 31.3%
Taylor expanded in i around 0 46.3%
if -1.9500000000000001e-234 < n < 3.30000000000000027e-154Initial program 57.6%
associate-*r/57.6%
sub-neg57.6%
distribute-rgt-in57.6%
metadata-eval57.6%
metadata-eval57.6%
Simplified57.6%
Taylor expanded in i around inf 57.3%
Taylor expanded in n around 0 75.3%
if 3.30000000000000027e-154 < n Initial program 15.3%
Taylor expanded in n around inf 31.0%
expm1-define68.2%
Simplified68.2%
Taylor expanded in i around 0 65.7%
Final simplification64.7%
(FPCore (i n)
:precision binary64
(if (<= n -5e-19)
(* 100.0 (/ (* i n) i))
(if (<= n -4.4e-234)
(* 100.0 (/ i (/ i n)))
(if (<= n 5.8e-154) (/ 0.0 (/ i n)) (* n (+ 100.0 (* i 50.0)))))))
double code(double i, double n) {
double tmp;
if (n <= -5e-19) {
tmp = 100.0 * ((i * n) / i);
} else if (n <= -4.4e-234) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 5.8e-154) {
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 <= (-5d-19)) then
tmp = 100.0d0 * ((i * n) / i)
else if (n <= (-4.4d-234)) then
tmp = 100.0d0 * (i / (i / n))
else if (n <= 5.8d-154) 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 <= -5e-19) {
tmp = 100.0 * ((i * n) / i);
} else if (n <= -4.4e-234) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 5.8e-154) {
tmp = 0.0 / (i / n);
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -5e-19: tmp = 100.0 * ((i * n) / i) elif n <= -4.4e-234: tmp = 100.0 * (i / (i / n)) elif n <= 5.8e-154: tmp = 0.0 / (i / n) else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) tmp = 0.0 if (n <= -5e-19) tmp = Float64(100.0 * Float64(Float64(i * n) / i)); elseif (n <= -4.4e-234) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (n <= 5.8e-154) 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 <= -5e-19) tmp = 100.0 * ((i * n) / i); elseif (n <= -4.4e-234) tmp = 100.0 * (i / (i / n)); elseif (n <= 5.8e-154) tmp = 0.0 / (i / n); else tmp = n * (100.0 + (i * 50.0)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -5e-19], N[(100.0 * N[(N[(i * n), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -4.4e-234], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 5.8e-154], 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 -5 \cdot 10^{-19}:\\
\;\;\;\;100 \cdot \frac{i \cdot n}{i}\\
\mathbf{elif}\;n \leq -4.4 \cdot 10^{-234}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 5.8 \cdot 10^{-154}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < -5.0000000000000004e-19Initial program 24.0%
associate-/r/24.4%
associate-*r*24.3%
*-commutative24.3%
associate-*r/24.4%
sub-neg24.4%
distribute-lft-in24.4%
metadata-eval24.4%
metadata-eval24.4%
metadata-eval24.4%
fma-define24.4%
metadata-eval24.4%
Simplified24.4%
fma-undefine24.4%
metadata-eval24.4%
metadata-eval24.4%
distribute-lft-in24.4%
sub-neg24.4%
*-commutative24.4%
add-exp-log24.4%
expm1-define24.4%
log-pow17.0%
log1p-define71.5%
Applied egg-rr71.5%
Taylor expanded in n around inf 37.5%
expm1-define90.6%
Simplified90.6%
Taylor expanded in i around 0 64.3%
*-commutative64.3%
Simplified64.3%
if -5.0000000000000004e-19 < n < -4.3999999999999998e-234Initial program 31.3%
Taylor expanded in i around 0 46.3%
if -4.3999999999999998e-234 < n < 5.8e-154Initial program 57.6%
associate-*r/57.6%
sub-neg57.6%
distribute-rgt-in57.6%
metadata-eval57.6%
metadata-eval57.6%
Simplified57.6%
Taylor expanded in i around inf 57.3%
Taylor expanded in n around 0 75.3%
if 5.8e-154 < n Initial program 15.3%
associate-/r/15.7%
associate-*r*15.7%
*-commutative15.7%
associate-*r/15.7%
sub-neg15.7%
distribute-lft-in15.7%
metadata-eval15.7%
metadata-eval15.7%
metadata-eval15.7%
fma-define15.7%
metadata-eval15.7%
Simplified15.7%
Taylor expanded in i around 0 66.2%
*-commutative66.2%
associate-*r/66.2%
metadata-eval66.2%
Simplified66.2%
Taylor expanded in n around inf 65.7%
*-commutative65.7%
Simplified65.7%
Final simplification64.7%
(FPCore (i n) :precision binary64 (if (or (<= n -4.4e-234) (not (<= n 1.2e-142))) (+ (* i -50.0) (* n (+ 100.0 (* i 50.0)))) (/ 0.0 (/ i n))))
double code(double i, double n) {
double tmp;
if ((n <= -4.4e-234) || !(n <= 1.2e-142)) {
tmp = (i * -50.0) + (n * (100.0 + (i * 50.0)));
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-4.4d-234)) .or. (.not. (n <= 1.2d-142))) then
tmp = (i * (-50.0d0)) + (n * (100.0d0 + (i * 50.0d0)))
else
tmp = 0.0d0 / (i / n)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -4.4e-234) || !(n <= 1.2e-142)) {
tmp = (i * -50.0) + (n * (100.0 + (i * 50.0)));
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -4.4e-234) or not (n <= 1.2e-142): tmp = (i * -50.0) + (n * (100.0 + (i * 50.0))) else: tmp = 0.0 / (i / n) return tmp
function code(i, n) tmp = 0.0 if ((n <= -4.4e-234) || !(n <= 1.2e-142)) tmp = Float64(Float64(i * -50.0) + Float64(n * Float64(100.0 + Float64(i * 50.0)))); else tmp = Float64(0.0 / Float64(i / n)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -4.4e-234) || ~((n <= 1.2e-142))) tmp = (i * -50.0) + (n * (100.0 + (i * 50.0))); else tmp = 0.0 / (i / n); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -4.4e-234], N[Not[LessEqual[n, 1.2e-142]], $MachinePrecision]], N[(N[(i * -50.0), $MachinePrecision] + N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -4.4 \cdot 10^{-234} \lor \neg \left(n \leq 1.2 \cdot 10^{-142}\right):\\
\;\;\;\;i \cdot -50 + n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -4.3999999999999998e-234 or 1.19999999999999994e-142 < n Initial program 21.2%
associate-/r/21.5%
associate-*r*21.5%
*-commutative21.5%
associate-*r/21.5%
sub-neg21.5%
distribute-lft-in21.5%
metadata-eval21.5%
metadata-eval21.5%
metadata-eval21.5%
fma-define21.5%
metadata-eval21.5%
Simplified21.5%
Taylor expanded in i around 0 61.4%
*-commutative61.4%
associate-*r/61.4%
metadata-eval61.4%
Simplified61.4%
Taylor expanded in n around 0 61.4%
if -4.3999999999999998e-234 < n < 1.19999999999999994e-142Initial program 55.3%
associate-*r/55.3%
sub-neg55.3%
distribute-rgt-in55.3%
metadata-eval55.3%
metadata-eval55.3%
Simplified55.3%
Taylor expanded in i around inf 55.1%
Taylor expanded in n around 0 72.4%
Final simplification63.4%
(FPCore (i n) :precision binary64 (if (or (<= n -2e-24) (not (<= n 1.4e+17))) (* 100.0 (/ (* i n) i)) (* 100.0 (/ i (/ i n)))))
double code(double i, double n) {
double tmp;
if ((n <= -2e-24) || !(n <= 1.4e+17)) {
tmp = 100.0 * ((i * n) / i);
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-2d-24)) .or. (.not. (n <= 1.4d+17))) then
tmp = 100.0d0 * ((i * n) / i)
else
tmp = 100.0d0 * (i / (i / n))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -2e-24) || !(n <= 1.4e+17)) {
tmp = 100.0 * ((i * n) / i);
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -2e-24) or not (n <= 1.4e+17): tmp = 100.0 * ((i * n) / i) else: tmp = 100.0 * (i / (i / n)) return tmp
function code(i, n) tmp = 0.0 if ((n <= -2e-24) || !(n <= 1.4e+17)) tmp = Float64(100.0 * Float64(Float64(i * n) / i)); else tmp = Float64(100.0 * Float64(i / Float64(i / n))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -2e-24) || ~((n <= 1.4e+17))) tmp = 100.0 * ((i * n) / i); else tmp = 100.0 * (i / (i / n)); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -2e-24], N[Not[LessEqual[n, 1.4e+17]], $MachinePrecision]], N[(100.0 * N[(N[(i * n), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2 \cdot 10^{-24} \lor \neg \left(n \leq 1.4 \cdot 10^{+17}\right):\\
\;\;\;\;100 \cdot \frac{i \cdot n}{i}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -1.99999999999999985e-24 or 1.4e17 < n Initial program 20.9%
associate-/r/21.3%
associate-*r*21.3%
*-commutative21.3%
associate-*r/21.3%
sub-neg21.3%
distribute-lft-in21.3%
metadata-eval21.3%
metadata-eval21.3%
metadata-eval21.3%
fma-define21.3%
metadata-eval21.3%
Simplified21.3%
fma-undefine21.3%
metadata-eval21.3%
metadata-eval21.3%
distribute-lft-in21.3%
sub-neg21.3%
*-commutative21.3%
add-exp-log21.3%
expm1-define21.3%
log-pow14.7%
log1p-define70.1%
Applied egg-rr70.1%
Taylor expanded in n around inf 39.0%
expm1-define92.2%
Simplified92.2%
Taylor expanded in i around 0 65.8%
*-commutative65.8%
Simplified65.8%
if -1.99999999999999985e-24 < n < 1.4e17Initial program 37.5%
Taylor expanded in i around 0 55.6%
Final simplification61.8%
(FPCore (i n) :precision binary64 (if (or (<= n -5e-19) (not (<= n 2e-20))) (* n 100.0) (* 100.0 (/ i (/ i n)))))
double code(double i, double n) {
double tmp;
if ((n <= -5e-19) || !(n <= 2e-20)) {
tmp = n * 100.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 <= (-5d-19)) .or. (.not. (n <= 2d-20))) then
tmp = n * 100.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 <= -5e-19) || !(n <= 2e-20)) {
tmp = n * 100.0;
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -5e-19) or not (n <= 2e-20): tmp = n * 100.0 else: tmp = 100.0 * (i / (i / n)) return tmp
function code(i, n) tmp = 0.0 if ((n <= -5e-19) || !(n <= 2e-20)) tmp = Float64(n * 100.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 <= -5e-19) || ~((n <= 2e-20))) tmp = n * 100.0; else tmp = 100.0 * (i / (i / n)); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -5e-19], N[Not[LessEqual[n, 2e-20]], $MachinePrecision]], N[(n * 100.0), $MachinePrecision], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -5 \cdot 10^{-19} \lor \neg \left(n \leq 2 \cdot 10^{-20}\right):\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -5.0000000000000004e-19 or 1.99999999999999989e-20 < n Initial program 21.5%
associate-/r/21.9%
associate-*r*21.9%
*-commutative21.9%
associate-*r/21.9%
sub-neg21.9%
distribute-lft-in21.9%
metadata-eval21.9%
metadata-eval21.9%
metadata-eval21.9%
fma-define21.9%
metadata-eval21.9%
Simplified21.9%
Taylor expanded in i around 0 57.7%
*-commutative57.7%
Simplified57.7%
if -5.0000000000000004e-19 < n < 1.99999999999999989e-20Initial program 37.3%
Taylor expanded in i around 0 55.2%
Final simplification56.8%
(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 27.4%
associate-/r/27.6%
associate-*r*27.6%
*-commutative27.6%
associate-*r/27.6%
sub-neg27.6%
distribute-lft-in27.6%
metadata-eval27.6%
metadata-eval27.6%
metadata-eval27.6%
fma-define27.6%
metadata-eval27.6%
Simplified27.6%
Taylor expanded in i around 0 48.0%
*-commutative48.0%
Simplified48.0%
(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 27.4%
associate-/r/27.6%
associate-*r*27.6%
*-commutative27.6%
associate-*r/27.6%
sub-neg27.6%
distribute-lft-in27.6%
metadata-eval27.6%
metadata-eval27.6%
metadata-eval27.6%
fma-define27.6%
metadata-eval27.6%
Simplified27.6%
Taylor expanded in i around 0 52.5%
*-commutative52.5%
associate-*r/52.5%
metadata-eval52.5%
Simplified52.5%
Taylor expanded in n around 0 2.9%
*-commutative2.9%
Simplified2.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 2024185
(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))))