
(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 17 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 2e-216)
(/ (* (expm1 (* n (log1p (/ i n)))) 100.0) (/ i n))
(if (<= t_1 INFINITY)
(* n (/ (fma 100.0 t_0 -100.0) i))
(* n (/ 1.0 (+ 0.01 (* 0.01 (* i (+ (/ 0.5 n) -0.5))))))))))
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-216) {
tmp = (expm1((n * log1p((i / n)))) * 100.0) / (i / n);
} else if (t_1 <= ((double) INFINITY)) {
tmp = n * (fma(100.0, t_0, -100.0) / i);
} else {
tmp = n * (1.0 / (0.01 + (0.01 * (i * ((0.5 / n) + -0.5)))));
}
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-216) tmp = Float64(Float64(expm1(Float64(n * log1p(Float64(i / n)))) * 100.0) / Float64(i / n)); elseif (t_1 <= Inf) tmp = Float64(n * Float64(fma(100.0, t_0, -100.0) / i)); else tmp = Float64(n * Float64(1.0 / Float64(0.01 + Float64(0.01 * Float64(i * Float64(Float64(0.5 / n) + -0.5)))))); 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-216], N[(N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] * 100.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(n * N[(N[(100.0 * t$95$0 + -100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(n * N[(1.0 / N[(0.01 + N[(0.01 * N[(i * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $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^{-216}:\\
\;\;\;\;\frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot 100}{\frac{i}{n}}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;n \cdot \frac{\mathsf{fma}\left(100, t\_0, -100\right)}{i}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \frac{1}{0.01 + 0.01 \cdot \left(i \cdot \left(\frac{0.5}{n} + -0.5\right)\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)) < 2.0000000000000001e-216Initial program 30.3%
*-commutative30.3%
frac-2neg30.3%
associate-*l/30.3%
add-exp-log30.3%
expm1-define30.3%
log-pow37.8%
log1p-define98.1%
distribute-neg-frac298.1%
Applied egg-rr98.1%
if 2.0000000000000001e-216 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 98.8%
associate-/r/98.8%
associate-*r*98.9%
*-commutative98.9%
associate-*r/99.0%
sub-neg99.0%
distribute-lft-in98.8%
metadata-eval98.8%
metadata-eval98.8%
metadata-eval98.8%
fma-define99.0%
metadata-eval99.0%
Simplified99.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%
associate-/r/1.8%
associate-*r*1.8%
*-commutative1.8%
associate-*r/1.8%
sub-neg1.8%
distribute-lft-in1.8%
metadata-eval1.8%
metadata-eval1.8%
metadata-eval1.8%
fma-define1.8%
metadata-eval1.8%
Simplified1.8%
fma-undefine1.8%
metadata-eval1.8%
metadata-eval1.8%
distribute-lft-in1.8%
sub-neg1.8%
*-commutative1.8%
add-exp-log1.8%
expm1-define1.8%
log-pow1.8%
log1p-define1.8%
Applied egg-rr1.8%
clear-num1.8%
inv-pow1.8%
*-un-lft-identity1.8%
*-commutative1.8%
times-frac1.8%
metadata-eval1.8%
Applied egg-rr1.8%
unpow-11.8%
Simplified1.8%
Taylor expanded in i around 0 100.0%
sub-neg100.0%
associate-*r/100.0%
metadata-eval100.0%
metadata-eval100.0%
Simplified100.0%
Final simplification98.5%
(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-216)
(* n (/ 1.0 (* 0.01 (/ i (expm1 (* n (log1p (/ i n))))))))
(if (<= t_1 INFINITY)
(* n (/ (fma 100.0 t_0 -100.0) i))
(* n (/ 1.0 (+ 0.01 (* 0.01 (* i (+ (/ 0.5 n) -0.5))))))))))
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-216) {
tmp = n * (1.0 / (0.01 * (i / expm1((n * log1p((i / n)))))));
} else if (t_1 <= ((double) INFINITY)) {
tmp = n * (fma(100.0, t_0, -100.0) / i);
} else {
tmp = n * (1.0 / (0.01 + (0.01 * (i * ((0.5 / n) + -0.5)))));
}
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-216) tmp = Float64(n * Float64(1.0 / Float64(0.01 * Float64(i / expm1(Float64(n * log1p(Float64(i / n)))))))); elseif (t_1 <= Inf) tmp = Float64(n * Float64(fma(100.0, t_0, -100.0) / i)); else tmp = Float64(n * Float64(1.0 / Float64(0.01 + Float64(0.01 * Float64(i * Float64(Float64(0.5 / n) + -0.5)))))); 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-216], N[(n * N[(1.0 / N[(0.01 * N[(i / N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(n * N[(N[(100.0 * t$95$0 + -100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(n * N[(1.0 / N[(0.01 + N[(0.01 * N[(i * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $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^{-216}:\\
\;\;\;\;n \cdot \frac{1}{0.01 \cdot \frac{i}{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;n \cdot \frac{\mathsf{fma}\left(100, t\_0, -100\right)}{i}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \frac{1}{0.01 + 0.01 \cdot \left(i \cdot \left(\frac{0.5}{n} + -0.5\right)\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)) < 2.0000000000000001e-216Initial program 30.3%
associate-/r/29.9%
associate-*r*29.9%
*-commutative29.9%
associate-*r/29.9%
sub-neg29.9%
distribute-lft-in29.9%
metadata-eval29.9%
metadata-eval29.9%
metadata-eval29.9%
fma-define29.9%
metadata-eval29.9%
Simplified29.9%
fma-undefine29.9%
metadata-eval29.9%
metadata-eval29.9%
distribute-lft-in29.9%
sub-neg29.9%
*-commutative29.9%
add-exp-log29.9%
expm1-define29.9%
log-pow37.4%
log1p-define96.6%
Applied egg-rr96.6%
clear-num96.6%
inv-pow96.6%
*-un-lft-identity96.6%
*-commutative96.6%
times-frac96.6%
metadata-eval96.6%
Applied egg-rr96.6%
unpow-196.6%
Simplified96.6%
if 2.0000000000000001e-216 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 98.8%
associate-/r/98.8%
associate-*r*98.9%
*-commutative98.9%
associate-*r/99.0%
sub-neg99.0%
distribute-lft-in98.8%
metadata-eval98.8%
metadata-eval98.8%
metadata-eval98.8%
fma-define99.0%
metadata-eval99.0%
Simplified99.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%
associate-/r/1.8%
associate-*r*1.8%
*-commutative1.8%
associate-*r/1.8%
sub-neg1.8%
distribute-lft-in1.8%
metadata-eval1.8%
metadata-eval1.8%
metadata-eval1.8%
fma-define1.8%
metadata-eval1.8%
Simplified1.8%
fma-undefine1.8%
metadata-eval1.8%
metadata-eval1.8%
distribute-lft-in1.8%
sub-neg1.8%
*-commutative1.8%
add-exp-log1.8%
expm1-define1.8%
log-pow1.8%
log1p-define1.8%
Applied egg-rr1.8%
clear-num1.8%
inv-pow1.8%
*-un-lft-identity1.8%
*-commutative1.8%
times-frac1.8%
metadata-eval1.8%
Applied egg-rr1.8%
unpow-11.8%
Simplified1.8%
Taylor expanded in i around 0 100.0%
sub-neg100.0%
associate-*r/100.0%
metadata-eval100.0%
metadata-eval100.0%
Simplified100.0%
Final simplification97.5%
(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-216)
(* n (/ (* (expm1 (* n (log1p (/ i n)))) 100.0) i))
(if (<= t_1 INFINITY)
(* n (/ (fma 100.0 t_0 -100.0) i))
(* n (/ 1.0 (+ 0.01 (* 0.01 (* i (+ (/ 0.5 n) -0.5))))))))))
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-216) {
tmp = n * ((expm1((n * log1p((i / n)))) * 100.0) / i);
} else if (t_1 <= ((double) INFINITY)) {
tmp = n * (fma(100.0, t_0, -100.0) / i);
} else {
tmp = n * (1.0 / (0.01 + (0.01 * (i * ((0.5 / n) + -0.5)))));
}
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-216) tmp = Float64(n * Float64(Float64(expm1(Float64(n * log1p(Float64(i / n)))) * 100.0) / i)); elseif (t_1 <= Inf) tmp = Float64(n * Float64(fma(100.0, t_0, -100.0) / i)); else tmp = Float64(n * Float64(1.0 / Float64(0.01 + Float64(0.01 * Float64(i * Float64(Float64(0.5 / n) + -0.5)))))); 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-216], N[(n * N[(N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] * 100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(n * N[(N[(100.0 * t$95$0 + -100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(n * N[(1.0 / N[(0.01 + N[(0.01 * N[(i * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $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^{-216}:\\
\;\;\;\;n \cdot \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot 100}{i}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;n \cdot \frac{\mathsf{fma}\left(100, t\_0, -100\right)}{i}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \frac{1}{0.01 + 0.01 \cdot \left(i \cdot \left(\frac{0.5}{n} + -0.5\right)\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)) < 2.0000000000000001e-216Initial program 30.3%
associate-/r/29.9%
associate-*r*29.9%
*-commutative29.9%
associate-*r/29.9%
sub-neg29.9%
distribute-lft-in29.9%
metadata-eval29.9%
metadata-eval29.9%
metadata-eval29.9%
fma-define29.9%
metadata-eval29.9%
Simplified29.9%
fma-undefine29.9%
metadata-eval29.9%
metadata-eval29.9%
distribute-lft-in29.9%
sub-neg29.9%
*-commutative29.9%
add-exp-log29.9%
expm1-define29.9%
log-pow37.4%
log1p-define96.6%
Applied egg-rr96.6%
if 2.0000000000000001e-216 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 98.8%
associate-/r/98.8%
associate-*r*98.9%
*-commutative98.9%
associate-*r/99.0%
sub-neg99.0%
distribute-lft-in98.8%
metadata-eval98.8%
metadata-eval98.8%
metadata-eval98.8%
fma-define99.0%
metadata-eval99.0%
Simplified99.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%
associate-/r/1.8%
associate-*r*1.8%
*-commutative1.8%
associate-*r/1.8%
sub-neg1.8%
distribute-lft-in1.8%
metadata-eval1.8%
metadata-eval1.8%
metadata-eval1.8%
fma-define1.8%
metadata-eval1.8%
Simplified1.8%
fma-undefine1.8%
metadata-eval1.8%
metadata-eval1.8%
distribute-lft-in1.8%
sub-neg1.8%
*-commutative1.8%
add-exp-log1.8%
expm1-define1.8%
log-pow1.8%
log1p-define1.8%
Applied egg-rr1.8%
clear-num1.8%
inv-pow1.8%
*-un-lft-identity1.8%
*-commutative1.8%
times-frac1.8%
metadata-eval1.8%
Applied egg-rr1.8%
unpow-11.8%
Simplified1.8%
Taylor expanded in i around 0 100.0%
sub-neg100.0%
associate-*r/100.0%
metadata-eval100.0%
metadata-eval100.0%
Simplified100.0%
Final simplification97.4%
(FPCore (i n)
:precision binary64
(let* ((t_0 (/ (+ (pow (+ 1.0 (/ i n)) n) -1.0) (/ i n))))
(if (<= t_0 2e-216)
(* n (/ (* (expm1 (* n (log1p (/ i n)))) 100.0) i))
(if (<= t_0 INFINITY)
(/ (+ -100.0 (* 100.0 (pow (/ i n) n))) (/ i n))
(* n (/ 1.0 (+ 0.01 (* 0.01 (* i (+ (/ 0.5 n) -0.5))))))))))
double code(double i, double n) {
double t_0 = (pow((1.0 + (i / n)), n) + -1.0) / (i / n);
double tmp;
if (t_0 <= 2e-216) {
tmp = n * ((expm1((n * log1p((i / n)))) * 100.0) / i);
} else if (t_0 <= ((double) INFINITY)) {
tmp = (-100.0 + (100.0 * pow((i / n), n))) / (i / n);
} else {
tmp = n * (1.0 / (0.01 + (0.01 * (i * ((0.5 / n) + -0.5)))));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = (Math.pow((1.0 + (i / n)), n) + -1.0) / (i / n);
double tmp;
if (t_0 <= 2e-216) {
tmp = n * ((Math.expm1((n * Math.log1p((i / n)))) * 100.0) / i);
} else if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = (-100.0 + (100.0 * Math.pow((i / n), n))) / (i / n);
} else {
tmp = n * (1.0 / (0.01 + (0.01 * (i * ((0.5 / n) + -0.5)))));
}
return tmp;
}
def code(i, n): t_0 = (math.pow((1.0 + (i / n)), n) + -1.0) / (i / n) tmp = 0 if t_0 <= 2e-216: tmp = n * ((math.expm1((n * math.log1p((i / n)))) * 100.0) / i) elif t_0 <= math.inf: tmp = (-100.0 + (100.0 * math.pow((i / n), n))) / (i / n) else: tmp = n * (1.0 / (0.01 + (0.01 * (i * ((0.5 / n) + -0.5))))) return tmp
function code(i, n) t_0 = Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0) / Float64(i / n)) tmp = 0.0 if (t_0 <= 2e-216) tmp = Float64(n * Float64(Float64(expm1(Float64(n * log1p(Float64(i / n)))) * 100.0) / i)); elseif (t_0 <= Inf) tmp = Float64(Float64(-100.0 + Float64(100.0 * (Float64(i / n) ^ n))) / Float64(i / n)); else tmp = Float64(n * Float64(1.0 / Float64(0.01 + Float64(0.01 * Float64(i * Float64(Float64(0.5 / n) + -0.5)))))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 2e-216], N[(n * N[(N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] * 100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(N[(-100.0 + N[(100.0 * N[Power[N[(i / n), $MachinePrecision], n], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(n * N[(1.0 / N[(0.01 + N[(0.01 * N[(i * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}}\\
\mathbf{if}\;t\_0 \leq 2 \cdot 10^{-216}:\\
\;\;\;\;n \cdot \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot 100}{i}\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\frac{-100 + 100 \cdot {\left(\frac{i}{n}\right)}^{n}}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \frac{1}{0.01 + 0.01 \cdot \left(i \cdot \left(\frac{0.5}{n} + -0.5\right)\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)) < 2.0000000000000001e-216Initial program 30.3%
associate-/r/29.9%
associate-*r*29.9%
*-commutative29.9%
associate-*r/29.9%
sub-neg29.9%
distribute-lft-in29.9%
metadata-eval29.9%
metadata-eval29.9%
metadata-eval29.9%
fma-define29.9%
metadata-eval29.9%
Simplified29.9%
fma-undefine29.9%
metadata-eval29.9%
metadata-eval29.9%
distribute-lft-in29.9%
sub-neg29.9%
*-commutative29.9%
add-exp-log29.9%
expm1-define29.9%
log-pow37.4%
log1p-define96.6%
Applied egg-rr96.6%
if 2.0000000000000001e-216 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 98.8%
associate-*r/99.0%
sub-neg99.0%
distribute-rgt-in98.8%
metadata-eval98.8%
metadata-eval98.8%
Simplified98.8%
Taylor expanded in i around inf 98.8%
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.8%
associate-*r*1.8%
*-commutative1.8%
associate-*r/1.8%
sub-neg1.8%
distribute-lft-in1.8%
metadata-eval1.8%
metadata-eval1.8%
metadata-eval1.8%
fma-define1.8%
metadata-eval1.8%
Simplified1.8%
fma-undefine1.8%
metadata-eval1.8%
metadata-eval1.8%
distribute-lft-in1.8%
sub-neg1.8%
*-commutative1.8%
add-exp-log1.8%
expm1-define1.8%
log-pow1.8%
log1p-define1.8%
Applied egg-rr1.8%
clear-num1.8%
inv-pow1.8%
*-un-lft-identity1.8%
*-commutative1.8%
times-frac1.8%
metadata-eval1.8%
Applied egg-rr1.8%
unpow-11.8%
Simplified1.8%
Taylor expanded in i around 0 100.0%
sub-neg100.0%
associate-*r/100.0%
metadata-eval100.0%
metadata-eval100.0%
Simplified100.0%
Final simplification97.4%
(FPCore (i n) :precision binary64 (if (or (<= n -0.00014) (not (<= n 1.65e-5))) (* n (/ (* 100.0 (expm1 i)) i)) (* n (/ 1.0 (+ 0.01 (* 0.01 (* i (+ (/ 0.5 n) -0.5))))))))
double code(double i, double n) {
double tmp;
if ((n <= -0.00014) || !(n <= 1.65e-5)) {
tmp = n * ((100.0 * expm1(i)) / i);
} else {
tmp = n * (1.0 / (0.01 + (0.01 * (i * ((0.5 / n) + -0.5)))));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((n <= -0.00014) || !(n <= 1.65e-5)) {
tmp = n * ((100.0 * Math.expm1(i)) / i);
} else {
tmp = n * (1.0 / (0.01 + (0.01 * (i * ((0.5 / n) + -0.5)))));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -0.00014) or not (n <= 1.65e-5): tmp = n * ((100.0 * math.expm1(i)) / i) else: tmp = n * (1.0 / (0.01 + (0.01 * (i * ((0.5 / n) + -0.5))))) return tmp
function code(i, n) tmp = 0.0 if ((n <= -0.00014) || !(n <= 1.65e-5)) tmp = Float64(n * Float64(Float64(100.0 * expm1(i)) / i)); else tmp = Float64(n * Float64(1.0 / Float64(0.01 + Float64(0.01 * Float64(i * Float64(Float64(0.5 / n) + -0.5)))))); end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -0.00014], N[Not[LessEqual[n, 1.65e-5]], $MachinePrecision]], N[(n * N[(N[(100.0 * N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(n * N[(1.0 / N[(0.01 + N[(0.01 * N[(i * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -0.00014 \lor \neg \left(n \leq 1.65 \cdot 10^{-5}\right):\\
\;\;\;\;n \cdot \frac{100 \cdot \mathsf{expm1}\left(i\right)}{i}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \frac{1}{0.01 + 0.01 \cdot \left(i \cdot \left(\frac{0.5}{n} + -0.5\right)\right)}\\
\end{array}
\end{array}
if n < -1.3999999999999999e-4 or 1.6500000000000001e-5 < n Initial program 26.0%
associate-/r/26.5%
associate-*r*26.5%
*-commutative26.5%
associate-*r/26.6%
sub-neg26.6%
distribute-lft-in26.6%
metadata-eval26.6%
metadata-eval26.6%
metadata-eval26.6%
fma-define26.6%
metadata-eval26.6%
Simplified26.6%
Taylor expanded in n around inf 39.7%
sub-neg39.7%
metadata-eval39.7%
metadata-eval39.7%
distribute-lft-in39.7%
metadata-eval39.7%
sub-neg39.7%
expm1-define91.4%
Simplified91.4%
if -1.3999999999999999e-4 < n < 1.6500000000000001e-5Initial program 34.6%
associate-/r/34.0%
associate-*r*34.0%
*-commutative34.0%
associate-*r/34.0%
sub-neg34.0%
distribute-lft-in34.0%
metadata-eval34.0%
metadata-eval34.0%
metadata-eval34.0%
fma-define34.0%
metadata-eval34.0%
Simplified34.0%
fma-undefine34.0%
metadata-eval34.0%
metadata-eval34.0%
distribute-lft-in34.0%
sub-neg34.0%
*-commutative34.0%
add-exp-log34.0%
expm1-define34.0%
log-pow50.3%
log1p-define84.8%
Applied egg-rr84.8%
clear-num84.8%
inv-pow84.8%
*-un-lft-identity84.8%
*-commutative84.8%
times-frac84.8%
metadata-eval84.8%
Applied egg-rr84.8%
unpow-184.8%
Simplified84.8%
Taylor expanded in i around 0 84.5%
sub-neg84.5%
associate-*r/84.5%
metadata-eval84.5%
metadata-eval84.5%
Simplified84.5%
Final simplification88.6%
(FPCore (i n)
:precision binary64
(if (<= n -0.00015)
(* n (/ (* 100.0 (expm1 i)) i))
(if (<= n 1.65e-5)
(* n (/ 1.0 (+ 0.01 (* 0.01 (* i (+ (/ 0.5 n) -0.5))))))
(* 100.0 (* n (/ (expm1 i) i))))))
double code(double i, double n) {
double tmp;
if (n <= -0.00015) {
tmp = n * ((100.0 * expm1(i)) / i);
} else if (n <= 1.65e-5) {
tmp = n * (1.0 / (0.01 + (0.01 * (i * ((0.5 / n) + -0.5)))));
} else {
tmp = 100.0 * (n * (expm1(i) / i));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if (n <= -0.00015) {
tmp = n * ((100.0 * Math.expm1(i)) / i);
} else if (n <= 1.65e-5) {
tmp = n * (1.0 / (0.01 + (0.01 * (i * ((0.5 / n) + -0.5)))));
} else {
tmp = 100.0 * (n * (Math.expm1(i) / i));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -0.00015: tmp = n * ((100.0 * math.expm1(i)) / i) elif n <= 1.65e-5: tmp = n * (1.0 / (0.01 + (0.01 * (i * ((0.5 / n) + -0.5))))) else: tmp = 100.0 * (n * (math.expm1(i) / i)) return tmp
function code(i, n) tmp = 0.0 if (n <= -0.00015) tmp = Float64(n * Float64(Float64(100.0 * expm1(i)) / i)); elseif (n <= 1.65e-5) tmp = Float64(n * Float64(1.0 / Float64(0.01 + Float64(0.01 * Float64(i * Float64(Float64(0.5 / n) + -0.5)))))); else tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); end return tmp end
code[i_, n_] := If[LessEqual[n, -0.00015], N[(n * N[(N[(100.0 * N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.65e-5], N[(n * N[(1.0 / N[(0.01 + N[(0.01 * N[(i * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -0.00015:\\
\;\;\;\;n \cdot \frac{100 \cdot \mathsf{expm1}\left(i\right)}{i}\\
\mathbf{elif}\;n \leq 1.65 \cdot 10^{-5}:\\
\;\;\;\;n \cdot \frac{1}{0.01 + 0.01 \cdot \left(i \cdot \left(\frac{0.5}{n} + -0.5\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\end{array}
\end{array}
if n < -1.49999999999999987e-4Initial program 31.0%
associate-/r/31.4%
associate-*r*31.4%
*-commutative31.4%
associate-*r/31.5%
sub-neg31.5%
distribute-lft-in31.5%
metadata-eval31.5%
metadata-eval31.5%
metadata-eval31.5%
fma-define31.5%
metadata-eval31.5%
Simplified31.5%
Taylor expanded in n around inf 37.0%
sub-neg37.0%
metadata-eval37.0%
metadata-eval37.0%
distribute-lft-in37.0%
metadata-eval37.0%
sub-neg37.0%
expm1-define88.1%
Simplified88.1%
if -1.49999999999999987e-4 < n < 1.6500000000000001e-5Initial program 34.6%
associate-/r/34.0%
associate-*r*34.0%
*-commutative34.0%
associate-*r/34.0%
sub-neg34.0%
distribute-lft-in34.0%
metadata-eval34.0%
metadata-eval34.0%
metadata-eval34.0%
fma-define34.0%
metadata-eval34.0%
Simplified34.0%
fma-undefine34.0%
metadata-eval34.0%
metadata-eval34.0%
distribute-lft-in34.0%
sub-neg34.0%
*-commutative34.0%
add-exp-log34.0%
expm1-define34.0%
log-pow50.3%
log1p-define84.8%
Applied egg-rr84.8%
clear-num84.8%
inv-pow84.8%
*-un-lft-identity84.8%
*-commutative84.8%
times-frac84.8%
metadata-eval84.8%
Applied egg-rr84.8%
unpow-184.8%
Simplified84.8%
Taylor expanded in i around 0 84.5%
sub-neg84.5%
associate-*r/84.5%
metadata-eval84.5%
metadata-eval84.5%
Simplified84.5%
if 1.6500000000000001e-5 < n Initial program 20.1%
Taylor expanded in n around inf 43.0%
*-commutative43.0%
associate-/l*43.0%
expm1-define95.6%
Simplified95.6%
Final simplification88.7%
(FPCore (i n)
:precision binary64
(if (<= n -6e+92)
(* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668)))))
(if (<= n 1.65e-5)
(* 100.0 (/ i (/ i n)))
(*
n
(+
100.0
(* i (+ 50.0 (* i (+ 16.666666666666668 (* i 4.166666666666667))))))))))
double code(double i, double n) {
double tmp;
if (n <= -6e+92) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= 1.65e-5) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-6d+92)) then
tmp = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
else if (n <= 1.65d-5) then
tmp = 100.0d0 * (i / (i / n))
else
tmp = n * (100.0d0 + (i * (50.0d0 + (i * (16.666666666666668d0 + (i * 4.166666666666667d0))))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -6e+92) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= 1.65e-5) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -6e+92: tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) elif n <= 1.65e-5: tmp = 100.0 * (i / (i / n)) else: tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667)))))) return tmp
function code(i, n) tmp = 0.0 if (n <= -6e+92) tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))); elseif (n <= 1.65e-5) tmp = Float64(100.0 * Float64(i / Float64(i / n))); else tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * Float64(16.666666666666668 + Float64(i * 4.166666666666667))))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -6e+92) tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); elseif (n <= 1.65e-5) tmp = 100.0 * (i / (i / n)); else tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667)))))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -6e+92], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.65e-5], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * N[(16.666666666666668 + N[(i * 4.166666666666667), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -6 \cdot 10^{+92}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\mathbf{elif}\;n \leq 1.65 \cdot 10^{-5}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot \left(16.666666666666668 + i \cdot 4.166666666666667\right)\right)\right)\\
\end{array}
\end{array}
if n < -6.00000000000000026e92Initial program 24.1%
associate-/r/24.7%
associate-*r*24.7%
*-commutative24.7%
associate-*r/24.8%
sub-neg24.8%
distribute-lft-in24.8%
metadata-eval24.8%
metadata-eval24.8%
metadata-eval24.8%
fma-define24.8%
metadata-eval24.8%
Simplified24.8%
Taylor expanded in n around inf 35.3%
sub-neg35.3%
metadata-eval35.3%
metadata-eval35.3%
distribute-lft-in35.4%
metadata-eval35.4%
sub-neg35.4%
expm1-define88.3%
Simplified88.3%
Taylor expanded in i around 0 64.5%
*-commutative64.5%
Simplified64.5%
if -6.00000000000000026e92 < n < 1.6500000000000001e-5Initial program 37.1%
Taylor expanded in i around 0 64.7%
if 1.6500000000000001e-5 < n Initial program 20.1%
associate-/r/20.6%
associate-*r*20.6%
*-commutative20.6%
associate-*r/20.6%
sub-neg20.6%
distribute-lft-in20.6%
metadata-eval20.6%
metadata-eval20.6%
metadata-eval20.6%
fma-define20.6%
metadata-eval20.6%
Simplified20.6%
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-define95.5%
Simplified95.5%
Taylor expanded in i around 0 78.9%
*-commutative78.9%
Simplified78.9%
(FPCore (i n)
:precision binary64
(if (<= n 1.65e-5)
(* n (/ 1.0 (+ 0.01 (* 0.01 (* i (+ (/ 0.5 n) -0.5))))))
(*
n
(/
(*
i
(+
100.0
(* i (+ 50.0 (* i (+ 16.666666666666668 (* i 4.166666666666667)))))))
i))))
double code(double i, double n) {
double tmp;
if (n <= 1.65e-5) {
tmp = n * (1.0 / (0.01 + (0.01 * (i * ((0.5 / n) + -0.5)))));
} else {
tmp = n * ((i * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))))) / i);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= 1.65d-5) then
tmp = n * (1.0d0 / (0.01d0 + (0.01d0 * (i * ((0.5d0 / n) + (-0.5d0))))))
else
tmp = n * ((i * (100.0d0 + (i * (50.0d0 + (i * (16.666666666666668d0 + (i * 4.166666666666667d0))))))) / i)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= 1.65e-5) {
tmp = n * (1.0 / (0.01 + (0.01 * (i * ((0.5 / n) + -0.5)))));
} else {
tmp = n * ((i * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))))) / i);
}
return tmp;
}
def code(i, n): tmp = 0 if n <= 1.65e-5: tmp = n * (1.0 / (0.01 + (0.01 * (i * ((0.5 / n) + -0.5))))) else: tmp = n * ((i * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))))) / i) return tmp
function code(i, n) tmp = 0.0 if (n <= 1.65e-5) tmp = Float64(n * Float64(1.0 / Float64(0.01 + Float64(0.01 * Float64(i * Float64(Float64(0.5 / n) + -0.5)))))); else tmp = Float64(n * Float64(Float64(i * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * Float64(16.666666666666668 + Float64(i * 4.166666666666667))))))) / i)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= 1.65e-5) tmp = n * (1.0 / (0.01 + (0.01 * (i * ((0.5 / n) + -0.5))))); else tmp = n * ((i * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))))) / i); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, 1.65e-5], N[(n * N[(1.0 / N[(0.01 + N[(0.01 * N[(i * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(N[(i * N[(100.0 + N[(i * N[(50.0 + N[(i * N[(16.666666666666668 + N[(i * 4.166666666666667), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 1.65 \cdot 10^{-5}:\\
\;\;\;\;n \cdot \frac{1}{0.01 + 0.01 \cdot \left(i \cdot \left(\frac{0.5}{n} + -0.5\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \frac{i \cdot \left(100 + i \cdot \left(50 + i \cdot \left(16.666666666666668 + i \cdot 4.166666666666667\right)\right)\right)}{i}\\
\end{array}
\end{array}
if n < 1.6500000000000001e-5Initial program 33.0%
associate-/r/32.9%
associate-*r*32.9%
*-commutative32.9%
associate-*r/32.9%
sub-neg32.9%
distribute-lft-in32.9%
metadata-eval32.9%
metadata-eval32.9%
metadata-eval32.9%
fma-define32.9%
metadata-eval32.9%
Simplified32.9%
fma-undefine32.9%
metadata-eval32.9%
metadata-eval32.9%
distribute-lft-in32.9%
sub-neg32.9%
*-commutative32.9%
add-exp-log32.9%
expm1-define32.9%
log-pow37.2%
log1p-define76.8%
Applied egg-rr76.8%
clear-num76.8%
inv-pow76.8%
*-un-lft-identity76.8%
*-commutative76.8%
times-frac76.8%
metadata-eval76.8%
Applied egg-rr76.8%
unpow-176.8%
Simplified76.8%
Taylor expanded in i around 0 73.8%
sub-neg73.8%
associate-*r/73.8%
metadata-eval73.8%
metadata-eval73.8%
Simplified73.8%
if 1.6500000000000001e-5 < n Initial program 20.1%
associate-/r/20.6%
associate-*r*20.6%
*-commutative20.6%
associate-*r/20.6%
sub-neg20.6%
distribute-lft-in20.6%
metadata-eval20.6%
metadata-eval20.6%
metadata-eval20.6%
fma-define20.6%
metadata-eval20.6%
Simplified20.6%
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-define95.5%
Simplified95.5%
Taylor expanded in i around 0 80.2%
*-commutative80.2%
Simplified80.2%
(FPCore (i n)
:precision binary64
(if (<= n 1.65e-5)
(* n (/ 1.0 (+ 0.01 (* 0.01 (* i (+ (/ 0.5 n) -0.5))))))
(*
100.0
(*
n
(+
1.0
(*
i
(+ 0.5 (* i (+ 0.16666666666666666 (* i 0.041666666666666664))))))))))
double code(double i, double n) {
double tmp;
if (n <= 1.65e-5) {
tmp = n * (1.0 / (0.01 + (0.01 * (i * ((0.5 / n) + -0.5)))));
} else {
tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * (0.16666666666666666 + (i * 0.041666666666666664)))))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= 1.65d-5) then
tmp = n * (1.0d0 / (0.01d0 + (0.01d0 * (i * ((0.5d0 / n) + (-0.5d0))))))
else
tmp = 100.0d0 * (n * (1.0d0 + (i * (0.5d0 + (i * (0.16666666666666666d0 + (i * 0.041666666666666664d0)))))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= 1.65e-5) {
tmp = n * (1.0 / (0.01 + (0.01 * (i * ((0.5 / n) + -0.5)))));
} else {
tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * (0.16666666666666666 + (i * 0.041666666666666664)))))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= 1.65e-5: tmp = n * (1.0 / (0.01 + (0.01 * (i * ((0.5 / n) + -0.5))))) else: tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * (0.16666666666666666 + (i * 0.041666666666666664))))))) return tmp
function code(i, n) tmp = 0.0 if (n <= 1.65e-5) tmp = Float64(n * Float64(1.0 / Float64(0.01 + Float64(0.01 * Float64(i * Float64(Float64(0.5 / n) + -0.5)))))); else tmp = Float64(100.0 * Float64(n * Float64(1.0 + Float64(i * Float64(0.5 + Float64(i * Float64(0.16666666666666666 + Float64(i * 0.041666666666666664)))))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= 1.65e-5) tmp = n * (1.0 / (0.01 + (0.01 * (i * ((0.5 / n) + -0.5))))); else tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * (0.16666666666666666 + (i * 0.041666666666666664))))))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, 1.65e-5], N[(n * N[(1.0 / N[(0.01 + N[(0.01 * N[(i * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n * N[(1.0 + N[(i * N[(0.5 + N[(i * N[(0.16666666666666666 + N[(i * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 1.65 \cdot 10^{-5}:\\
\;\;\;\;n \cdot \frac{1}{0.01 + 0.01 \cdot \left(i \cdot \left(\frac{0.5}{n} + -0.5\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n \cdot \left(1 + i \cdot \left(0.5 + i \cdot \left(0.16666666666666666 + i \cdot 0.041666666666666664\right)\right)\right)\right)\\
\end{array}
\end{array}
if n < 1.6500000000000001e-5Initial program 33.0%
associate-/r/32.9%
associate-*r*32.9%
*-commutative32.9%
associate-*r/32.9%
sub-neg32.9%
distribute-lft-in32.9%
metadata-eval32.9%
metadata-eval32.9%
metadata-eval32.9%
fma-define32.9%
metadata-eval32.9%
Simplified32.9%
fma-undefine32.9%
metadata-eval32.9%
metadata-eval32.9%
distribute-lft-in32.9%
sub-neg32.9%
*-commutative32.9%
add-exp-log32.9%
expm1-define32.9%
log-pow37.2%
log1p-define76.8%
Applied egg-rr76.8%
clear-num76.8%
inv-pow76.8%
*-un-lft-identity76.8%
*-commutative76.8%
times-frac76.8%
metadata-eval76.8%
Applied egg-rr76.8%
unpow-176.8%
Simplified76.8%
Taylor expanded in i around 0 73.8%
sub-neg73.8%
associate-*r/73.8%
metadata-eval73.8%
metadata-eval73.8%
Simplified73.8%
if 1.6500000000000001e-5 < n Initial program 20.1%
Taylor expanded in n around inf 43.0%
*-commutative43.0%
associate-/l*43.0%
expm1-define95.6%
Simplified95.6%
Taylor expanded in i around 0 78.9%
*-commutative78.9%
Simplified78.9%
Final simplification75.2%
(FPCore (i n) :precision binary64 (if (or (<= n -6e+92) (not (<= n 6e+16))) (* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668))))) (* 100.0 (/ i (/ i n)))))
double code(double i, double n) {
double tmp;
if ((n <= -6e+92) || !(n <= 6e+16)) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-6d+92)) .or. (.not. (n <= 6d+16))) then
tmp = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
else
tmp = 100.0d0 * (i / (i / n))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -6e+92) || !(n <= 6e+16)) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -6e+92) or not (n <= 6e+16): tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) else: tmp = 100.0 * (i / (i / n)) return tmp
function code(i, n) tmp = 0.0 if ((n <= -6e+92) || !(n <= 6e+16)) tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))); else tmp = Float64(100.0 * Float64(i / Float64(i / n))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -6e+92) || ~((n <= 6e+16))) tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); else tmp = 100.0 * (i / (i / n)); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -6e+92], N[Not[LessEqual[n, 6e+16]], $MachinePrecision]], 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[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -6 \cdot 10^{+92} \lor \neg \left(n \leq 6 \cdot 10^{+16}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -6.00000000000000026e92 or 6e16 < n Initial program 21.5%
associate-/r/22.1%
associate-*r*22.1%
*-commutative22.1%
associate-*r/22.1%
sub-neg22.1%
distribute-lft-in22.1%
metadata-eval22.1%
metadata-eval22.1%
metadata-eval22.1%
fma-define22.1%
metadata-eval22.1%
Simplified22.1%
Taylor expanded in n around inf 40.0%
sub-neg40.0%
metadata-eval40.0%
metadata-eval40.0%
distribute-lft-in40.0%
metadata-eval40.0%
sub-neg40.0%
expm1-define92.8%
Simplified92.8%
Taylor expanded in i around 0 70.3%
*-commutative70.3%
Simplified70.3%
if -6.00000000000000026e92 < n < 6e16Initial program 37.4%
Taylor expanded in i around 0 64.5%
Final simplification67.4%
(FPCore (i n)
:precision binary64
(if (<= n 1.65e-5)
(* n (/ 1.0 (+ 0.01 (* 0.01 (* i (+ (/ 0.5 n) -0.5))))))
(*
n
(+
100.0
(* i (+ 50.0 (* i (+ 16.666666666666668 (* i 4.166666666666667)))))))))
double code(double i, double n) {
double tmp;
if (n <= 1.65e-5) {
tmp = n * (1.0 / (0.01 + (0.01 * (i * ((0.5 / n) + -0.5)))));
} else {
tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= 1.65d-5) then
tmp = n * (1.0d0 / (0.01d0 + (0.01d0 * (i * ((0.5d0 / n) + (-0.5d0))))))
else
tmp = n * (100.0d0 + (i * (50.0d0 + (i * (16.666666666666668d0 + (i * 4.166666666666667d0))))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= 1.65e-5) {
tmp = n * (1.0 / (0.01 + (0.01 * (i * ((0.5 / n) + -0.5)))));
} else {
tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= 1.65e-5: tmp = n * (1.0 / (0.01 + (0.01 * (i * ((0.5 / n) + -0.5))))) else: tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667)))))) return tmp
function code(i, n) tmp = 0.0 if (n <= 1.65e-5) tmp = Float64(n * Float64(1.0 / Float64(0.01 + Float64(0.01 * Float64(i * Float64(Float64(0.5 / n) + -0.5)))))); else tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * Float64(16.666666666666668 + Float64(i * 4.166666666666667))))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= 1.65e-5) tmp = n * (1.0 / (0.01 + (0.01 * (i * ((0.5 / n) + -0.5))))); else tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667)))))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, 1.65e-5], N[(n * N[(1.0 / N[(0.01 + N[(0.01 * N[(i * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * N[(16.666666666666668 + N[(i * 4.166666666666667), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 1.65 \cdot 10^{-5}:\\
\;\;\;\;n \cdot \frac{1}{0.01 + 0.01 \cdot \left(i \cdot \left(\frac{0.5}{n} + -0.5\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot \left(16.666666666666668 + i \cdot 4.166666666666667\right)\right)\right)\\
\end{array}
\end{array}
if n < 1.6500000000000001e-5Initial program 33.0%
associate-/r/32.9%
associate-*r*32.9%
*-commutative32.9%
associate-*r/32.9%
sub-neg32.9%
distribute-lft-in32.9%
metadata-eval32.9%
metadata-eval32.9%
metadata-eval32.9%
fma-define32.9%
metadata-eval32.9%
Simplified32.9%
fma-undefine32.9%
metadata-eval32.9%
metadata-eval32.9%
distribute-lft-in32.9%
sub-neg32.9%
*-commutative32.9%
add-exp-log32.9%
expm1-define32.9%
log-pow37.2%
log1p-define76.8%
Applied egg-rr76.8%
clear-num76.8%
inv-pow76.8%
*-un-lft-identity76.8%
*-commutative76.8%
times-frac76.8%
metadata-eval76.8%
Applied egg-rr76.8%
unpow-176.8%
Simplified76.8%
Taylor expanded in i around 0 73.8%
sub-neg73.8%
associate-*r/73.8%
metadata-eval73.8%
metadata-eval73.8%
Simplified73.8%
if 1.6500000000000001e-5 < n Initial program 20.1%
associate-/r/20.6%
associate-*r*20.6%
*-commutative20.6%
associate-*r/20.6%
sub-neg20.6%
distribute-lft-in20.6%
metadata-eval20.6%
metadata-eval20.6%
metadata-eval20.6%
fma-define20.6%
metadata-eval20.6%
Simplified20.6%
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-define95.5%
Simplified95.5%
Taylor expanded in i around 0 78.9%
*-commutative78.9%
Simplified78.9%
(FPCore (i n) :precision binary64 (if (or (<= n -7.8e+93) (not (<= n 1.05e-5))) (* n (+ 100.0 (* i 50.0))) (* 100.0 (/ i (/ i n)))))
double code(double i, double n) {
double tmp;
if ((n <= -7.8e+93) || !(n <= 1.05e-5)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-7.8d+93)) .or. (.not. (n <= 1.05d-5))) then
tmp = n * (100.0d0 + (i * 50.0d0))
else
tmp = 100.0d0 * (i / (i / n))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -7.8e+93) || !(n <= 1.05e-5)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -7.8e+93) or not (n <= 1.05e-5): tmp = n * (100.0 + (i * 50.0)) else: tmp = 100.0 * (i / (i / n)) return tmp
function code(i, n) tmp = 0.0 if ((n <= -7.8e+93) || !(n <= 1.05e-5)) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); else tmp = Float64(100.0 * Float64(i / Float64(i / n))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -7.8e+93) || ~((n <= 1.05e-5))) tmp = n * (100.0 + (i * 50.0)); else tmp = 100.0 * (i / (i / n)); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -7.8e+93], N[Not[LessEqual[n, 1.05e-5]], $MachinePrecision]], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -7.8 \cdot 10^{+93} \lor \neg \left(n \leq 1.05 \cdot 10^{-5}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -7.8000000000000005e93 or 1.04999999999999994e-5 < n Initial program 22.0%
associate-/r/22.5%
associate-*r*22.5%
*-commutative22.5%
associate-*r/22.5%
sub-neg22.5%
distribute-lft-in22.5%
metadata-eval22.5%
metadata-eval22.5%
metadata-eval22.5%
fma-define22.5%
metadata-eval22.5%
Simplified22.5%
Taylor expanded in n around inf 39.4%
sub-neg39.4%
metadata-eval39.4%
metadata-eval39.4%
distribute-lft-in39.4%
metadata-eval39.4%
sub-neg39.4%
expm1-define92.1%
Simplified92.1%
Taylor expanded in i around 0 64.9%
*-commutative64.9%
Simplified64.9%
if -7.8000000000000005e93 < n < 1.04999999999999994e-5Initial program 37.1%
Taylor expanded in i around 0 64.7%
Final simplification64.8%
(FPCore (i n) :precision binary64 (if (or (<= i -1e+128) (not (<= i 1e-14))) (* 100.0 (/ i (/ i n))) (* n 100.0)))
double code(double i, double n) {
double tmp;
if ((i <= -1e+128) || !(i <= 1e-14)) {
tmp = 100.0 * (i / (i / n));
} 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 <= (-1d+128)) .or. (.not. (i <= 1d-14))) then
tmp = 100.0d0 * (i / (i / n))
else
tmp = n * 100.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((i <= -1e+128) || !(i <= 1e-14)) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = n * 100.0;
}
return tmp;
}
def code(i, n): tmp = 0 if (i <= -1e+128) or not (i <= 1e-14): tmp = 100.0 * (i / (i / n)) else: tmp = n * 100.0 return tmp
function code(i, n) tmp = 0.0 if ((i <= -1e+128) || !(i <= 1e-14)) tmp = Float64(100.0 * Float64(i / Float64(i / n))); else tmp = Float64(n * 100.0); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((i <= -1e+128) || ~((i <= 1e-14))) tmp = 100.0 * (i / (i / n)); else tmp = n * 100.0; end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[i, -1e+128], N[Not[LessEqual[i, 1e-14]], $MachinePrecision]], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -1 \cdot 10^{+128} \lor \neg \left(i \leq 10^{-14}\right):\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if i < -1.0000000000000001e128 or 9.99999999999999999e-15 < i Initial program 57.9%
Taylor expanded in i around 0 36.4%
if -1.0000000000000001e128 < i < 9.99999999999999999e-15Initial program 12.7%
Taylor expanded in i around 0 75.4%
*-commutative75.4%
Simplified75.4%
Final simplification60.9%
(FPCore (i n) :precision binary64 (if (or (<= i -3e+111) (not (<= i 5e-22))) (* 100.0 (* i (/ n i))) (* n 100.0)))
double code(double i, double n) {
double tmp;
if ((i <= -3e+111) || !(i <= 5e-22)) {
tmp = 100.0 * (i * (n / i));
} else {
tmp = n * 100.0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((i <= (-3d+111)) .or. (.not. (i <= 5d-22))) then
tmp = 100.0d0 * (i * (n / i))
else
tmp = n * 100.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((i <= -3e+111) || !(i <= 5e-22)) {
tmp = 100.0 * (i * (n / i));
} else {
tmp = n * 100.0;
}
return tmp;
}
def code(i, n): tmp = 0 if (i <= -3e+111) or not (i <= 5e-22): tmp = 100.0 * (i * (n / i)) else: tmp = n * 100.0 return tmp
function code(i, n) tmp = 0.0 if ((i <= -3e+111) || !(i <= 5e-22)) tmp = Float64(100.0 * Float64(i * Float64(n / i))); else tmp = Float64(n * 100.0); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((i <= -3e+111) || ~((i <= 5e-22))) tmp = 100.0 * (i * (n / i)); else tmp = n * 100.0; end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[i, -3e+111], N[Not[LessEqual[i, 5e-22]], $MachinePrecision]], N[(100.0 * N[(i * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -3 \cdot 10^{+111} \lor \neg \left(i \leq 5 \cdot 10^{-22}\right):\\
\;\;\;\;100 \cdot \left(i \cdot \frac{n}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if i < -3e111 or 4.99999999999999954e-22 < i Initial program 55.0%
Taylor expanded in i around 0 36.1%
div-inv36.1%
clear-num34.2%
Applied egg-rr34.2%
if -3e111 < i < 4.99999999999999954e-22Initial program 12.6%
Taylor expanded in i around 0 77.4%
*-commutative77.4%
Simplified77.4%
Final simplification60.2%
(FPCore (i n) :precision binary64 (if (<= n -1.7e+125) (/ 1.0 (* 0.01 (/ i (* i n)))) (if (<= n 1.65e-5) (* 100.0 (/ i (/ i n))) (* n (+ 100.0 (* i 50.0))))))
double code(double i, double n) {
double tmp;
if (n <= -1.7e+125) {
tmp = 1.0 / (0.01 * (i / (i * n)));
} else if (n <= 1.65e-5) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-1.7d+125)) then
tmp = 1.0d0 / (0.01d0 * (i / (i * n)))
else if (n <= 1.65d-5) then
tmp = 100.0d0 * (i / (i / n))
else
tmp = n * (100.0d0 + (i * 50.0d0))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -1.7e+125) {
tmp = 1.0 / (0.01 * (i / (i * n)));
} else if (n <= 1.65e-5) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -1.7e+125: tmp = 1.0 / (0.01 * (i / (i * n))) elif n <= 1.65e-5: tmp = 100.0 * (i / (i / n)) else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) tmp = 0.0 if (n <= -1.7e+125) tmp = Float64(1.0 / Float64(0.01 * Float64(i / Float64(i * n)))); elseif (n <= 1.65e-5) tmp = Float64(100.0 * Float64(i / Float64(i / n))); else tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -1.7e+125) tmp = 1.0 / (0.01 * (i / (i * n))); elseif (n <= 1.65e-5) tmp = 100.0 * (i / (i / n)); else tmp = n * (100.0 + (i * 50.0)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -1.7e+125], N[(1.0 / N[(0.01 * N[(i / N[(i * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.65e-5], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.7 \cdot 10^{+125}:\\
\;\;\;\;\frac{1}{0.01 \cdot \frac{i}{i \cdot n}}\\
\mathbf{elif}\;n \leq 1.65 \cdot 10^{-5}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < -1.6999999999999999e125Initial program 22.2%
Taylor expanded in i around 0 26.3%
associate-*r/26.2%
*-commutative26.2%
clear-num26.2%
Applied egg-rr26.2%
*-un-lft-identity26.2%
*-un-lft-identity26.2%
*-commutative26.2%
times-frac26.2%
metadata-eval26.2%
Applied egg-rr26.2%
*-lft-identity26.2%
associate-/l/63.6%
Simplified63.6%
if -1.6999999999999999e125 < n < 1.6500000000000001e-5Initial program 37.6%
Taylor expanded in i around 0 64.0%
if 1.6500000000000001e-5 < n Initial program 20.1%
associate-/r/20.6%
associate-*r*20.6%
*-commutative20.6%
associate-*r/20.6%
sub-neg20.6%
distribute-lft-in20.6%
metadata-eval20.6%
metadata-eval20.6%
metadata-eval20.6%
fma-define20.6%
metadata-eval20.6%
Simplified20.6%
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-define95.5%
Simplified95.5%
Taylor expanded in i around 0 67.4%
*-commutative67.4%
Simplified67.4%
(FPCore (i n) :precision binary64 (if (<= i -1e+128) (* 100.0 (/ i (/ i n))) (if (<= i 2.1e-19) (* n 100.0) (* i (/ 100.0 (/ i n))))))
double code(double i, double n) {
double tmp;
if (i <= -1e+128) {
tmp = 100.0 * (i / (i / n));
} else if (i <= 2.1e-19) {
tmp = n * 100.0;
} else {
tmp = i * (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 <= (-1d+128)) then
tmp = 100.0d0 * (i / (i / n))
else if (i <= 2.1d-19) then
tmp = n * 100.0d0
else
tmp = i * (100.0d0 / (i / n))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= -1e+128) {
tmp = 100.0 * (i / (i / n));
} else if (i <= 2.1e-19) {
tmp = n * 100.0;
} else {
tmp = i * (100.0 / (i / n));
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -1e+128: tmp = 100.0 * (i / (i / n)) elif i <= 2.1e-19: tmp = n * 100.0 else: tmp = i * (100.0 / (i / n)) return tmp
function code(i, n) tmp = 0.0 if (i <= -1e+128) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (i <= 2.1e-19) tmp = Float64(n * 100.0); else tmp = Float64(i * Float64(100.0 / Float64(i / n))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -1e+128) tmp = 100.0 * (i / (i / n)); elseif (i <= 2.1e-19) tmp = n * 100.0; else tmp = i * (100.0 / (i / n)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -1e+128], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 2.1e-19], N[(n * 100.0), $MachinePrecision], N[(i * N[(100.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -1 \cdot 10^{+128}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;i \leq 2.1 \cdot 10^{-19}:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;i \cdot \frac{100}{\frac{i}{n}}\\
\end{array}
\end{array}
if i < -1.0000000000000001e128Initial program 91.7%
Taylor expanded in i around 0 55.3%
if -1.0000000000000001e128 < i < 2.0999999999999999e-19Initial program 12.8%
Taylor expanded in i around 0 75.3%
*-commutative75.3%
Simplified75.3%
if 2.0999999999999999e-19 < i Initial program 43.2%
Taylor expanded in i around 0 29.5%
associate-*r/29.5%
*-commutative29.5%
Applied egg-rr29.5%
associate-/l*29.5%
Simplified29.5%
(FPCore (i n) :precision binary64 (* n 100.0))
double code(double i, double n) {
return n * 100.0;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = n * 100.0d0
end function
public static double code(double i, double n) {
return n * 100.0;
}
def code(i, n): return n * 100.0
function code(i, n) return Float64(n * 100.0) end
function tmp = code(i, n) tmp = n * 100.0; end
code[i_, n_] := N[(n * 100.0), $MachinePrecision]
\begin{array}{l}
\\
n \cdot 100
\end{array}
Initial program 29.5%
Taylor expanded in i around 0 49.9%
*-commutative49.9%
Simplified49.9%
(FPCore (i n)
:precision binary64
(let* ((t_0 (+ 1.0 (/ i n))))
(*
100.0
(/
(-
(exp
(*
n
(if (== t_0 1.0)
(/ i n)
(/ (* (/ i n) (log t_0)) (- (+ (/ i n) 1.0) 1.0)))))
1.0)
(/ i n)))))
double code(double i, double n) {
double t_0 = 1.0 + (i / n);
double tmp;
if (t_0 == 1.0) {
tmp = i / n;
} else {
tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0) - 1.0);
}
return 100.0 * ((exp((n * tmp)) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + (i / n)
if (t_0 == 1.0d0) then
tmp = i / n
else
tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0d0) - 1.0d0)
end if
code = 100.0d0 * ((exp((n * tmp)) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
double t_0 = 1.0 + (i / n);
double tmp;
if (t_0 == 1.0) {
tmp = i / n;
} else {
tmp = ((i / n) * Math.log(t_0)) / (((i / n) + 1.0) - 1.0);
}
return 100.0 * ((Math.exp((n * tmp)) - 1.0) / (i / n));
}
def code(i, n): t_0 = 1.0 + (i / n) tmp = 0 if t_0 == 1.0: tmp = i / n else: tmp = ((i / n) * math.log(t_0)) / (((i / n) + 1.0) - 1.0) return 100.0 * ((math.exp((n * tmp)) - 1.0) / (i / n))
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) tmp = 0.0 if (t_0 == 1.0) tmp = Float64(i / n); else tmp = Float64(Float64(Float64(i / n) * log(t_0)) / Float64(Float64(Float64(i / n) + 1.0) - 1.0)); end return Float64(100.0 * Float64(Float64(exp(Float64(n * tmp)) - 1.0) / Float64(i / n))) end
function tmp_2 = code(i, n) t_0 = 1.0 + (i / n); tmp = 0.0; if (t_0 == 1.0) tmp = i / n; else tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0) - 1.0); end tmp_2 = 100.0 * ((exp((n * tmp)) - 1.0) / (i / n)); end
code[i_, n_] := Block[{t$95$0 = N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision]}, N[(100.0 * N[(N[(N[Exp[N[(n * If[Equal[t$95$0, 1.0], N[(i / n), $MachinePrecision], N[(N[(N[(i / n), $MachinePrecision] * N[Log[t$95$0], $MachinePrecision]), $MachinePrecision] / N[(N[(N[(i / n), $MachinePrecision] + 1.0), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{i}{n}\\
100 \cdot \frac{e^{n \cdot \begin{array}{l}
\mathbf{if}\;t\_0 = 1:\\
\;\;\;\;\frac{i}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{i}{n} \cdot \log t\_0}{\left(\frac{i}{n} + 1\right) - 1}\\
\end{array}} - 1}{\frac{i}{n}}
\end{array}
\end{array}
herbie shell --seed 2024113
(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))))