
(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 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (i n) :precision binary64 (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))
double code(double i, double n) {
return 100.0 * ((pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 100.0d0 * ((((1.0d0 + (i / n)) ** n) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
return 100.0 * ((Math.pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
def code(i, n): return 100.0 * ((math.pow((1.0 + (i / n)), n) - 1.0) / (i / n))
function code(i, n) return Float64(100.0 * Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) - 1.0) / Float64(i / n))) end
function tmp = code(i, n) tmp = 100.0 * ((((1.0 + (i / n)) ^ n) - 1.0) / (i / n)); end
code[i_, n_] := N[(100.0 * N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}
\end{array}
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 -1e-48)
(* n (/ (+ (* (pow (/ i n) n) 100.0) -100.0) i))
(if (<= t_1 0.0)
(* 100.0 (/ (expm1 (* n (log1p (/ i n)))) (/ i n)))
(if (<= t_1 INFINITY)
(* 100.0 (* n (+ (/ t_0 i) (/ -1.0 i))))
(/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005)))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= -1e-48) {
tmp = n * (((pow((i / n), n) * 100.0) + -100.0) / i);
} else if (t_1 <= 0.0) {
tmp = 100.0 * (expm1((n * log1p((i / n)))) / (i / n));
} else if (t_1 <= ((double) INFINITY)) {
tmp = 100.0 * (n * ((t_0 / i) + (-1.0 / i)));
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= -1e-48) {
tmp = n * (((Math.pow((i / n), n) * 100.0) + -100.0) / i);
} else if (t_1 <= 0.0) {
tmp = 100.0 * (Math.expm1((n * Math.log1p((i / n)))) / (i / n));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = 100.0 * (n * ((t_0 / i) + (-1.0 / i)));
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = (t_0 + -1.0) / (i / n) tmp = 0 if t_1 <= -1e-48: tmp = n * (((math.pow((i / n), n) * 100.0) + -100.0) / i) elif t_1 <= 0.0: tmp = 100.0 * (math.expm1((n * math.log1p((i / n)))) / (i / n)) elif t_1 <= math.inf: tmp = 100.0 * (n * ((t_0 / i) + (-1.0 / i))) else: tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))) return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_1 <= -1e-48) tmp = Float64(n * Float64(Float64(Float64((Float64(i / n) ^ n) * 100.0) + -100.0) / i)); elseif (t_1 <= 0.0) tmp = Float64(100.0 * Float64(expm1(Float64(n * log1p(Float64(i / n)))) / Float64(i / n))); elseif (t_1 <= Inf) tmp = Float64(100.0 * Float64(n * Float64(Float64(t_0 / i) + Float64(-1.0 / i)))); else tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-48], N[(n * N[(N[(N[(N[Power[N[(i / n), $MachinePrecision], n], $MachinePrecision] * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 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$1, Infinity], N[(100.0 * N[(n * N[(N[(t$95$0 / i), $MachinePrecision] + N[(-1.0 / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t\_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-48}:\\
\;\;\;\;n \cdot \frac{{\left(\frac{i}{n}\right)}^{n} \cdot 100 + -100}{i}\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{\frac{i}{n}}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;100 \cdot \left(n \cdot \left(\frac{t\_0}{i} + \frac{-1}{i}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\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)) < -9.9999999999999997e-49Initial program 99.5%
associate-/r/99.5%
associate-*r*99.3%
*-commutative99.3%
associate-*r/99.8%
sub-neg99.8%
distribute-lft-in99.8%
metadata-eval99.8%
metadata-eval99.8%
metadata-eval99.8%
fma-define99.8%
metadata-eval99.8%
Simplified99.8%
fma-undefine99.8%
*-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in i around inf 99.8%
if -9.9999999999999997e-49 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 0.0Initial program 25.6%
*-commutative25.6%
frac-2neg25.6%
associate-*l/25.6%
add-exp-log25.6%
expm1-define25.6%
log-pow39.9%
log1p-define99.6%
distribute-neg-frac299.6%
Applied egg-rr99.6%
*-commutative99.6%
*-un-lft-identity99.6%
times-frac99.7%
metadata-eval99.7%
add-sqr-sqrt55.1%
sqrt-unprod51.1%
sqr-neg51.1%
sqrt-unprod7.5%
add-sqr-sqrt19.7%
add-sqr-sqrt12.2%
sqrt-unprod45.8%
sqr-neg45.8%
sqrt-unprod45.4%
add-sqr-sqrt99.7%
Applied egg-rr99.7%
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 98.2%
associate-/r/98.2%
add-exp-log98.2%
expm1-define98.2%
log-pow59.2%
log1p-define59.2%
Applied egg-rr59.2%
expm1-undefine57.7%
div-sub58.0%
*-commutative58.0%
log1p-undefine58.0%
exp-to-pow98.5%
+-commutative98.5%
Applied egg-rr98.5%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) Initial program 0.0%
associate-/r/1.9%
associate-*r*1.9%
*-commutative1.9%
associate-*r/1.9%
sub-neg1.9%
distribute-lft-in1.9%
metadata-eval1.9%
metadata-eval1.9%
metadata-eval1.9%
fma-define1.9%
metadata-eval1.9%
Simplified1.9%
Taylor expanded in n around inf 1.9%
sub-neg1.9%
metadata-eval1.9%
metadata-eval1.9%
distribute-lft-in1.9%
metadata-eval1.9%
sub-neg1.9%
expm1-define76.8%
Simplified76.8%
clear-num76.7%
un-div-inv76.6%
*-un-lft-identity76.6%
times-frac76.7%
metadata-eval76.7%
Applied egg-rr76.7%
associate-*r/76.7%
Simplified76.7%
Taylor expanded in i around 0 99.9%
Final simplification99.6%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 -2e-81)
(/ (+ -100.0 (* t_0 100.0)) (/ i n))
(if (<= t_1 0.0)
(* 100.0 (* n (/ (expm1 (* n (log1p (/ i n)))) i)))
(if (<= t_1 INFINITY)
(* 100.0 (* n (+ (/ t_0 i) (/ -1.0 i))))
(/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005)))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= -2e-81) {
tmp = (-100.0 + (t_0 * 100.0)) / (i / n);
} else if (t_1 <= 0.0) {
tmp = 100.0 * (n * (expm1((n * log1p((i / n)))) / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = 100.0 * (n * ((t_0 / i) + (-1.0 / i)));
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= -2e-81) {
tmp = (-100.0 + (t_0 * 100.0)) / (i / n);
} else if (t_1 <= 0.0) {
tmp = 100.0 * (n * (Math.expm1((n * Math.log1p((i / n)))) / i));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = 100.0 * (n * ((t_0 / i) + (-1.0 / i)));
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = (t_0 + -1.0) / (i / n) tmp = 0 if t_1 <= -2e-81: tmp = (-100.0 + (t_0 * 100.0)) / (i / n) elif t_1 <= 0.0: tmp = 100.0 * (n * (math.expm1((n * math.log1p((i / n)))) / i)) elif t_1 <= math.inf: tmp = 100.0 * (n * ((t_0 / i) + (-1.0 / i))) else: tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))) return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_1 <= -2e-81) tmp = Float64(Float64(-100.0 + Float64(t_0 * 100.0)) / Float64(i / n)); elseif (t_1 <= 0.0) tmp = Float64(100.0 * Float64(n * Float64(expm1(Float64(n * log1p(Float64(i / n)))) / i))); elseif (t_1 <= Inf) tmp = Float64(100.0 * Float64(n * Float64(Float64(t_0 / i) + Float64(-1.0 / i)))); else tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-81], N[(N[(-100.0 + N[(t$95$0 * 100.0), $MachinePrecision]), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(100.0 * N[(n * N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(100.0 * N[(n * N[(N[(t$95$0 / i), $MachinePrecision] + N[(-1.0 / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t\_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-81}:\\
\;\;\;\;\frac{-100 + t\_0 \cdot 100}{\frac{i}{n}}\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{i}\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;100 \cdot \left(n \cdot \left(\frac{t\_0}{i} + \frac{-1}{i}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\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)) < -1.9999999999999999e-81Initial program 99.5%
associate-*r/99.8%
sub-neg99.8%
distribute-rgt-in99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
if -1.9999999999999999e-81 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 0.0Initial program 24.0%
associate-/r/24.0%
add-exp-log24.0%
expm1-define24.0%
log-pow38.6%
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 98.2%
associate-/r/98.2%
add-exp-log98.2%
expm1-define98.2%
log-pow59.2%
log1p-define59.2%
Applied egg-rr59.2%
expm1-undefine57.7%
div-sub58.0%
*-commutative58.0%
log1p-undefine58.0%
exp-to-pow98.5%
+-commutative98.5%
Applied egg-rr98.5%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) Initial program 0.0%
associate-/r/1.9%
associate-*r*1.9%
*-commutative1.9%
associate-*r/1.9%
sub-neg1.9%
distribute-lft-in1.9%
metadata-eval1.9%
metadata-eval1.9%
metadata-eval1.9%
fma-define1.9%
metadata-eval1.9%
Simplified1.9%
Taylor expanded in n around inf 1.9%
sub-neg1.9%
metadata-eval1.9%
metadata-eval1.9%
distribute-lft-in1.9%
metadata-eval1.9%
sub-neg1.9%
expm1-define76.8%
Simplified76.8%
clear-num76.7%
un-div-inv76.6%
*-un-lft-identity76.6%
times-frac76.7%
metadata-eval76.7%
Applied egg-rr76.7%
associate-*r/76.7%
Simplified76.7%
Taylor expanded in i around 0 99.9%
Final simplification99.2%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 -1e-48)
(* n (/ (+ (* (pow (/ i n) n) 100.0) -100.0) i))
(if (<= t_1 0.0)
(* 100.0 (/ n (/ i (expm1 i))))
(if (<= t_1 INFINITY)
(* 100.0 (* n (+ (/ t_0 i) (/ -1.0 i))))
(/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005)))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= -1e-48) {
tmp = n * (((pow((i / n), n) * 100.0) + -100.0) / i);
} else if (t_1 <= 0.0) {
tmp = 100.0 * (n / (i / expm1(i)));
} else if (t_1 <= ((double) INFINITY)) {
tmp = 100.0 * (n * ((t_0 / i) + (-1.0 / i)));
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= -1e-48) {
tmp = n * (((Math.pow((i / n), n) * 100.0) + -100.0) / i);
} else if (t_1 <= 0.0) {
tmp = 100.0 * (n / (i / Math.expm1(i)));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = 100.0 * (n * ((t_0 / i) + (-1.0 / i)));
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = (t_0 + -1.0) / (i / n) tmp = 0 if t_1 <= -1e-48: tmp = n * (((math.pow((i / n), n) * 100.0) + -100.0) / i) elif t_1 <= 0.0: tmp = 100.0 * (n / (i / math.expm1(i))) elif t_1 <= math.inf: tmp = 100.0 * (n * ((t_0 / i) + (-1.0 / i))) else: tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))) return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_1 <= -1e-48) tmp = Float64(n * Float64(Float64(Float64((Float64(i / n) ^ n) * 100.0) + -100.0) / i)); elseif (t_1 <= 0.0) tmp = Float64(100.0 * Float64(n / Float64(i / expm1(i)))); elseif (t_1 <= Inf) tmp = Float64(100.0 * Float64(n * Float64(Float64(t_0 / i) + Float64(-1.0 / i)))); else tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-48], N[(n * N[(N[(N[(N[Power[N[(i / n), $MachinePrecision], n], $MachinePrecision] * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(100.0 * N[(n / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(100.0 * N[(n * N[(N[(t$95$0 / i), $MachinePrecision] + N[(-1.0 / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t\_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-48}:\\
\;\;\;\;n \cdot \frac{{\left(\frac{i}{n}\right)}^{n} \cdot 100 + -100}{i}\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;100 \cdot \left(n \cdot \left(\frac{t\_0}{i} + \frac{-1}{i}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\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)) < -9.9999999999999997e-49Initial program 99.5%
associate-/r/99.5%
associate-*r*99.3%
*-commutative99.3%
associate-*r/99.8%
sub-neg99.8%
distribute-lft-in99.8%
metadata-eval99.8%
metadata-eval99.8%
metadata-eval99.8%
fma-define99.8%
metadata-eval99.8%
Simplified99.8%
fma-undefine99.8%
*-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in i around inf 99.8%
if -9.9999999999999997e-49 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 0.0Initial program 25.6%
associate-/r/25.6%
associate-*r*25.6%
*-commutative25.6%
associate-*r/25.6%
sub-neg25.6%
distribute-lft-in25.6%
metadata-eval25.6%
metadata-eval25.6%
metadata-eval25.6%
fma-define25.6%
metadata-eval25.6%
Simplified25.6%
Taylor expanded in n around inf 37.2%
sub-neg37.2%
metadata-eval37.2%
metadata-eval37.2%
distribute-lft-in37.2%
metadata-eval37.2%
sub-neg37.2%
expm1-define74.8%
Simplified74.8%
clear-num74.8%
un-div-inv74.7%
*-un-lft-identity74.7%
times-frac74.8%
metadata-eval74.8%
Applied egg-rr74.8%
associate-*r/74.7%
Simplified74.7%
*-un-lft-identity74.7%
associate-/l*74.8%
times-frac74.9%
metadata-eval74.9%
Applied egg-rr74.9%
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 98.2%
associate-/r/98.2%
add-exp-log98.2%
expm1-define98.2%
log-pow59.2%
log1p-define59.2%
Applied egg-rr59.2%
expm1-undefine57.7%
div-sub58.0%
*-commutative58.0%
log1p-undefine58.0%
exp-to-pow98.5%
+-commutative98.5%
Applied egg-rr98.5%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) Initial program 0.0%
associate-/r/1.9%
associate-*r*1.9%
*-commutative1.9%
associate-*r/1.9%
sub-neg1.9%
distribute-lft-in1.9%
metadata-eval1.9%
metadata-eval1.9%
metadata-eval1.9%
fma-define1.9%
metadata-eval1.9%
Simplified1.9%
Taylor expanded in n around inf 1.9%
sub-neg1.9%
metadata-eval1.9%
metadata-eval1.9%
distribute-lft-in1.9%
metadata-eval1.9%
sub-neg1.9%
expm1-define76.8%
Simplified76.8%
clear-num76.7%
un-div-inv76.6%
*-un-lft-identity76.6%
times-frac76.7%
metadata-eval76.7%
Applied egg-rr76.7%
associate-*r/76.7%
Simplified76.7%
Taylor expanded in i around 0 99.9%
Final simplification81.6%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 -1e-48)
(* n (/ (+ (* (pow (/ i n) n) 100.0) -100.0) i))
(if (<= t_1 0.0)
(* 100.0 (/ n (/ i (expm1 i))))
(if (<= t_1 INFINITY)
(* n (/ (+ -100.0 (* t_0 100.0)) i))
(/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005)))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= -1e-48) {
tmp = n * (((pow((i / n), n) * 100.0) + -100.0) / i);
} else if (t_1 <= 0.0) {
tmp = 100.0 * (n / (i / expm1(i)));
} else if (t_1 <= ((double) INFINITY)) {
tmp = n * ((-100.0 + (t_0 * 100.0)) / i);
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= -1e-48) {
tmp = n * (((Math.pow((i / n), n) * 100.0) + -100.0) / i);
} else if (t_1 <= 0.0) {
tmp = 100.0 * (n / (i / Math.expm1(i)));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = n * ((-100.0 + (t_0 * 100.0)) / i);
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = (t_0 + -1.0) / (i / n) tmp = 0 if t_1 <= -1e-48: tmp = n * (((math.pow((i / n), n) * 100.0) + -100.0) / i) elif t_1 <= 0.0: tmp = 100.0 * (n / (i / math.expm1(i))) elif t_1 <= math.inf: tmp = n * ((-100.0 + (t_0 * 100.0)) / i) else: tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))) return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_1 <= -1e-48) tmp = Float64(n * Float64(Float64(Float64((Float64(i / n) ^ n) * 100.0) + -100.0) / i)); elseif (t_1 <= 0.0) tmp = Float64(100.0 * Float64(n / Float64(i / expm1(i)))); elseif (t_1 <= Inf) tmp = Float64(n * Float64(Float64(-100.0 + Float64(t_0 * 100.0)) / i)); else tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-48], N[(n * N[(N[(N[(N[Power[N[(i / n), $MachinePrecision], n], $MachinePrecision] * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(100.0 * N[(n / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(n * N[(N[(-100.0 + N[(t$95$0 * 100.0), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t\_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-48}:\\
\;\;\;\;n \cdot \frac{{\left(\frac{i}{n}\right)}^{n} \cdot 100 + -100}{i}\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;n \cdot \frac{-100 + t\_0 \cdot 100}{i}\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\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)) < -9.9999999999999997e-49Initial program 99.5%
associate-/r/99.5%
associate-*r*99.3%
*-commutative99.3%
associate-*r/99.8%
sub-neg99.8%
distribute-lft-in99.8%
metadata-eval99.8%
metadata-eval99.8%
metadata-eval99.8%
fma-define99.8%
metadata-eval99.8%
Simplified99.8%
fma-undefine99.8%
*-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in i around inf 99.8%
if -9.9999999999999997e-49 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 0.0Initial program 25.6%
associate-/r/25.6%
associate-*r*25.6%
*-commutative25.6%
associate-*r/25.6%
sub-neg25.6%
distribute-lft-in25.6%
metadata-eval25.6%
metadata-eval25.6%
metadata-eval25.6%
fma-define25.6%
metadata-eval25.6%
Simplified25.6%
Taylor expanded in n around inf 37.2%
sub-neg37.2%
metadata-eval37.2%
metadata-eval37.2%
distribute-lft-in37.2%
metadata-eval37.2%
sub-neg37.2%
expm1-define74.8%
Simplified74.8%
clear-num74.8%
un-div-inv74.7%
*-un-lft-identity74.7%
times-frac74.8%
metadata-eval74.8%
Applied egg-rr74.8%
associate-*r/74.7%
Simplified74.7%
*-un-lft-identity74.7%
associate-/l*74.8%
times-frac74.9%
metadata-eval74.9%
Applied egg-rr74.9%
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 98.2%
associate-/r/98.2%
associate-*r*98.1%
*-commutative98.1%
associate-*r/98.3%
sub-neg98.3%
distribute-lft-in98.2%
metadata-eval98.2%
metadata-eval98.2%
metadata-eval98.2%
fma-define98.3%
metadata-eval98.3%
Simplified98.3%
fma-undefine98.2%
*-commutative98.2%
Applied egg-rr98.2%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) Initial program 0.0%
associate-/r/1.9%
associate-*r*1.9%
*-commutative1.9%
associate-*r/1.9%
sub-neg1.9%
distribute-lft-in1.9%
metadata-eval1.9%
metadata-eval1.9%
metadata-eval1.9%
fma-define1.9%
metadata-eval1.9%
Simplified1.9%
Taylor expanded in n around inf 1.9%
sub-neg1.9%
metadata-eval1.9%
metadata-eval1.9%
distribute-lft-in1.9%
metadata-eval1.9%
sub-neg1.9%
expm1-define76.8%
Simplified76.8%
clear-num76.7%
un-div-inv76.6%
*-un-lft-identity76.6%
times-frac76.7%
metadata-eval76.7%
Applied egg-rr76.7%
associate-*r/76.7%
Simplified76.7%
Taylor expanded in i around 0 99.9%
Final simplification81.6%
(FPCore (i n)
:precision binary64
(let* ((t_0 (/ (+ (pow (+ 1.0 (/ i n)) n) -1.0) (/ i n)))
(t_1 (* n (/ (+ (* (pow (/ i n) n) 100.0) -100.0) i))))
(if (<= t_0 -1e-48)
t_1
(if (<= t_0 0.0)
(* 100.0 (/ n (/ i (expm1 i))))
(if (<= t_0 INFINITY)
t_1
(/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005)))))))))
double code(double i, double n) {
double t_0 = (pow((1.0 + (i / n)), n) + -1.0) / (i / n);
double t_1 = n * (((pow((i / n), n) * 100.0) + -100.0) / i);
double tmp;
if (t_0 <= -1e-48) {
tmp = t_1;
} else if (t_0 <= 0.0) {
tmp = 100.0 * (n / (i / expm1(i)));
} else if (t_0 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = (Math.pow((1.0 + (i / n)), n) + -1.0) / (i / n);
double t_1 = n * (((Math.pow((i / n), n) * 100.0) + -100.0) / i);
double tmp;
if (t_0 <= -1e-48) {
tmp = t_1;
} else if (t_0 <= 0.0) {
tmp = 100.0 * (n / (i / Math.expm1(i)));
} else if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
def code(i, n): t_0 = (math.pow((1.0 + (i / n)), n) + -1.0) / (i / n) t_1 = n * (((math.pow((i / n), n) * 100.0) + -100.0) / i) tmp = 0 if t_0 <= -1e-48: tmp = t_1 elif t_0 <= 0.0: tmp = 100.0 * (n / (i / math.expm1(i))) elif t_0 <= math.inf: tmp = t_1 else: tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))) return tmp
function code(i, n) t_0 = Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0) / Float64(i / n)) t_1 = Float64(n * Float64(Float64(Float64((Float64(i / n) ^ n) * 100.0) + -100.0) / i)) tmp = 0.0 if (t_0 <= -1e-48) tmp = t_1; elseif (t_0 <= 0.0) tmp = Float64(100.0 * Float64(n / Float64(i / expm1(i)))); elseif (t_0 <= Inf) tmp = t_1; else tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(n * N[(N[(N[(N[Power[N[(i / n), $MachinePrecision], n], $MachinePrecision] * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e-48], t$95$1, If[LessEqual[t$95$0, 0.0], N[(100.0 * N[(n / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], t$95$1, N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}}\\
t_1 := n \cdot \frac{{\left(\frac{i}{n}\right)}^{n} \cdot 100 + -100}{i}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{-48}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\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)) < -9.9999999999999997e-49 or 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 98.5%
associate-/r/98.5%
associate-*r*98.4%
*-commutative98.4%
associate-*r/98.7%
sub-neg98.7%
distribute-lft-in98.6%
metadata-eval98.6%
metadata-eval98.6%
metadata-eval98.6%
fma-define98.7%
metadata-eval98.7%
Simplified98.7%
fma-undefine98.6%
*-commutative98.6%
Applied egg-rr98.6%
Taylor expanded in i around inf 98.6%
if -9.9999999999999997e-49 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 0.0Initial program 25.6%
associate-/r/25.6%
associate-*r*25.6%
*-commutative25.6%
associate-*r/25.6%
sub-neg25.6%
distribute-lft-in25.6%
metadata-eval25.6%
metadata-eval25.6%
metadata-eval25.6%
fma-define25.6%
metadata-eval25.6%
Simplified25.6%
Taylor expanded in n around inf 37.2%
sub-neg37.2%
metadata-eval37.2%
metadata-eval37.2%
distribute-lft-in37.2%
metadata-eval37.2%
sub-neg37.2%
expm1-define74.8%
Simplified74.8%
clear-num74.8%
un-div-inv74.7%
*-un-lft-identity74.7%
times-frac74.8%
metadata-eval74.8%
Applied egg-rr74.8%
associate-*r/74.7%
Simplified74.7%
*-un-lft-identity74.7%
associate-/l*74.8%
times-frac74.9%
metadata-eval74.9%
Applied egg-rr74.9%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) Initial program 0.0%
associate-/r/1.9%
associate-*r*1.9%
*-commutative1.9%
associate-*r/1.9%
sub-neg1.9%
distribute-lft-in1.9%
metadata-eval1.9%
metadata-eval1.9%
metadata-eval1.9%
fma-define1.9%
metadata-eval1.9%
Simplified1.9%
Taylor expanded in n around inf 1.9%
sub-neg1.9%
metadata-eval1.9%
metadata-eval1.9%
distribute-lft-in1.9%
metadata-eval1.9%
sub-neg1.9%
expm1-define76.8%
Simplified76.8%
clear-num76.7%
un-div-inv76.6%
*-un-lft-identity76.6%
times-frac76.7%
metadata-eval76.7%
Applied egg-rr76.7%
associate-*r/76.7%
Simplified76.7%
Taylor expanded in i around 0 99.9%
Final simplification81.6%
(FPCore (i n) :precision binary64 (if (or (<= n -7e-54) (not (<= n 6.8e-9))) (* 100.0 (/ n (/ i (expm1 i)))) (/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005))))))
double code(double i, double n) {
double tmp;
if ((n <= -7e-54) || !(n <= 6.8e-9)) {
tmp = 100.0 * (n / (i / expm1(i)));
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((n <= -7e-54) || !(n <= 6.8e-9)) {
tmp = 100.0 * (n / (i / Math.expm1(i)));
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -7e-54) or not (n <= 6.8e-9): tmp = 100.0 * (n / (i / math.expm1(i))) else: tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))) return tmp
function code(i, n) tmp = 0.0 if ((n <= -7e-54) || !(n <= 6.8e-9)) tmp = Float64(100.0 * Float64(n / Float64(i / expm1(i)))); else tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -7e-54], N[Not[LessEqual[n, 6.8e-9]], $MachinePrecision]], N[(100.0 * N[(n / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -7 \cdot 10^{-54} \lor \neg \left(n \leq 6.8 \cdot 10^{-9}\right):\\
\;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\
\end{array}
\end{array}
if n < -6.99999999999999964e-54 or 6.7999999999999997e-9 < n Initial program 29.0%
associate-/r/29.3%
associate-*r*29.2%
*-commutative29.2%
associate-*r/29.3%
sub-neg29.3%
distribute-lft-in29.3%
metadata-eval29.3%
metadata-eval29.3%
metadata-eval29.3%
fma-define29.3%
metadata-eval29.3%
Simplified29.3%
Taylor expanded in n around inf 42.9%
sub-neg42.9%
metadata-eval42.9%
metadata-eval42.9%
distribute-lft-in42.9%
metadata-eval42.9%
sub-neg42.9%
expm1-define89.7%
Simplified89.7%
clear-num89.7%
un-div-inv89.6%
*-un-lft-identity89.6%
times-frac89.7%
metadata-eval89.7%
Applied egg-rr89.7%
associate-*r/89.6%
Simplified89.6%
*-un-lft-identity89.6%
associate-/l*89.7%
times-frac89.8%
metadata-eval89.8%
Applied egg-rr89.8%
if -6.99999999999999964e-54 < n < 6.7999999999999997e-9Initial program 38.2%
associate-/r/38.3%
associate-*r*38.3%
*-commutative38.3%
associate-*r/38.3%
sub-neg38.3%
distribute-lft-in38.3%
metadata-eval38.3%
metadata-eval38.3%
metadata-eval38.3%
fma-define38.3%
metadata-eval38.3%
Simplified38.3%
Taylor expanded in n around inf 22.4%
sub-neg22.4%
metadata-eval22.4%
metadata-eval22.4%
distribute-lft-in22.4%
metadata-eval22.4%
sub-neg22.4%
expm1-define44.0%
Simplified44.0%
clear-num44.0%
un-div-inv44.0%
*-un-lft-identity44.0%
times-frac44.0%
metadata-eval44.0%
Applied egg-rr44.0%
associate-*r/44.0%
Simplified44.0%
Taylor expanded in i around 0 63.1%
Final simplification79.7%
(FPCore (i n)
:precision binary64
(if (<= i -1.2)
(* -100.0 (/ n i))
(if (<= i 65000000.0)
(* n (+ 100.0 (* i 50.0)))
(if (<= i 3.1e+124)
(/ 0.0 (/ i n))
(if (<= i 2.75e+187) (* 50.0 (* i n)) (/ -100.0 (/ i n)))))))
double code(double i, double n) {
double tmp;
if (i <= -1.2) {
tmp = -100.0 * (n / i);
} else if (i <= 65000000.0) {
tmp = n * (100.0 + (i * 50.0));
} else if (i <= 3.1e+124) {
tmp = 0.0 / (i / n);
} else if (i <= 2.75e+187) {
tmp = 50.0 * (i * n);
} else {
tmp = -100.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 (i <= (-1.2d0)) then
tmp = (-100.0d0) * (n / i)
else if (i <= 65000000.0d0) then
tmp = n * (100.0d0 + (i * 50.0d0))
else if (i <= 3.1d+124) then
tmp = 0.0d0 / (i / n)
else if (i <= 2.75d+187) then
tmp = 50.0d0 * (i * n)
else
tmp = (-100.0d0) / (i / n)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= -1.2) {
tmp = -100.0 * (n / i);
} else if (i <= 65000000.0) {
tmp = n * (100.0 + (i * 50.0));
} else if (i <= 3.1e+124) {
tmp = 0.0 / (i / n);
} else if (i <= 2.75e+187) {
tmp = 50.0 * (i * n);
} else {
tmp = -100.0 / (i / n);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -1.2: tmp = -100.0 * (n / i) elif i <= 65000000.0: tmp = n * (100.0 + (i * 50.0)) elif i <= 3.1e+124: tmp = 0.0 / (i / n) elif i <= 2.75e+187: tmp = 50.0 * (i * n) else: tmp = -100.0 / (i / n) return tmp
function code(i, n) tmp = 0.0 if (i <= -1.2) tmp = Float64(-100.0 * Float64(n / i)); elseif (i <= 65000000.0) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); elseif (i <= 3.1e+124) tmp = Float64(0.0 / Float64(i / n)); elseif (i <= 2.75e+187) tmp = Float64(50.0 * Float64(i * n)); else tmp = Float64(-100.0 / Float64(i / n)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -1.2) tmp = -100.0 * (n / i); elseif (i <= 65000000.0) tmp = n * (100.0 + (i * 50.0)); elseif (i <= 3.1e+124) tmp = 0.0 / (i / n); elseif (i <= 2.75e+187) tmp = 50.0 * (i * n); else tmp = -100.0 / (i / n); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -1.2], N[(-100.0 * N[(n / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 65000000.0], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 3.1e+124], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 2.75e+187], N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision], N[(-100.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -1.2:\\
\;\;\;\;-100 \cdot \frac{n}{i}\\
\mathbf{elif}\;i \leq 65000000:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{elif}\;i \leq 3.1 \cdot 10^{+124}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{elif}\;i \leq 2.75 \cdot 10^{+187}:\\
\;\;\;\;50 \cdot \left(i \cdot n\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-100}{\frac{i}{n}}\\
\end{array}
\end{array}
if i < -1.19999999999999996Initial program 60.8%
associate-*r/60.8%
sub-neg60.8%
distribute-rgt-in60.8%
metadata-eval60.8%
metadata-eval60.8%
Simplified60.8%
Taylor expanded in i around 0 23.2%
*-commutative23.2%
Simplified23.2%
flip-+6.6%
clear-num6.6%
*-commutative6.6%
cancel-sign-sub-inv6.6%
metadata-eval6.6%
metadata-eval6.6%
swap-sqr6.6%
pow26.6%
metadata-eval6.6%
Applied egg-rr6.6%
Taylor expanded in i around 0 79.9%
Taylor expanded in i around inf 80.0%
if -1.19999999999999996 < i < 6.5e7Initial program 7.6%
associate-/r/8.0%
associate-*r*8.0%
*-commutative8.0%
associate-*r/8.0%
sub-neg8.0%
distribute-lft-in8.0%
metadata-eval8.0%
metadata-eval8.0%
metadata-eval8.0%
fma-define8.0%
metadata-eval8.0%
Simplified8.0%
Taylor expanded in n around inf 11.2%
sub-neg11.2%
metadata-eval11.2%
metadata-eval11.2%
distribute-lft-in11.2%
metadata-eval11.2%
sub-neg11.2%
expm1-define83.5%
Simplified83.5%
Taylor expanded in i around 0 82.4%
*-commutative82.4%
Simplified82.4%
if 6.5e7 < i < 3.1000000000000002e124Initial program 54.9%
associate-*r/54.9%
sub-neg54.9%
distribute-rgt-in54.8%
metadata-eval54.8%
metadata-eval54.8%
Simplified54.8%
Taylor expanded in i around 0 5.1%
*-commutative5.1%
Simplified5.1%
Taylor expanded in i around 0 30.4%
if 3.1000000000000002e124 < i < 2.74999999999999999e187Initial program 56.3%
associate-/r/56.3%
associate-*r*56.3%
*-commutative56.3%
associate-*r/56.3%
sub-neg56.3%
distribute-lft-in56.3%
metadata-eval56.3%
metadata-eval56.3%
metadata-eval56.3%
fma-define56.3%
metadata-eval56.3%
Simplified56.3%
Taylor expanded in n around inf 77.9%
sub-neg77.9%
metadata-eval77.9%
metadata-eval77.9%
distribute-lft-in77.9%
metadata-eval77.9%
sub-neg77.9%
expm1-define77.9%
Simplified77.9%
Taylor expanded in i around 0 57.1%
*-commutative57.1%
Simplified57.1%
Taylor expanded in i around inf 57.1%
if 2.74999999999999999e187 < i Initial program 59.5%
associate-*r/59.5%
sub-neg59.5%
distribute-rgt-in59.5%
metadata-eval59.5%
metadata-eval59.5%
Simplified59.5%
Taylor expanded in i around 0 35.6%
*-commutative35.6%
Simplified35.6%
flip-+33.7%
clear-num33.7%
*-commutative33.7%
cancel-sign-sub-inv33.7%
metadata-eval33.7%
metadata-eval33.7%
swap-sqr33.7%
pow233.7%
metadata-eval33.7%
Applied egg-rr33.7%
Taylor expanded in i around 0 53.0%
Taylor expanded in i around inf 53.0%
Final simplification72.5%
(FPCore (i n)
:precision binary64
(if (<= i -1.82)
(* -100.0 (/ n i))
(if (<= i 3.8e+189)
(*
n
(+
100.0
(* i (+ 50.0 (* i (+ 16.666666666666668 (* i 4.166666666666667)))))))
(/ -100.0 (/ i n)))))
double code(double i, double n) {
double tmp;
if (i <= -1.82) {
tmp = -100.0 * (n / i);
} else if (i <= 3.8e+189) {
tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
} else {
tmp = -100.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 (i <= (-1.82d0)) then
tmp = (-100.0d0) * (n / i)
else if (i <= 3.8d+189) then
tmp = n * (100.0d0 + (i * (50.0d0 + (i * (16.666666666666668d0 + (i * 4.166666666666667d0))))))
else
tmp = (-100.0d0) / (i / n)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= -1.82) {
tmp = -100.0 * (n / i);
} else if (i <= 3.8e+189) {
tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
} else {
tmp = -100.0 / (i / n);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -1.82: tmp = -100.0 * (n / i) elif i <= 3.8e+189: tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667)))))) else: tmp = -100.0 / (i / n) return tmp
function code(i, n) tmp = 0.0 if (i <= -1.82) tmp = Float64(-100.0 * Float64(n / i)); elseif (i <= 3.8e+189) tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * Float64(16.666666666666668 + Float64(i * 4.166666666666667))))))); else tmp = Float64(-100.0 / Float64(i / n)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -1.82) tmp = -100.0 * (n / i); elseif (i <= 3.8e+189) tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667)))))); else tmp = -100.0 / (i / n); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -1.82], N[(-100.0 * N[(n / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 3.8e+189], 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], N[(-100.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -1.82:\\
\;\;\;\;-100 \cdot \frac{n}{i}\\
\mathbf{elif}\;i \leq 3.8 \cdot 10^{+189}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot \left(16.666666666666668 + i \cdot 4.166666666666667\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-100}{\frac{i}{n}}\\
\end{array}
\end{array}
if i < -1.82000000000000006Initial program 60.8%
associate-*r/60.8%
sub-neg60.8%
distribute-rgt-in60.8%
metadata-eval60.8%
metadata-eval60.8%
Simplified60.8%
Taylor expanded in i around 0 23.2%
*-commutative23.2%
Simplified23.2%
flip-+6.6%
clear-num6.6%
*-commutative6.6%
cancel-sign-sub-inv6.6%
metadata-eval6.6%
metadata-eval6.6%
swap-sqr6.6%
pow26.6%
metadata-eval6.6%
Applied egg-rr6.6%
Taylor expanded in i around 0 79.9%
Taylor expanded in i around inf 80.0%
if -1.82000000000000006 < i < 3.7999999999999998e189Initial program 17.6%
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%
Taylor expanded in n around inf 18.0%
sub-neg18.0%
metadata-eval18.0%
metadata-eval18.0%
distribute-lft-in18.1%
metadata-eval18.1%
sub-neg18.1%
expm1-define75.2%
Simplified75.2%
Taylor expanded in i around 0 72.8%
*-commutative72.8%
Simplified72.8%
if 3.7999999999999998e189 < i Initial program 59.5%
associate-*r/59.5%
sub-neg59.5%
distribute-rgt-in59.5%
metadata-eval59.5%
metadata-eval59.5%
Simplified59.5%
Taylor expanded in i around 0 35.6%
*-commutative35.6%
Simplified35.6%
flip-+33.7%
clear-num33.7%
*-commutative33.7%
cancel-sign-sub-inv33.7%
metadata-eval33.7%
metadata-eval33.7%
swap-sqr33.7%
pow233.7%
metadata-eval33.7%
Applied egg-rr33.7%
Taylor expanded in i around 0 53.0%
Taylor expanded in i around inf 53.0%
(FPCore (i n)
:precision binary64
(if (<= i -1.56)
(* -100.0 (/ n i))
(if (<= i 8.5e+187)
(* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668)))))
(/ -100.0 (/ i n)))))
double code(double i, double n) {
double tmp;
if (i <= -1.56) {
tmp = -100.0 * (n / i);
} else if (i <= 8.5e+187) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else {
tmp = -100.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 (i <= (-1.56d0)) then
tmp = (-100.0d0) * (n / i)
else if (i <= 8.5d+187) then
tmp = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
else
tmp = (-100.0d0) / (i / n)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= -1.56) {
tmp = -100.0 * (n / i);
} else if (i <= 8.5e+187) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else {
tmp = -100.0 / (i / n);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -1.56: tmp = -100.0 * (n / i) elif i <= 8.5e+187: tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) else: tmp = -100.0 / (i / n) return tmp
function code(i, n) tmp = 0.0 if (i <= -1.56) tmp = Float64(-100.0 * Float64(n / i)); elseif (i <= 8.5e+187) tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))); else tmp = Float64(-100.0 / Float64(i / n)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -1.56) tmp = -100.0 * (n / i); elseif (i <= 8.5e+187) tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); else tmp = -100.0 / (i / n); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -1.56], N[(-100.0 * N[(n / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 8.5e+187], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-100.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -1.56:\\
\;\;\;\;-100 \cdot \frac{n}{i}\\
\mathbf{elif}\;i \leq 8.5 \cdot 10^{+187}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-100}{\frac{i}{n}}\\
\end{array}
\end{array}
if i < -1.5600000000000001Initial program 60.8%
associate-*r/60.8%
sub-neg60.8%
distribute-rgt-in60.8%
metadata-eval60.8%
metadata-eval60.8%
Simplified60.8%
Taylor expanded in i around 0 23.2%
*-commutative23.2%
Simplified23.2%
flip-+6.6%
clear-num6.6%
*-commutative6.6%
cancel-sign-sub-inv6.6%
metadata-eval6.6%
metadata-eval6.6%
swap-sqr6.6%
pow26.6%
metadata-eval6.6%
Applied egg-rr6.6%
Taylor expanded in i around 0 79.9%
Taylor expanded in i around inf 80.0%
if -1.5600000000000001 < i < 8.49999999999999989e187Initial program 17.6%
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%
Taylor expanded in n around inf 18.0%
sub-neg18.0%
metadata-eval18.0%
metadata-eval18.0%
distribute-lft-in18.1%
metadata-eval18.1%
sub-neg18.1%
expm1-define75.2%
Simplified75.2%
Taylor expanded in i around 0 72.1%
*-commutative72.1%
Simplified72.1%
if 8.49999999999999989e187 < i Initial program 59.5%
associate-*r/59.5%
sub-neg59.5%
distribute-rgt-in59.5%
metadata-eval59.5%
metadata-eval59.5%
Simplified59.5%
Taylor expanded in i around 0 35.6%
*-commutative35.6%
Simplified35.6%
flip-+33.7%
clear-num33.7%
*-commutative33.7%
cancel-sign-sub-inv33.7%
metadata-eval33.7%
metadata-eval33.7%
swap-sqr33.7%
pow233.7%
metadata-eval33.7%
Applied egg-rr33.7%
Taylor expanded in i around 0 53.0%
Taylor expanded in i around inf 53.0%
(FPCore (i n) :precision binary64 (if (<= i -1.2) (* -100.0 (/ n i)) (if (<= i 5.5e+187) (* n (+ 100.0 (* i 50.0))) (/ -100.0 (/ i n)))))
double code(double i, double n) {
double tmp;
if (i <= -1.2) {
tmp = -100.0 * (n / i);
} else if (i <= 5.5e+187) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = -100.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 (i <= (-1.2d0)) then
tmp = (-100.0d0) * (n / i)
else if (i <= 5.5d+187) then
tmp = n * (100.0d0 + (i * 50.0d0))
else
tmp = (-100.0d0) / (i / n)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= -1.2) {
tmp = -100.0 * (n / i);
} else if (i <= 5.5e+187) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = -100.0 / (i / n);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -1.2: tmp = -100.0 * (n / i) elif i <= 5.5e+187: tmp = n * (100.0 + (i * 50.0)) else: tmp = -100.0 / (i / n) return tmp
function code(i, n) tmp = 0.0 if (i <= -1.2) tmp = Float64(-100.0 * Float64(n / i)); elseif (i <= 5.5e+187) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); else tmp = Float64(-100.0 / Float64(i / n)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -1.2) tmp = -100.0 * (n / i); elseif (i <= 5.5e+187) tmp = n * (100.0 + (i * 50.0)); else tmp = -100.0 / (i / n); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -1.2], N[(-100.0 * N[(n / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 5.5e+187], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-100.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -1.2:\\
\;\;\;\;-100 \cdot \frac{n}{i}\\
\mathbf{elif}\;i \leq 5.5 \cdot 10^{+187}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-100}{\frac{i}{n}}\\
\end{array}
\end{array}
if i < -1.19999999999999996Initial program 60.8%
associate-*r/60.8%
sub-neg60.8%
distribute-rgt-in60.8%
metadata-eval60.8%
metadata-eval60.8%
Simplified60.8%
Taylor expanded in i around 0 23.2%
*-commutative23.2%
Simplified23.2%
flip-+6.6%
clear-num6.6%
*-commutative6.6%
cancel-sign-sub-inv6.6%
metadata-eval6.6%
metadata-eval6.6%
swap-sqr6.6%
pow26.6%
metadata-eval6.6%
Applied egg-rr6.6%
Taylor expanded in i around 0 79.9%
Taylor expanded in i around inf 80.0%
if -1.19999999999999996 < i < 5.49999999999999997e187Initial program 17.6%
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%
Taylor expanded in n around inf 18.0%
sub-neg18.0%
metadata-eval18.0%
metadata-eval18.0%
distribute-lft-in18.1%
metadata-eval18.1%
sub-neg18.1%
expm1-define75.2%
Simplified75.2%
Taylor expanded in i around 0 70.0%
*-commutative70.0%
Simplified70.0%
if 5.49999999999999997e187 < i Initial program 59.5%
associate-*r/59.5%
sub-neg59.5%
distribute-rgt-in59.5%
metadata-eval59.5%
metadata-eval59.5%
Simplified59.5%
Taylor expanded in i around 0 35.6%
*-commutative35.6%
Simplified35.6%
flip-+33.7%
clear-num33.7%
*-commutative33.7%
cancel-sign-sub-inv33.7%
metadata-eval33.7%
metadata-eval33.7%
swap-sqr33.7%
pow233.7%
metadata-eval33.7%
Applied egg-rr33.7%
Taylor expanded in i around 0 53.0%
Taylor expanded in i around inf 53.0%
(FPCore (i n) :precision binary64 (if (or (<= i -1.0) (not (<= i 3.5e+93))) (* -100.0 (/ n i)) (* n 100.0)))
double code(double i, double n) {
double tmp;
if ((i <= -1.0) || !(i <= 3.5e+93)) {
tmp = -100.0 * (n / i);
} else {
tmp = n * 100.0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((i <= (-1.0d0)) .or. (.not. (i <= 3.5d+93))) then
tmp = (-100.0d0) * (n / i)
else
tmp = n * 100.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((i <= -1.0) || !(i <= 3.5e+93)) {
tmp = -100.0 * (n / i);
} else {
tmp = n * 100.0;
}
return tmp;
}
def code(i, n): tmp = 0 if (i <= -1.0) or not (i <= 3.5e+93): tmp = -100.0 * (n / i) else: tmp = n * 100.0 return tmp
function code(i, n) tmp = 0.0 if ((i <= -1.0) || !(i <= 3.5e+93)) tmp = Float64(-100.0 * Float64(n / i)); else tmp = Float64(n * 100.0); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((i <= -1.0) || ~((i <= 3.5e+93))) tmp = -100.0 * (n / i); else tmp = n * 100.0; end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[i, -1.0], N[Not[LessEqual[i, 3.5e+93]], $MachinePrecision]], N[(-100.0 * N[(n / i), $MachinePrecision]), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -1 \lor \neg \left(i \leq 3.5 \cdot 10^{+93}\right):\\
\;\;\;\;-100 \cdot \frac{n}{i}\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if i < -1 or 3.49999999999999998e93 < i Initial program 61.3%
associate-*r/61.3%
sub-neg61.3%
distribute-rgt-in61.3%
metadata-eval61.3%
metadata-eval61.3%
Simplified61.3%
Taylor expanded in i around 0 23.5%
*-commutative23.5%
Simplified23.5%
flip-+15.0%
clear-num15.0%
*-commutative15.0%
cancel-sign-sub-inv15.0%
metadata-eval15.0%
metadata-eval15.0%
swap-sqr15.0%
pow215.0%
metadata-eval15.0%
Applied egg-rr15.0%
Taylor expanded in i around 0 65.7%
Taylor expanded in i around inf 65.2%
if -1 < i < 3.49999999999999998e93Initial program 12.4%
Taylor expanded in i around 0 71.6%
*-commutative71.6%
Simplified71.6%
Final simplification69.0%
(FPCore (i n) :precision binary64 (if (<= i -1.0) (* -100.0 (/ n i)) (if (<= i 3.5e+93) (* n 100.0) (/ -100.0 (/ i n)))))
double code(double i, double n) {
double tmp;
if (i <= -1.0) {
tmp = -100.0 * (n / i);
} else if (i <= 3.5e+93) {
tmp = n * 100.0;
} else {
tmp = -100.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 (i <= (-1.0d0)) then
tmp = (-100.0d0) * (n / i)
else if (i <= 3.5d+93) then
tmp = n * 100.0d0
else
tmp = (-100.0d0) / (i / n)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= -1.0) {
tmp = -100.0 * (n / i);
} else if (i <= 3.5e+93) {
tmp = n * 100.0;
} else {
tmp = -100.0 / (i / n);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -1.0: tmp = -100.0 * (n / i) elif i <= 3.5e+93: tmp = n * 100.0 else: tmp = -100.0 / (i / n) return tmp
function code(i, n) tmp = 0.0 if (i <= -1.0) tmp = Float64(-100.0 * Float64(n / i)); elseif (i <= 3.5e+93) tmp = Float64(n * 100.0); else tmp = Float64(-100.0 / Float64(i / n)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -1.0) tmp = -100.0 * (n / i); elseif (i <= 3.5e+93) tmp = n * 100.0; else tmp = -100.0 / (i / n); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -1.0], N[(-100.0 * N[(n / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 3.5e+93], N[(n * 100.0), $MachinePrecision], N[(-100.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -1:\\
\;\;\;\;-100 \cdot \frac{n}{i}\\
\mathbf{elif}\;i \leq 3.5 \cdot 10^{+93}:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;\frac{-100}{\frac{i}{n}}\\
\end{array}
\end{array}
if i < -1Initial program 60.8%
associate-*r/60.8%
sub-neg60.8%
distribute-rgt-in60.8%
metadata-eval60.8%
metadata-eval60.8%
Simplified60.8%
Taylor expanded in i around 0 23.2%
*-commutative23.2%
Simplified23.2%
flip-+6.6%
clear-num6.6%
*-commutative6.6%
cancel-sign-sub-inv6.6%
metadata-eval6.6%
metadata-eval6.6%
swap-sqr6.6%
pow26.6%
metadata-eval6.6%
Applied egg-rr6.6%
Taylor expanded in i around 0 79.9%
Taylor expanded in i around inf 80.0%
if -1 < i < 3.49999999999999998e93Initial program 12.4%
Taylor expanded in i around 0 71.6%
*-commutative71.6%
Simplified71.6%
if 3.49999999999999998e93 < i Initial program 62.1%
associate-*r/62.1%
sub-neg62.1%
distribute-rgt-in62.1%
metadata-eval62.1%
metadata-eval62.1%
Simplified62.1%
Taylor expanded in i around 0 24.0%
*-commutative24.0%
Simplified24.0%
flip-+27.2%
clear-num27.2%
*-commutative27.2%
cancel-sign-sub-inv27.2%
metadata-eval27.2%
metadata-eval27.2%
swap-sqr27.2%
pow227.2%
metadata-eval27.2%
Applied egg-rr27.2%
Taylor expanded in i around 0 45.4%
Taylor expanded in i around inf 45.4%
(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 32.5%
Taylor expanded in i around 0 44.2%
*-commutative44.2%
Simplified44.2%
(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 2024110
(FPCore (i n)
:name "Compound Interest"
:precision binary64
:alt
(* 100.0 (/ (- (exp (* n (if (== (+ 1.0 (/ i n)) 1.0) (/ i n) (/ (* (/ i n) (log (+ 1.0 (/ i n)))) (- (+ (/ i n) 1.0) 1.0))))) 1.0) (/ i n)))
(* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))