
(FPCore (i n) :precision binary64 (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))
double code(double i, double n) {
return 100.0 * ((pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 100.0d0 * ((((1.0d0 + (i / n)) ** n) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
return 100.0 * ((Math.pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
def code(i, n): return 100.0 * ((math.pow((1.0 + (i / n)), n) - 1.0) / (i / n))
function code(i, n) return Float64(100.0 * Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) - 1.0) / Float64(i / n))) end
function tmp = code(i, n) tmp = 100.0 * ((((1.0 + (i / n)) ^ n) - 1.0) / (i / n)); end
code[i_, n_] := N[(100.0 * N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (i n) :precision binary64 (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))
double code(double i, double n) {
return 100.0 * ((pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 100.0d0 * ((((1.0d0 + (i / n)) ** n) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
return 100.0 * ((Math.pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
def code(i, n): return 100.0 * ((math.pow((1.0 + (i / n)), n) - 1.0) / (i / n))
function code(i, n) return Float64(100.0 * Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) - 1.0) / Float64(i / n))) end
function tmp = code(i, n) tmp = 100.0 * ((((1.0 + (i / n)) ^ n) - 1.0) / (i / n)); end
code[i_, n_] := N[(100.0 * N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}
\end{array}
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n))
(t_1 (fma t_0 100.0 -100.0))
(t_2 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_2 -1e-13)
(* n (/ t_1 i))
(if (<= t_2 0.0)
(* 100.0 (/ (expm1 (* n (log1p (/ i n)))) (/ i n)))
(if (<= t_2 INFINITY) (* t_1 (/ n i)) (* n 100.0))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = fma(t_0, 100.0, -100.0);
double t_2 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_2 <= -1e-13) {
tmp = n * (t_1 / i);
} else if (t_2 <= 0.0) {
tmp = 100.0 * (expm1((n * log1p((i / n)))) / (i / n));
} else if (t_2 <= ((double) INFINITY)) {
tmp = t_1 * (n / i);
} else {
tmp = n * 100.0;
}
return tmp;
}
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = fma(t_0, 100.0, -100.0) t_2 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_2 <= -1e-13) tmp = Float64(n * Float64(t_1 / i)); elseif (t_2 <= 0.0) tmp = Float64(100.0 * Float64(expm1(Float64(n * log1p(Float64(i / n)))) / Float64(i / n))); elseif (t_2 <= Inf) tmp = Float64(t_1 * Float64(n / i)); else tmp = Float64(n * 100.0); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * 100.0 + -100.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e-13], N[(n * N[(t$95$1 / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.0], N[(100.0 * N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[(t$95$1 * N[(n / i), $MachinePrecision]), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \mathsf{fma}\left(t\_0, 100, -100\right)\\
t_2 := \frac{t\_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{-13}:\\
\;\;\;\;n \cdot \frac{t\_1}{i}\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{\frac{i}{n}}\\
\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;t\_1 \cdot \frac{n}{i}\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\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-13Initial program 99.6%
lift-/.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift--.f64N/A
*-rgt-identityN/A
lift-/.f64N/A
associate-*r/N/A
div-invN/A
associate-*r/N/A
lift-/.f64N/A
associate-/r/N/A
lower-*.f64N/A
Applied egg-rr100.0%
if -1e-13 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 0.0Initial program 25.1%
lift-/.f64N/A
lift-+.f64N/A
pow-to-expN/A
lower-expm1.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
lower-log1p.f6499.8
Applied egg-rr99.8%
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 97.9%
lift-/.f64N/A
lift-+.f64N/A
sqr-powN/A
sqr-powN/A
lift-pow.f64N/A
lift--.f64N/A
*-rgt-identityN/A
lift-/.f64N/A
associate-*r/N/A
lift-/.f64N/A
clear-numN/A
associate-*r*N/A
lower-*.f64N/A
Applied egg-rr98.0%
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%
lift-/.f64N/A
lift-+.f64N/A
pow-to-expN/A
lower-expm1.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
lower-log1p.f640.0
Applied egg-rr0.0%
Taylor expanded in n around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-expm1.f6472.6
Simplified72.6%
Taylor expanded in i around 0
lower-*.f6473.8
Simplified73.8%
Final simplification94.2%
(FPCore (i n)
:precision binary64
(if (<= i -4.6e+194)
(* (/ (+ (pow (+ 1.0 (/ i n)) n) -1.0) (/ i n)) 100.0)
(if (<= i 3.8e+37)
(* (* n 100.0) (/ (expm1 i) i))
(if (<= i 7.6e+140)
(* 100.0 (/ (- (* n (pow (/ i n) n)) n) i))
(fma (pow (/ i n) (+ n -1.0)) 100.0 (* (/ n i) (- 100.0)))))))
double code(double i, double n) {
double tmp;
if (i <= -4.6e+194) {
tmp = ((pow((1.0 + (i / n)), n) + -1.0) / (i / n)) * 100.0;
} else if (i <= 3.8e+37) {
tmp = (n * 100.0) * (expm1(i) / i);
} else if (i <= 7.6e+140) {
tmp = 100.0 * (((n * pow((i / n), n)) - n) / i);
} else {
tmp = fma(pow((i / n), (n + -1.0)), 100.0, ((n / i) * -100.0));
}
return tmp;
}
function code(i, n) tmp = 0.0 if (i <= -4.6e+194) tmp = Float64(Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0) / Float64(i / n)) * 100.0); elseif (i <= 3.8e+37) tmp = Float64(Float64(n * 100.0) * Float64(expm1(i) / i)); elseif (i <= 7.6e+140) tmp = Float64(100.0 * Float64(Float64(Float64(n * (Float64(i / n) ^ n)) - n) / i)); else tmp = fma((Float64(i / n) ^ Float64(n + -1.0)), 100.0, Float64(Float64(n / i) * Float64(-100.0))); end return tmp end
code[i_, n_] := If[LessEqual[i, -4.6e+194], N[(N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision] * 100.0), $MachinePrecision], If[LessEqual[i, 3.8e+37], N[(N[(n * 100.0), $MachinePrecision] * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 7.6e+140], N[(100.0 * N[(N[(N[(n * N[Power[N[(i / n), $MachinePrecision], n], $MachinePrecision]), $MachinePrecision] - n), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(i / n), $MachinePrecision], N[(n + -1.0), $MachinePrecision]], $MachinePrecision] * 100.0 + N[(N[(n / i), $MachinePrecision] * (-100.0)), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -4.6 \cdot 10^{+194}:\\
\;\;\;\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}} \cdot 100\\
\mathbf{elif}\;i \leq 3.8 \cdot 10^{+37}:\\
\;\;\;\;\left(n \cdot 100\right) \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\\
\mathbf{elif}\;i \leq 7.6 \cdot 10^{+140}:\\
\;\;\;\;100 \cdot \frac{n \cdot {\left(\frac{i}{n}\right)}^{n} - n}{i}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left({\left(\frac{i}{n}\right)}^{\left(n + -1\right)}, 100, \frac{n}{i} \cdot \left(-100\right)\right)\\
\end{array}
\end{array}
if i < -4.6000000000000001e194Initial program 99.2%
if -4.6000000000000001e194 < i < 3.7999999999999999e37Initial program 15.9%
lift-/.f64N/A
lift-+.f64N/A
pow-to-expN/A
lower-expm1.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
lower-log1p.f6478.6
Applied egg-rr78.6%
Taylor expanded in n around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-expm1.f6481.4
Simplified81.4%
if 3.7999999999999999e37 < i < 7.6000000000000002e140Initial program 41.3%
lift-/.f64N/A
lift-+.f64N/A
sqr-powN/A
sqr-powN/A
lift-pow.f64N/A
lift--.f64N/A
*-rgt-identityN/A
lift-/.f64N/A
associate-*r/N/A
div-invN/A
lift--.f64N/A
div-subN/A
lift-/.f64N/A
clear-numN/A
lower--.f64N/A
Applied egg-rr41.0%
Taylor expanded in i around inf
lower-/.f6490.2
Simplified90.2%
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6490.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.3
Applied egg-rr90.3%
if 7.6000000000000002e140 < i Initial program 47.5%
lift-/.f64N/A
lift-+.f64N/A
sqr-powN/A
sqr-powN/A
lift-pow.f64N/A
lift--.f64N/A
*-rgt-identityN/A
lift-/.f64N/A
associate-*r/N/A
div-invN/A
lift--.f64N/A
div-subN/A
lift-/.f64N/A
clear-numN/A
lower--.f64N/A
Applied egg-rr48.3%
Taylor expanded in i around inf
lower-/.f6448.3
Simplified48.3%
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
sub-negN/A
distribute-rgt-inN/A
lower-fma.f64N/A
Applied egg-rr83.4%
Final simplification83.5%
(FPCore (i n)
:precision binary64
(if (<= i -4.6e+194)
(* n (/ (fma (pow (+ 1.0 (/ i n)) n) 100.0 -100.0) i))
(if (<= i 3.8e+37)
(* (* n 100.0) (/ (expm1 i) i))
(if (<= i 7.6e+140)
(* 100.0 (/ (- (* n (pow (/ i n) n)) n) i))
(fma (pow (/ i n) (+ n -1.0)) 100.0 (* (/ n i) (- 100.0)))))))
double code(double i, double n) {
double tmp;
if (i <= -4.6e+194) {
tmp = n * (fma(pow((1.0 + (i / n)), n), 100.0, -100.0) / i);
} else if (i <= 3.8e+37) {
tmp = (n * 100.0) * (expm1(i) / i);
} else if (i <= 7.6e+140) {
tmp = 100.0 * (((n * pow((i / n), n)) - n) / i);
} else {
tmp = fma(pow((i / n), (n + -1.0)), 100.0, ((n / i) * -100.0));
}
return tmp;
}
function code(i, n) tmp = 0.0 if (i <= -4.6e+194) tmp = Float64(n * Float64(fma((Float64(1.0 + Float64(i / n)) ^ n), 100.0, -100.0) / i)); elseif (i <= 3.8e+37) tmp = Float64(Float64(n * 100.0) * Float64(expm1(i) / i)); elseif (i <= 7.6e+140) tmp = Float64(100.0 * Float64(Float64(Float64(n * (Float64(i / n) ^ n)) - n) / i)); else tmp = fma((Float64(i / n) ^ Float64(n + -1.0)), 100.0, Float64(Float64(n / i) * Float64(-100.0))); end return tmp end
code[i_, n_] := If[LessEqual[i, -4.6e+194], N[(n * N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] * 100.0 + -100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 3.8e+37], N[(N[(n * 100.0), $MachinePrecision] * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 7.6e+140], N[(100.0 * N[(N[(N[(n * N[Power[N[(i / n), $MachinePrecision], n], $MachinePrecision]), $MachinePrecision] - n), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(i / n), $MachinePrecision], N[(n + -1.0), $MachinePrecision]], $MachinePrecision] * 100.0 + N[(N[(n / i), $MachinePrecision] * (-100.0)), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -4.6 \cdot 10^{+194}:\\
\;\;\;\;n \cdot \frac{\mathsf{fma}\left({\left(1 + \frac{i}{n}\right)}^{n}, 100, -100\right)}{i}\\
\mathbf{elif}\;i \leq 3.8 \cdot 10^{+37}:\\
\;\;\;\;\left(n \cdot 100\right) \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\\
\mathbf{elif}\;i \leq 7.6 \cdot 10^{+140}:\\
\;\;\;\;100 \cdot \frac{n \cdot {\left(\frac{i}{n}\right)}^{n} - n}{i}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left({\left(\frac{i}{n}\right)}^{\left(n + -1\right)}, 100, \frac{n}{i} \cdot \left(-100\right)\right)\\
\end{array}
\end{array}
if i < -4.6000000000000001e194Initial program 99.2%
lift-/.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift--.f64N/A
*-rgt-identityN/A
lift-/.f64N/A
associate-*r/N/A
div-invN/A
associate-*r/N/A
lift-/.f64N/A
associate-/r/N/A
lower-*.f64N/A
Applied egg-rr94.3%
if -4.6000000000000001e194 < i < 3.7999999999999999e37Initial program 15.9%
lift-/.f64N/A
lift-+.f64N/A
pow-to-expN/A
lower-expm1.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
lower-log1p.f6478.6
Applied egg-rr78.6%
Taylor expanded in n around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-expm1.f6481.4
Simplified81.4%
if 3.7999999999999999e37 < i < 7.6000000000000002e140Initial program 41.3%
lift-/.f64N/A
lift-+.f64N/A
sqr-powN/A
sqr-powN/A
lift-pow.f64N/A
lift--.f64N/A
*-rgt-identityN/A
lift-/.f64N/A
associate-*r/N/A
div-invN/A
lift--.f64N/A
div-subN/A
lift-/.f64N/A
clear-numN/A
lower--.f64N/A
Applied egg-rr41.0%
Taylor expanded in i around inf
lower-/.f6490.2
Simplified90.2%
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6490.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.3
Applied egg-rr90.3%
if 7.6000000000000002e140 < i Initial program 47.5%
lift-/.f64N/A
lift-+.f64N/A
sqr-powN/A
sqr-powN/A
lift-pow.f64N/A
lift--.f64N/A
*-rgt-identityN/A
lift-/.f64N/A
associate-*r/N/A
div-invN/A
lift--.f64N/A
div-subN/A
lift-/.f64N/A
clear-numN/A
lower--.f64N/A
Applied egg-rr48.3%
Taylor expanded in i around inf
lower-/.f6448.3
Simplified48.3%
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
sub-negN/A
distribute-rgt-inN/A
lower-fma.f64N/A
Applied egg-rr83.4%
Final simplification83.2%
(FPCore (i n)
:precision binary64
(if (<= i -4.6e+194)
(* n (/ (fma (pow (+ 1.0 (/ i n)) n) 100.0 -100.0) i))
(if (<= i 3.8e+37)
(* (* n 100.0) (/ (expm1 i) i))
(if (<= i 7.5e+140)
(* 100.0 (/ (- (* n (pow (/ i n) n)) n) i))
(* 100.0 (- (pow (/ i n) (+ n -1.0)) (/ n i)))))))
double code(double i, double n) {
double tmp;
if (i <= -4.6e+194) {
tmp = n * (fma(pow((1.0 + (i / n)), n), 100.0, -100.0) / i);
} else if (i <= 3.8e+37) {
tmp = (n * 100.0) * (expm1(i) / i);
} else if (i <= 7.5e+140) {
tmp = 100.0 * (((n * pow((i / n), n)) - n) / i);
} else {
tmp = 100.0 * (pow((i / n), (n + -1.0)) - (n / i));
}
return tmp;
}
function code(i, n) tmp = 0.0 if (i <= -4.6e+194) tmp = Float64(n * Float64(fma((Float64(1.0 + Float64(i / n)) ^ n), 100.0, -100.0) / i)); elseif (i <= 3.8e+37) tmp = Float64(Float64(n * 100.0) * Float64(expm1(i) / i)); elseif (i <= 7.5e+140) tmp = Float64(100.0 * Float64(Float64(Float64(n * (Float64(i / n) ^ n)) - n) / i)); else tmp = Float64(100.0 * Float64((Float64(i / n) ^ Float64(n + -1.0)) - Float64(n / i))); end return tmp end
code[i_, n_] := If[LessEqual[i, -4.6e+194], N[(n * N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] * 100.0 + -100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 3.8e+37], N[(N[(n * 100.0), $MachinePrecision] * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 7.5e+140], N[(100.0 * N[(N[(N[(n * N[Power[N[(i / n), $MachinePrecision], n], $MachinePrecision]), $MachinePrecision] - n), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(N[Power[N[(i / n), $MachinePrecision], N[(n + -1.0), $MachinePrecision]], $MachinePrecision] - N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -4.6 \cdot 10^{+194}:\\
\;\;\;\;n \cdot \frac{\mathsf{fma}\left({\left(1 + \frac{i}{n}\right)}^{n}, 100, -100\right)}{i}\\
\mathbf{elif}\;i \leq 3.8 \cdot 10^{+37}:\\
\;\;\;\;\left(n \cdot 100\right) \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\\
\mathbf{elif}\;i \leq 7.5 \cdot 10^{+140}:\\
\;\;\;\;100 \cdot \frac{n \cdot {\left(\frac{i}{n}\right)}^{n} - n}{i}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left({\left(\frac{i}{n}\right)}^{\left(n + -1\right)} - \frac{n}{i}\right)\\
\end{array}
\end{array}
if i < -4.6000000000000001e194Initial program 99.2%
lift-/.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift--.f64N/A
*-rgt-identityN/A
lift-/.f64N/A
associate-*r/N/A
div-invN/A
associate-*r/N/A
lift-/.f64N/A
associate-/r/N/A
lower-*.f64N/A
Applied egg-rr94.3%
if -4.6000000000000001e194 < i < 3.7999999999999999e37Initial program 15.9%
lift-/.f64N/A
lift-+.f64N/A
pow-to-expN/A
lower-expm1.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
lower-log1p.f6478.6
Applied egg-rr78.6%
Taylor expanded in n around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-expm1.f6481.4
Simplified81.4%
if 3.7999999999999999e37 < i < 7.4999999999999997e140Initial program 41.3%
lift-/.f64N/A
lift-+.f64N/A
sqr-powN/A
sqr-powN/A
lift-pow.f64N/A
lift--.f64N/A
*-rgt-identityN/A
lift-/.f64N/A
associate-*r/N/A
div-invN/A
lift--.f64N/A
div-subN/A
lift-/.f64N/A
clear-numN/A
lower--.f64N/A
Applied egg-rr41.0%
Taylor expanded in i around inf
lower-/.f6490.2
Simplified90.2%
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6490.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.3
Applied egg-rr90.3%
if 7.4999999999999997e140 < i Initial program 47.5%
lift-/.f64N/A
lift-+.f64N/A
sqr-powN/A
sqr-powN/A
lift-pow.f64N/A
lift--.f64N/A
*-rgt-identityN/A
lift-/.f64N/A
associate-*r/N/A
div-invN/A
lift--.f64N/A
div-subN/A
lift-/.f64N/A
clear-numN/A
lower--.f64N/A
Applied egg-rr48.3%
Taylor expanded in i around inf
lower-/.f6448.3
Simplified48.3%
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f6448.3
Applied egg-rr83.3%
Final simplification83.2%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (/ (- (* n (pow (/ i n) n)) n) i))))
(if (<= i -3.5e+143)
t_0
(if (<= i 3.8e+37)
(* (* n 100.0) (/ (expm1 i) i))
(if (<= i 7.5e+140)
t_0
(* 100.0 (- (pow (/ i n) (+ n -1.0)) (/ n i))))))))
double code(double i, double n) {
double t_0 = 100.0 * (((n * pow((i / n), n)) - n) / i);
double tmp;
if (i <= -3.5e+143) {
tmp = t_0;
} else if (i <= 3.8e+37) {
tmp = (n * 100.0) * (expm1(i) / i);
} else if (i <= 7.5e+140) {
tmp = t_0;
} else {
tmp = 100.0 * (pow((i / n), (n + -1.0)) - (n / i));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = 100.0 * (((n * Math.pow((i / n), n)) - n) / i);
double tmp;
if (i <= -3.5e+143) {
tmp = t_0;
} else if (i <= 3.8e+37) {
tmp = (n * 100.0) * (Math.expm1(i) / i);
} else if (i <= 7.5e+140) {
tmp = t_0;
} else {
tmp = 100.0 * (Math.pow((i / n), (n + -1.0)) - (n / i));
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (((n * math.pow((i / n), n)) - n) / i) tmp = 0 if i <= -3.5e+143: tmp = t_0 elif i <= 3.8e+37: tmp = (n * 100.0) * (math.expm1(i) / i) elif i <= 7.5e+140: tmp = t_0 else: tmp = 100.0 * (math.pow((i / n), (n + -1.0)) - (n / i)) return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(Float64(Float64(n * (Float64(i / n) ^ n)) - n) / i)) tmp = 0.0 if (i <= -3.5e+143) tmp = t_0; elseif (i <= 3.8e+37) tmp = Float64(Float64(n * 100.0) * Float64(expm1(i) / i)); elseif (i <= 7.5e+140) tmp = t_0; else tmp = Float64(100.0 * Float64((Float64(i / n) ^ Float64(n + -1.0)) - Float64(n / i))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(N[(N[(n * N[Power[N[(i / n), $MachinePrecision], n], $MachinePrecision]), $MachinePrecision] - n), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[i, -3.5e+143], t$95$0, If[LessEqual[i, 3.8e+37], N[(N[(n * 100.0), $MachinePrecision] * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 7.5e+140], t$95$0, N[(100.0 * N[(N[Power[N[(i / n), $MachinePrecision], N[(n + -1.0), $MachinePrecision]], $MachinePrecision] - N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \frac{n \cdot {\left(\frac{i}{n}\right)}^{n} - n}{i}\\
\mathbf{if}\;i \leq -3.5 \cdot 10^{+143}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;i \leq 3.8 \cdot 10^{+37}:\\
\;\;\;\;\left(n \cdot 100\right) \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\\
\mathbf{elif}\;i \leq 7.5 \cdot 10^{+140}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left({\left(\frac{i}{n}\right)}^{\left(n + -1\right)} - \frac{n}{i}\right)\\
\end{array}
\end{array}
if i < -3.50000000000000008e143 or 3.7999999999999999e37 < i < 7.4999999999999997e140Initial program 68.6%
lift-/.f64N/A
lift-+.f64N/A
sqr-powN/A
sqr-powN/A
lift-pow.f64N/A
lift--.f64N/A
*-rgt-identityN/A
lift-/.f64N/A
associate-*r/N/A
div-invN/A
lift--.f64N/A
div-subN/A
lift-/.f64N/A
clear-numN/A
lower--.f64N/A
Applied egg-rr66.5%
Taylor expanded in i around inf
lower-/.f6493.3
Simplified93.3%
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6493.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f6493.4
Applied egg-rr93.4%
if -3.50000000000000008e143 < i < 3.7999999999999999e37Initial program 13.7%
lift-/.f64N/A
lift-+.f64N/A
pow-to-expN/A
lower-expm1.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
lower-log1p.f6477.7
Applied egg-rr77.7%
Taylor expanded in n around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-expm1.f6480.6
Simplified80.6%
if 7.4999999999999997e140 < i Initial program 47.5%
lift-/.f64N/A
lift-+.f64N/A
sqr-powN/A
sqr-powN/A
lift-pow.f64N/A
lift--.f64N/A
*-rgt-identityN/A
lift-/.f64N/A
associate-*r/N/A
div-invN/A
lift--.f64N/A
div-subN/A
lift-/.f64N/A
clear-numN/A
lower--.f64N/A
Applied egg-rr48.3%
Taylor expanded in i around inf
lower-/.f6448.3
Simplified48.3%
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f6448.3
Applied egg-rr83.3%
Final simplification83.2%
(FPCore (i n) :precision binary64 (if (<= i 9.2e+134) (* (* n 100.0) (/ (expm1 i) i)) (* 100.0 (- (pow (/ i n) (+ n -1.0)) (/ n i)))))
double code(double i, double n) {
double tmp;
if (i <= 9.2e+134) {
tmp = (n * 100.0) * (expm1(i) / i);
} else {
tmp = 100.0 * (pow((i / n), (n + -1.0)) - (n / i));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if (i <= 9.2e+134) {
tmp = (n * 100.0) * (Math.expm1(i) / i);
} else {
tmp = 100.0 * (Math.pow((i / n), (n + -1.0)) - (n / i));
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 9.2e+134: tmp = (n * 100.0) * (math.expm1(i) / i) else: tmp = 100.0 * (math.pow((i / n), (n + -1.0)) - (n / i)) return tmp
function code(i, n) tmp = 0.0 if (i <= 9.2e+134) tmp = Float64(Float64(n * 100.0) * Float64(expm1(i) / i)); else tmp = Float64(100.0 * Float64((Float64(i / n) ^ Float64(n + -1.0)) - Float64(n / i))); end return tmp end
code[i_, n_] := If[LessEqual[i, 9.2e+134], N[(N[(n * 100.0), $MachinePrecision] * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(N[Power[N[(i / n), $MachinePrecision], N[(n + -1.0), $MachinePrecision]], $MachinePrecision] - N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 9.2 \cdot 10^{+134}:\\
\;\;\;\;\left(n \cdot 100\right) \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left({\left(\frac{i}{n}\right)}^{\left(n + -1\right)} - \frac{n}{i}\right)\\
\end{array}
\end{array}
if i < 9.1999999999999992e134Initial program 24.4%
lift-/.f64N/A
lift-+.f64N/A
pow-to-expN/A
lower-expm1.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
lower-log1p.f6479.4
Applied egg-rr79.4%
Taylor expanded in n around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-expm1.f6478.0
Simplified78.0%
if 9.1999999999999992e134 < i Initial program 47.5%
lift-/.f64N/A
lift-+.f64N/A
sqr-powN/A
sqr-powN/A
lift-pow.f64N/A
lift--.f64N/A
*-rgt-identityN/A
lift-/.f64N/A
associate-*r/N/A
div-invN/A
lift--.f64N/A
div-subN/A
lift-/.f64N/A
clear-numN/A
lower--.f64N/A
Applied egg-rr48.3%
Taylor expanded in i around inf
lower-/.f6448.3
Simplified48.3%
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f6448.3
Applied egg-rr83.3%
Final simplification78.6%
(FPCore (i n)
:precision binary64
(let* ((t_0 (/ (expm1 i) i)))
(if (<= n -2.3e-219)
(* n (* 100.0 t_0))
(if (<= n 1.05e-33)
(* 100.0 (/ (+ 1.0 -1.0) (/ i n)))
(* (* n 100.0) t_0)))))
double code(double i, double n) {
double t_0 = expm1(i) / i;
double tmp;
if (n <= -2.3e-219) {
tmp = n * (100.0 * t_0);
} else if (n <= 1.05e-33) {
tmp = 100.0 * ((1.0 + -1.0) / (i / n));
} else {
tmp = (n * 100.0) * t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.expm1(i) / i;
double tmp;
if (n <= -2.3e-219) {
tmp = n * (100.0 * t_0);
} else if (n <= 1.05e-33) {
tmp = 100.0 * ((1.0 + -1.0) / (i / n));
} else {
tmp = (n * 100.0) * t_0;
}
return tmp;
}
def code(i, n): t_0 = math.expm1(i) / i tmp = 0 if n <= -2.3e-219: tmp = n * (100.0 * t_0) elif n <= 1.05e-33: tmp = 100.0 * ((1.0 + -1.0) / (i / n)) else: tmp = (n * 100.0) * t_0 return tmp
function code(i, n) t_0 = Float64(expm1(i) / i) tmp = 0.0 if (n <= -2.3e-219) tmp = Float64(n * Float64(100.0 * t_0)); elseif (n <= 1.05e-33) tmp = Float64(100.0 * Float64(Float64(1.0 + -1.0) / Float64(i / n))); else tmp = Float64(Float64(n * 100.0) * t_0); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]}, If[LessEqual[n, -2.3e-219], N[(n * N[(100.0 * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.05e-33], N[(100.0 * N[(N[(1.0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(n * 100.0), $MachinePrecision] * t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{expm1}\left(i\right)}{i}\\
\mathbf{if}\;n \leq -2.3 \cdot 10^{-219}:\\
\;\;\;\;n \cdot \left(100 \cdot t\_0\right)\\
\mathbf{elif}\;n \leq 1.05 \cdot 10^{-33}:\\
\;\;\;\;100 \cdot \frac{1 + -1}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;\left(n \cdot 100\right) \cdot t\_0\\
\end{array}
\end{array}
if n < -2.29999999999999988e-219Initial program 26.5%
lift-/.f64N/A
lift-+.f64N/A
pow-to-expN/A
lower-expm1.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
lower-log1p.f6473.8
Applied egg-rr73.8%
Taylor expanded in n around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-expm1.f6478.9
Simplified78.9%
lift-*.f64N/A
lift-expm1.f64N/A
lift-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6478.9
Applied egg-rr78.9%
if -2.29999999999999988e-219 < n < 1.05e-33Initial program 36.9%
Taylor expanded in i around 0
Simplified62.7%
if 1.05e-33 < n Initial program 21.0%
lift-/.f64N/A
lift-+.f64N/A
pow-to-expN/A
lower-expm1.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
lower-log1p.f6474.6
Applied egg-rr74.6%
Taylor expanded in n around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-expm1.f6492.0
Simplified92.0%
Final simplification79.1%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* (* n 100.0) (/ (expm1 i) i))))
(if (<= n -2.3e-219)
t_0
(if (<= n 1.05e-33) (* 100.0 (/ (+ 1.0 -1.0) (/ i n))) t_0))))
double code(double i, double n) {
double t_0 = (n * 100.0) * (expm1(i) / i);
double tmp;
if (n <= -2.3e-219) {
tmp = t_0;
} else if (n <= 1.05e-33) {
tmp = 100.0 * ((1.0 + -1.0) / (i / n));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = (n * 100.0) * (Math.expm1(i) / i);
double tmp;
if (n <= -2.3e-219) {
tmp = t_0;
} else if (n <= 1.05e-33) {
tmp = 100.0 * ((1.0 + -1.0) / (i / n));
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = (n * 100.0) * (math.expm1(i) / i) tmp = 0 if n <= -2.3e-219: tmp = t_0 elif n <= 1.05e-33: tmp = 100.0 * ((1.0 + -1.0) / (i / n)) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(Float64(n * 100.0) * Float64(expm1(i) / i)) tmp = 0.0 if (n <= -2.3e-219) tmp = t_0; elseif (n <= 1.05e-33) tmp = Float64(100.0 * Float64(Float64(1.0 + -1.0) / Float64(i / n))); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[(n * 100.0), $MachinePrecision] * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -2.3e-219], t$95$0, If[LessEqual[n, 1.05e-33], N[(100.0 * N[(N[(1.0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(n \cdot 100\right) \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\\
\mathbf{if}\;n \leq -2.3 \cdot 10^{-219}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 1.05 \cdot 10^{-33}:\\
\;\;\;\;100 \cdot \frac{1 + -1}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -2.29999999999999988e-219 or 1.05e-33 < n Initial program 24.4%
lift-/.f64N/A
lift-+.f64N/A
pow-to-expN/A
lower-expm1.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
lower-log1p.f6474.1
Applied egg-rr74.1%
Taylor expanded in n around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-expm1.f6483.9
Simplified83.9%
if -2.29999999999999988e-219 < n < 1.05e-33Initial program 36.9%
Taylor expanded in i around 0
Simplified62.7%
Final simplification79.1%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (/ (* n (expm1 i)) i))))
(if (<= n -4.2e-128)
t_0
(if (<= n 1.05e-33) (* 100.0 (/ (+ 1.0 -1.0) (/ i n))) t_0))))
double code(double i, double n) {
double t_0 = 100.0 * ((n * expm1(i)) / i);
double tmp;
if (n <= -4.2e-128) {
tmp = t_0;
} else if (n <= 1.05e-33) {
tmp = 100.0 * ((1.0 + -1.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 <= -4.2e-128) {
tmp = t_0;
} else if (n <= 1.05e-33) {
tmp = 100.0 * ((1.0 + -1.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 <= -4.2e-128: tmp = t_0 elif n <= 1.05e-33: tmp = 100.0 * ((1.0 + -1.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 <= -4.2e-128) tmp = t_0; elseif (n <= 1.05e-33) tmp = Float64(100.0 * Float64(Float64(1.0 + -1.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, -4.2e-128], t$95$0, If[LessEqual[n, 1.05e-33], N[(100.0 * N[(N[(1.0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $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 -4.2 \cdot 10^{-128}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 1.05 \cdot 10^{-33}:\\
\;\;\;\;100 \cdot \frac{1 + -1}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -4.2000000000000002e-128 or 1.05e-33 < n Initial program 22.5%
lift-/.f64N/A
lift-+.f64N/A
pow-to-expN/A
lower-expm1.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
lower-log1p.f6472.6
Applied egg-rr72.6%
Taylor expanded in n around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-expm1.f6483.0
Simplified83.0%
if -4.2000000000000002e-128 < n < 1.05e-33Initial program 40.0%
Taylor expanded in i around 0
Simplified61.8%
Final simplification77.3%
(FPCore (i n)
:precision binary64
(if (<= i -1.9)
(* (/ n i) (- 100.0))
(if (<= i 7.6e+140)
(*
(* n 100.0)
(/
(fma
(fma i (fma i 0.041666666666666664 0.16666666666666666) 0.5)
(* i i)
i)
i))
(* 100.0 (fma (/ i (* i i)) n (- (/ n i)))))))
double code(double i, double n) {
double tmp;
if (i <= -1.9) {
tmp = (n / i) * -100.0;
} else if (i <= 7.6e+140) {
tmp = (n * 100.0) * (fma(fma(i, fma(i, 0.041666666666666664, 0.16666666666666666), 0.5), (i * i), i) / i);
} else {
tmp = 100.0 * fma((i / (i * i)), n, -(n / i));
}
return tmp;
}
function code(i, n) tmp = 0.0 if (i <= -1.9) tmp = Float64(Float64(n / i) * Float64(-100.0)); elseif (i <= 7.6e+140) tmp = Float64(Float64(n * 100.0) * Float64(fma(fma(i, fma(i, 0.041666666666666664, 0.16666666666666666), 0.5), Float64(i * i), i) / i)); else tmp = Float64(100.0 * fma(Float64(i / Float64(i * i)), n, Float64(-Float64(n / i)))); end return tmp end
code[i_, n_] := If[LessEqual[i, -1.9], N[(N[(n / i), $MachinePrecision] * (-100.0)), $MachinePrecision], If[LessEqual[i, 7.6e+140], N[(N[(n * 100.0), $MachinePrecision] * N[(N[(N[(i * N[(i * 0.041666666666666664 + 0.16666666666666666), $MachinePrecision] + 0.5), $MachinePrecision] * N[(i * i), $MachinePrecision] + i), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(N[(i / N[(i * i), $MachinePrecision]), $MachinePrecision] * n + (-N[(n / i), $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -1.9:\\
\;\;\;\;\frac{n}{i} \cdot \left(-100\right)\\
\mathbf{elif}\;i \leq 7.6 \cdot 10^{+140}:\\
\;\;\;\;\left(n \cdot 100\right) \cdot \frac{\mathsf{fma}\left(\mathsf{fma}\left(i, \mathsf{fma}\left(i, 0.041666666666666664, 0.16666666666666666\right), 0.5\right), i \cdot i, i\right)}{i}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \mathsf{fma}\left(\frac{i}{i \cdot i}, n, -\frac{n}{i}\right)\\
\end{array}
\end{array}
if i < -1.8999999999999999Initial program 62.2%
lift-/.f64N/A
lift-+.f64N/A
sqr-powN/A
sqr-powN/A
lift-pow.f64N/A
lift--.f64N/A
*-rgt-identityN/A
lift-/.f64N/A
associate-*r/N/A
div-invN/A
lift--.f64N/A
div-subN/A
lift-/.f64N/A
clear-numN/A
lower--.f64N/A
Applied egg-rr59.4%
Taylor expanded in i around inf
lower-/.f6472.1
Simplified72.1%
Taylor expanded in n around inf
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6467.7
Simplified67.7%
if -1.8999999999999999 < i < 7.6000000000000002e140Initial program 15.0%
lift-/.f64N/A
lift-+.f64N/A
pow-to-expN/A
lower-expm1.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
lower-log1p.f6476.6
Applied egg-rr76.6%
Taylor expanded in n around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-expm1.f6480.6
Simplified80.6%
Taylor expanded in i around 0
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
*-commutativeN/A
associate-*l*N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6477.4
Simplified77.4%
if 7.6000000000000002e140 < i Initial program 47.5%
lift-/.f64N/A
lift-+.f64N/A
sqr-powN/A
sqr-powN/A
lift-pow.f64N/A
lift--.f64N/A
*-rgt-identityN/A
lift-/.f64N/A
associate-*r/N/A
div-invN/A
lift--.f64N/A
div-subN/A
lift-/.f64N/A
clear-numN/A
frac-subN/A
lower-/.f64N/A
Applied egg-rr7.8%
Taylor expanded in i around 0
Simplified1.7%
Applied egg-rr60.7%
Final simplification73.7%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* (/ n i) (- 100.0))))
(if (<= i -1.9)
t_0
(if (<= i 5e+154)
(*
(* n 100.0)
(/
(fma
(fma i (fma i 0.041666666666666664 0.16666666666666666) 0.5)
(* i i)
i)
i))
t_0))))
double code(double i, double n) {
double t_0 = (n / i) * -100.0;
double tmp;
if (i <= -1.9) {
tmp = t_0;
} else if (i <= 5e+154) {
tmp = (n * 100.0) * (fma(fma(i, fma(i, 0.041666666666666664, 0.16666666666666666), 0.5), (i * i), i) / i);
} else {
tmp = t_0;
}
return tmp;
}
function code(i, n) t_0 = Float64(Float64(n / i) * Float64(-100.0)) tmp = 0.0 if (i <= -1.9) tmp = t_0; elseif (i <= 5e+154) tmp = Float64(Float64(n * 100.0) * Float64(fma(fma(i, fma(i, 0.041666666666666664, 0.16666666666666666), 0.5), Float64(i * i), i) / i)); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[(n / i), $MachinePrecision] * (-100.0)), $MachinePrecision]}, If[LessEqual[i, -1.9], t$95$0, If[LessEqual[i, 5e+154], N[(N[(n * 100.0), $MachinePrecision] * N[(N[(N[(i * N[(i * 0.041666666666666664 + 0.16666666666666666), $MachinePrecision] + 0.5), $MachinePrecision] * N[(i * i), $MachinePrecision] + i), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{n}{i} \cdot \left(-100\right)\\
\mathbf{if}\;i \leq -1.9:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;i \leq 5 \cdot 10^{+154}:\\
\;\;\;\;\left(n \cdot 100\right) \cdot \frac{\mathsf{fma}\left(\mathsf{fma}\left(i, \mathsf{fma}\left(i, 0.041666666666666664, 0.16666666666666666\right), 0.5\right), i \cdot i, i\right)}{i}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if i < -1.8999999999999999 or 5.00000000000000004e154 < i Initial program 56.5%
lift-/.f64N/A
lift-+.f64N/A
sqr-powN/A
sqr-powN/A
lift-pow.f64N/A
lift--.f64N/A
*-rgt-identityN/A
lift-/.f64N/A
associate-*r/N/A
div-invN/A
lift--.f64N/A
div-subN/A
lift-/.f64N/A
clear-numN/A
lower--.f64N/A
Applied egg-rr55.1%
Taylor expanded in i around inf
lower-/.f6463.1
Simplified63.1%
Taylor expanded in n around inf
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6465.6
Simplified65.6%
if -1.8999999999999999 < i < 5.00000000000000004e154Initial program 15.8%
lift-/.f64N/A
lift-+.f64N/A
pow-to-expN/A
lower-expm1.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
lower-log1p.f6476.0
Applied egg-rr76.0%
Taylor expanded in n around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-expm1.f6479.9
Simplified79.9%
Taylor expanded in i around 0
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
*-commutativeN/A
associate-*l*N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6476.8
Simplified76.8%
Final simplification73.7%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* (/ n i) (- 100.0))))
(if (<= i -1.9)
t_0
(if (<= i 5e+154)
(fma
100.0
n
(* (* i n) (fma i (fma i 4.166666666666667 16.666666666666668) 50.0)))
t_0))))
double code(double i, double n) {
double t_0 = (n / i) * -100.0;
double tmp;
if (i <= -1.9) {
tmp = t_0;
} else if (i <= 5e+154) {
tmp = fma(100.0, n, ((i * n) * fma(i, fma(i, 4.166666666666667, 16.666666666666668), 50.0)));
} else {
tmp = t_0;
}
return tmp;
}
function code(i, n) t_0 = Float64(Float64(n / i) * Float64(-100.0)) tmp = 0.0 if (i <= -1.9) tmp = t_0; elseif (i <= 5e+154) tmp = fma(100.0, n, Float64(Float64(i * n) * fma(i, fma(i, 4.166666666666667, 16.666666666666668), 50.0))); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[(n / i), $MachinePrecision] * (-100.0)), $MachinePrecision]}, If[LessEqual[i, -1.9], t$95$0, If[LessEqual[i, 5e+154], N[(100.0 * n + N[(N[(i * n), $MachinePrecision] * N[(i * N[(i * 4.166666666666667 + 16.666666666666668), $MachinePrecision] + 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{n}{i} \cdot \left(-100\right)\\
\mathbf{if}\;i \leq -1.9:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;i \leq 5 \cdot 10^{+154}:\\
\;\;\;\;\mathsf{fma}\left(100, n, \left(i \cdot n\right) \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, 4.166666666666667, 16.666666666666668\right), 50\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if i < -1.8999999999999999 or 5.00000000000000004e154 < i Initial program 56.5%
lift-/.f64N/A
lift-+.f64N/A
sqr-powN/A
sqr-powN/A
lift-pow.f64N/A
lift--.f64N/A
*-rgt-identityN/A
lift-/.f64N/A
associate-*r/N/A
div-invN/A
lift--.f64N/A
div-subN/A
lift-/.f64N/A
clear-numN/A
lower--.f64N/A
Applied egg-rr55.1%
Taylor expanded in i around inf
lower-/.f6463.1
Simplified63.1%
Taylor expanded in n around inf
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6465.6
Simplified65.6%
if -1.8999999999999999 < i < 5.00000000000000004e154Initial program 15.8%
lift-/.f64N/A
lift-+.f64N/A
pow-to-expN/A
lower-expm1.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
lower-log1p.f6476.0
Applied egg-rr76.0%
Taylor expanded in n around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-expm1.f6479.9
Simplified79.9%
Taylor expanded in i around 0
lower-fma.f64N/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
distribute-rgt-inN/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
Simplified76.4%
Final simplification73.3%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* (/ n i) (- 100.0))))
(if (<= i -1.6)
t_0
(if (<= i 5e+154)
(* n (fma i (fma i 16.666666666666668 50.0) 100.0))
t_0))))
double code(double i, double n) {
double t_0 = (n / i) * -100.0;
double tmp;
if (i <= -1.6) {
tmp = t_0;
} else if (i <= 5e+154) {
tmp = n * fma(i, fma(i, 16.666666666666668, 50.0), 100.0);
} else {
tmp = t_0;
}
return tmp;
}
function code(i, n) t_0 = Float64(Float64(n / i) * Float64(-100.0)) tmp = 0.0 if (i <= -1.6) tmp = t_0; elseif (i <= 5e+154) tmp = Float64(n * fma(i, fma(i, 16.666666666666668, 50.0), 100.0)); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[(n / i), $MachinePrecision] * (-100.0)), $MachinePrecision]}, If[LessEqual[i, -1.6], t$95$0, If[LessEqual[i, 5e+154], N[(n * N[(i * N[(i * 16.666666666666668 + 50.0), $MachinePrecision] + 100.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{n}{i} \cdot \left(-100\right)\\
\mathbf{if}\;i \leq -1.6:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;i \leq 5 \cdot 10^{+154}:\\
\;\;\;\;n \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, 16.666666666666668, 50\right), 100\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if i < -1.6000000000000001 or 5.00000000000000004e154 < i Initial program 55.8%
lift-/.f64N/A
lift-+.f64N/A
sqr-powN/A
sqr-powN/A
lift-pow.f64N/A
lift--.f64N/A
*-rgt-identityN/A
lift-/.f64N/A
associate-*r/N/A
div-invN/A
lift--.f64N/A
div-subN/A
lift-/.f64N/A
clear-numN/A
lower--.f64N/A
Applied egg-rr54.4%
Taylor expanded in i around inf
lower-/.f6462.2
Simplified62.2%
Taylor expanded in n around inf
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6464.8
Simplified64.8%
if -1.6000000000000001 < i < 5.00000000000000004e154Initial program 15.8%
lift-/.f64N/A
lift-+.f64N/A
pow-to-expN/A
lower-expm1.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
lower-log1p.f6475.8
Applied egg-rr75.8%
Taylor expanded in n around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-expm1.f6480.3
Simplified80.3%
Taylor expanded in i around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
associate-*l*N/A
*-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
+-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
associate-+r+N/A
+-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
associate-+r+N/A
Simplified76.0%
Final simplification72.8%
(FPCore (i n)
:precision binary64
(let* ((t_0 (/ (* n -100.0) i)))
(if (<= i -1.6)
t_0
(if (<= i 5e+154)
(* n (fma i (fma i 16.666666666666668 50.0) 100.0))
t_0))))
double code(double i, double n) {
double t_0 = (n * -100.0) / i;
double tmp;
if (i <= -1.6) {
tmp = t_0;
} else if (i <= 5e+154) {
tmp = n * fma(i, fma(i, 16.666666666666668, 50.0), 100.0);
} else {
tmp = t_0;
}
return tmp;
}
function code(i, n) t_0 = Float64(Float64(n * -100.0) / i) tmp = 0.0 if (i <= -1.6) tmp = t_0; elseif (i <= 5e+154) tmp = Float64(n * fma(i, fma(i, 16.666666666666668, 50.0), 100.0)); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[(n * -100.0), $MachinePrecision] / i), $MachinePrecision]}, If[LessEqual[i, -1.6], t$95$0, If[LessEqual[i, 5e+154], N[(n * N[(i * N[(i * 16.666666666666668 + 50.0), $MachinePrecision] + 100.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{n \cdot -100}{i}\\
\mathbf{if}\;i \leq -1.6:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;i \leq 5 \cdot 10^{+154}:\\
\;\;\;\;n \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, 16.666666666666668, 50\right), 100\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if i < -1.6000000000000001 or 5.00000000000000004e154 < i Initial program 55.8%
lift-/.f64N/A
lift-+.f64N/A
sqr-powN/A
sqr-powN/A
lift-pow.f64N/A
lift--.f64N/A
*-rgt-identityN/A
lift-/.f64N/A
associate-*r/N/A
div-invN/A
lift--.f64N/A
div-subN/A
lift-/.f64N/A
clear-numN/A
lower--.f64N/A
Applied egg-rr54.4%
Taylor expanded in i around inf
lower-/.f6462.2
Simplified62.2%
Taylor expanded in n around inf
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6464.7
Simplified64.7%
if -1.6000000000000001 < i < 5.00000000000000004e154Initial program 15.8%
lift-/.f64N/A
lift-+.f64N/A
pow-to-expN/A
lower-expm1.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
lower-log1p.f6475.8
Applied egg-rr75.8%
Taylor expanded in n around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-expm1.f6480.3
Simplified80.3%
Taylor expanded in i around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
associate-*l*N/A
*-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
+-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
associate-+r+N/A
+-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
associate-+r+N/A
Simplified76.0%
(FPCore (i n) :precision binary64 (let* ((t_0 (/ (* n -100.0) i))) (if (<= i -1.9) t_0 (if (<= i 1.65e+78) (* n (fma i 50.0 100.0)) t_0))))
double code(double i, double n) {
double t_0 = (n * -100.0) / i;
double tmp;
if (i <= -1.9) {
tmp = t_0;
} else if (i <= 1.65e+78) {
tmp = n * fma(i, 50.0, 100.0);
} else {
tmp = t_0;
}
return tmp;
}
function code(i, n) t_0 = Float64(Float64(n * -100.0) / i) tmp = 0.0 if (i <= -1.9) tmp = t_0; elseif (i <= 1.65e+78) tmp = Float64(n * fma(i, 50.0, 100.0)); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[(n * -100.0), $MachinePrecision] / i), $MachinePrecision]}, If[LessEqual[i, -1.9], t$95$0, If[LessEqual[i, 1.65e+78], N[(n * N[(i * 50.0 + 100.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{n \cdot -100}{i}\\
\mathbf{if}\;i \leq -1.9:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;i \leq 1.65 \cdot 10^{+78}:\\
\;\;\;\;n \cdot \mathsf{fma}\left(i, 50, 100\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if i < -1.8999999999999999 or 1.65e78 < i Initial program 55.2%
lift-/.f64N/A
lift-+.f64N/A
sqr-powN/A
sqr-powN/A
lift-pow.f64N/A
lift--.f64N/A
*-rgt-identityN/A
lift-/.f64N/A
associate-*r/N/A
div-invN/A
lift--.f64N/A
div-subN/A
lift-/.f64N/A
clear-numN/A
lower--.f64N/A
Applied egg-rr54.0%
Taylor expanded in i around inf
lower-/.f6464.4
Simplified64.4%
Taylor expanded in n around inf
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6460.0
Simplified60.0%
if -1.8999999999999999 < i < 1.65e78Initial program 13.8%
lift-/.f64N/A
lift-+.f64N/A
pow-to-expN/A
lower-expm1.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
lower-log1p.f6476.8
Applied egg-rr76.8%
Taylor expanded in n around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-expm1.f6481.5
Simplified81.5%
Taylor expanded in i around 0
+-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6475.7
Simplified75.7%
(FPCore (i n) :precision binary64 (let* ((t_0 (* n (fma i 50.0 100.0)))) (if (<= n -1.02e-156) t_0 (if (<= n 1.05e-33) 0.0 t_0))))
double code(double i, double n) {
double t_0 = n * fma(i, 50.0, 100.0);
double tmp;
if (n <= -1.02e-156) {
tmp = t_0;
} else if (n <= 1.05e-33) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
function code(i, n) t_0 = Float64(n * fma(i, 50.0, 100.0)) tmp = 0.0 if (n <= -1.02e-156) tmp = t_0; elseif (n <= 1.05e-33) tmp = 0.0; else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(n * N[(i * 50.0 + 100.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1.02e-156], t$95$0, If[LessEqual[n, 1.05e-33], 0.0, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \mathsf{fma}\left(i, 50, 100\right)\\
\mathbf{if}\;n \leq -1.02 \cdot 10^{-156}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 1.05 \cdot 10^{-33}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -1.02e-156 or 1.05e-33 < n Initial program 22.7%
lift-/.f64N/A
lift-+.f64N/A
pow-to-expN/A
lower-expm1.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
lower-log1p.f6473.1
Applied egg-rr73.1%
Taylor expanded in n around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-expm1.f6483.9
Simplified83.9%
Taylor expanded in i around 0
+-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6465.4
Simplified65.4%
if -1.02e-156 < n < 1.05e-33Initial program 40.2%
lift-/.f64N/A
lift-+.f64N/A
pow-to-expN/A
lower-expm1.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
lower-log1p.f6477.1
Applied egg-rr77.1%
Taylor expanded in n around 0
Simplified62.9%
(FPCore (i n) :precision binary64 (if (<= i -0.0065) 0.0 (if (<= i 9.5e-29) (* n 100.0) 0.0)))
double code(double i, double n) {
double tmp;
if (i <= -0.0065) {
tmp = 0.0;
} else if (i <= 9.5e-29) {
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 (i <= (-0.0065d0)) then
tmp = 0.0d0
else if (i <= 9.5d-29) 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 (i <= -0.0065) {
tmp = 0.0;
} else if (i <= 9.5e-29) {
tmp = n * 100.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -0.0065: tmp = 0.0 elif i <= 9.5e-29: tmp = n * 100.0 else: tmp = 0.0 return tmp
function code(i, n) tmp = 0.0 if (i <= -0.0065) tmp = 0.0; elseif (i <= 9.5e-29) tmp = Float64(n * 100.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -0.0065) tmp = 0.0; elseif (i <= 9.5e-29) tmp = n * 100.0; else tmp = 0.0; end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -0.0065], 0.0, If[LessEqual[i, 9.5e-29], N[(n * 100.0), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -0.0065:\\
\;\;\;\;0\\
\mathbf{elif}\;i \leq 9.5 \cdot 10^{-29}:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if i < -0.0064999999999999997 or 9.50000000000000023e-29 < i Initial program 50.6%
lift-/.f64N/A
lift-+.f64N/A
pow-to-expN/A
lower-expm1.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
lower-log1p.f6475.1
Applied egg-rr75.1%
Taylor expanded in n around 0
Simplified34.2%
if -0.0064999999999999997 < i < 9.50000000000000023e-29Initial program 9.9%
lift-/.f64N/A
lift-+.f64N/A
pow-to-expN/A
lower-expm1.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
lower-log1p.f6473.4
Applied egg-rr73.4%
Taylor expanded in n around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-expm1.f6485.4
Simplified85.4%
Taylor expanded in i around 0
lower-*.f6484.8
Simplified84.8%
Final simplification63.3%
(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 27.2%
lift-/.f64N/A
lift-+.f64N/A
pow-to-expN/A
lower-expm1.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
lower-log1p.f6474.1
Applied egg-rr74.1%
Taylor expanded in n around 0
Simplified20.6%
(FPCore (i n)
:precision binary64
(let* ((t_0 (+ 1.0 (/ i n))))
(*
100.0
(/
(-
(exp
(*
n
(if (== t_0 1.0)
(/ i n)
(/ (* (/ i n) (log t_0)) (- (+ (/ i n) 1.0) 1.0)))))
1.0)
(/ i n)))))
double code(double i, double n) {
double t_0 = 1.0 + (i / n);
double tmp;
if (t_0 == 1.0) {
tmp = i / n;
} else {
tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0) - 1.0);
}
return 100.0 * ((exp((n * tmp)) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + (i / n)
if (t_0 == 1.0d0) then
tmp = i / n
else
tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0d0) - 1.0d0)
end if
code = 100.0d0 * ((exp((n * tmp)) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
double t_0 = 1.0 + (i / n);
double tmp;
if (t_0 == 1.0) {
tmp = i / n;
} else {
tmp = ((i / n) * Math.log(t_0)) / (((i / n) + 1.0) - 1.0);
}
return 100.0 * ((Math.exp((n * tmp)) - 1.0) / (i / n));
}
def code(i, n): t_0 = 1.0 + (i / n) tmp = 0 if t_0 == 1.0: tmp = i / n else: tmp = ((i / n) * math.log(t_0)) / (((i / n) + 1.0) - 1.0) return 100.0 * ((math.exp((n * tmp)) - 1.0) / (i / n))
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) tmp = 0.0 if (t_0 == 1.0) tmp = Float64(i / n); else tmp = Float64(Float64(Float64(i / n) * log(t_0)) / Float64(Float64(Float64(i / n) + 1.0) - 1.0)); end return Float64(100.0 * Float64(Float64(exp(Float64(n * tmp)) - 1.0) / Float64(i / n))) end
function tmp_2 = code(i, n) t_0 = 1.0 + (i / n); tmp = 0.0; if (t_0 == 1.0) tmp = i / n; else tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0) - 1.0); end tmp_2 = 100.0 * ((exp((n * tmp)) - 1.0) / (i / n)); end
code[i_, n_] := Block[{t$95$0 = N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision]}, N[(100.0 * N[(N[(N[Exp[N[(n * If[Equal[t$95$0, 1.0], N[(i / n), $MachinePrecision], N[(N[(N[(i / n), $MachinePrecision] * N[Log[t$95$0], $MachinePrecision]), $MachinePrecision] / N[(N[(N[(i / n), $MachinePrecision] + 1.0), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{i}{n}\\
100 \cdot \frac{e^{n \cdot \begin{array}{l}
\mathbf{if}\;t\_0 = 1:\\
\;\;\;\;\frac{i}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{i}{n} \cdot \log t\_0}{\left(\frac{i}{n} + 1\right) - 1}\\
\end{array}} - 1}{\frac{i}{n}}
\end{array}
\end{array}
herbie shell --seed 2024214
(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))))