
(FPCore (i n) :precision binary64 (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))
double code(double i, double n) {
return 100.0 * ((pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 100.0d0 * ((((1.0d0 + (i / n)) ** n) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
return 100.0 * ((Math.pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
def code(i, n): return 100.0 * ((math.pow((1.0 + (i / n)), n) - 1.0) / (i / n))
function code(i, n) return Float64(100.0 * Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) - 1.0) / Float64(i / n))) end
function tmp = code(i, n) tmp = 100.0 * ((((1.0 + (i / n)) ^ n) - 1.0) / (i / n)); end
code[i_, n_] := N[(100.0 * N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 20 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (i n) :precision binary64 (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))
double code(double i, double n) {
return 100.0 * ((pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 100.0d0 * ((((1.0d0 + (i / n)) ** n) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
return 100.0 * ((Math.pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
def code(i, n): return 100.0 * ((math.pow((1.0 + (i / n)), n) - 1.0) / (i / n))
function code(i, n) return Float64(100.0 * Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) - 1.0) / Float64(i / n))) end
function tmp = code(i, n) tmp = 100.0 * ((((1.0 + (i / n)) ^ n) - 1.0) / (i / n)); end
code[i_, n_] := N[(100.0 * N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}
\end{array}
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 0.0)
(* (/ (expm1 (* n (log1p (/ i n)))) i) (* n 100.0))
(if (<= t_1 INFINITY)
(* 100.0 (/ (/ (- (* i t_0) (* n (/ i n))) (/ i n)) 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 <= 0.0) {
tmp = (expm1((n * log1p((i / n)))) / i) * (n * 100.0);
} else if (t_1 <= ((double) INFINITY)) {
tmp = 100.0 * ((((i * t_0) - (n * (i / n))) / (i / n)) / 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 <= 0.0) {
tmp = (Math.expm1((n * Math.log1p((i / n)))) / i) * (n * 100.0);
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = 100.0 * ((((i * t_0) - (n * (i / n))) / (i / n)) / 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 <= 0.0: tmp = (math.expm1((n * math.log1p((i / n)))) / i) * (n * 100.0) elif t_1 <= math.inf: tmp = 100.0 * ((((i * t_0) - (n * (i / n))) / (i / n)) / 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 <= 0.0) tmp = Float64(Float64(expm1(Float64(n * log1p(Float64(i / n)))) / i) * Float64(n * 100.0)); elseif (t_1 <= Inf) tmp = Float64(100.0 * Float64(Float64(Float64(Float64(i * t_0) - Float64(n * Float64(i / n))) / Float64(i / n)) / 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, 0.0], N[(N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] / i), $MachinePrecision] * N[(n * 100.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(100.0 * N[(N[(N[(N[(i * t$95$0), $MachinePrecision] - N[(n * N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(i / n), $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 0:\\
\;\;\;\;\frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{i} \cdot \left(n \cdot 100\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;100 \cdot \frac{\frac{i \cdot t\_0 - n \cdot \frac{i}{n}}{\frac{i}{n}}}{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)) < 0.0Initial program 24.3%
associate-*r/24.4%
sub-neg24.4%
distribute-rgt-in24.3%
metadata-eval24.3%
metadata-eval24.3%
Simplified24.3%
metadata-eval24.3%
metadata-eval24.3%
distribute-rgt-in24.4%
sub-neg24.4%
associate-*r/24.3%
*-commutative24.3%
associate-/r/24.3%
associate-*l*24.3%
add-exp-log24.3%
expm1-define24.3%
log-pow35.9%
log1p-define97.9%
Applied egg-rr97.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 99.4%
div-sub99.3%
clear-num99.3%
sub-neg99.3%
div-inv99.3%
clear-num99.3%
Applied egg-rr99.3%
sub-neg99.3%
Simplified99.3%
clear-num99.3%
un-div-inv99.3%
+-commutative99.3%
Applied egg-rr99.3%
frac-sub48.2%
associate-/r*99.8%
*-commutative99.8%
+-commutative99.8%
*-commutative99.8%
Applied egg-rr99.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.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.9%
Simplified76.9%
clear-num76.8%
un-div-inv76.8%
*-un-lft-identity76.8%
times-frac76.9%
metadata-eval76.9%
Applied egg-rr76.9%
Taylor expanded in i around 0 99.9%
Final simplification98.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 0.0)
(* n (/ (* (expm1 (* n (log1p (/ i n)))) 100.0) i))
(if (<= t_1 INFINITY)
(* 100.0 (/ (/ (- (* i t_0) (* n (/ i n))) (/ i n)) 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 <= 0.0) {
tmp = n * ((expm1((n * log1p((i / n)))) * 100.0) / i);
} else if (t_1 <= ((double) INFINITY)) {
tmp = 100.0 * ((((i * t_0) - (n * (i / n))) / (i / n)) / 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 <= 0.0) {
tmp = n * ((Math.expm1((n * Math.log1p((i / n)))) * 100.0) / i);
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = 100.0 * ((((i * t_0) - (n * (i / n))) / (i / n)) / 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 <= 0.0: tmp = n * ((math.expm1((n * math.log1p((i / n)))) * 100.0) / i) elif t_1 <= math.inf: tmp = 100.0 * ((((i * t_0) - (n * (i / n))) / (i / n)) / 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 <= 0.0) tmp = Float64(n * Float64(Float64(expm1(Float64(n * log1p(Float64(i / n)))) * 100.0) / i)); elseif (t_1 <= Inf) tmp = Float64(100.0 * Float64(Float64(Float64(Float64(i * t_0) - Float64(n * Float64(i / n))) / Float64(i / n)) / 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, 0.0], 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[(100.0 * N[(N[(N[(N[(i * t$95$0), $MachinePrecision] - N[(n * N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(i / n), $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 0:\\
\;\;\;\;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:\\
\;\;\;\;100 \cdot \frac{\frac{i \cdot t\_0 - n \cdot \frac{i}{n}}{\frac{i}{n}}}{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)) < 0.0Initial program 24.3%
associate-/r/24.3%
associate-*r*24.3%
*-commutative24.3%
associate-*r/24.3%
sub-neg24.3%
distribute-lft-in24.3%
metadata-eval24.3%
metadata-eval24.3%
metadata-eval24.3%
fma-define24.3%
metadata-eval24.3%
Simplified24.3%
fma-undefine24.3%
metadata-eval24.3%
metadata-eval24.3%
distribute-lft-in24.3%
sub-neg24.3%
*-commutative24.3%
add-exp-log24.3%
expm1-define24.3%
log-pow36.0%
log1p-define97.9%
Applied egg-rr97.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 99.4%
div-sub99.3%
clear-num99.3%
sub-neg99.3%
div-inv99.3%
clear-num99.3%
Applied egg-rr99.3%
sub-neg99.3%
Simplified99.3%
clear-num99.3%
un-div-inv99.3%
+-commutative99.3%
Applied egg-rr99.3%
frac-sub48.2%
associate-/r*99.8%
*-commutative99.8%
+-commutative99.8%
*-commutative99.8%
Applied egg-rr99.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.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.9%
Simplified76.9%
clear-num76.8%
un-div-inv76.8%
*-un-lft-identity76.8%
times-frac76.9%
metadata-eval76.9%
Applied egg-rr76.9%
Taylor expanded in i around 0 99.9%
Final simplification98.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 0.0)
(* 100.0 (* n (/ (expm1 i) i)))
(if (<= t_1 INFINITY)
(* 100.0 (/ (/ (- (* i t_0) (* n (/ i n))) (/ i n)) 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 <= 0.0) {
tmp = 100.0 * (n * (expm1(i) / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = 100.0 * ((((i * t_0) - (n * (i / n))) / (i / n)) / 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 <= 0.0) {
tmp = 100.0 * (n * (Math.expm1(i) / i));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = 100.0 * ((((i * t_0) - (n * (i / n))) / (i / n)) / 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 <= 0.0: tmp = 100.0 * (n * (math.expm1(i) / i)) elif t_1 <= math.inf: tmp = 100.0 * ((((i * t_0) - (n * (i / n))) / (i / n)) / 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 <= 0.0) tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); elseif (t_1 <= Inf) tmp = Float64(100.0 * Float64(Float64(Float64(Float64(i * t_0) - Float64(n * Float64(i / n))) / Float64(i / n)) / 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, 0.0], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(100.0 * N[(N[(N[(N[(i * t$95$0), $MachinePrecision] - N[(n * N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(i / n), $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 0:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;100 \cdot \frac{\frac{i \cdot t\_0 - n \cdot \frac{i}{n}}{\frac{i}{n}}}{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)) < 0.0Initial program 24.3%
Taylor expanded in n around inf 40.8%
*-commutative40.8%
associate-/l*40.8%
expm1-define76.6%
Simplified76.6%
if 0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 99.4%
div-sub99.3%
clear-num99.3%
sub-neg99.3%
div-inv99.3%
clear-num99.3%
Applied egg-rr99.3%
sub-neg99.3%
Simplified99.3%
clear-num99.3%
un-div-inv99.3%
+-commutative99.3%
Applied egg-rr99.3%
frac-sub48.2%
associate-/r*99.8%
*-commutative99.8%
+-commutative99.8%
*-commutative99.8%
Applied egg-rr99.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.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.9%
Simplified76.9%
clear-num76.8%
un-div-inv76.8%
*-un-lft-identity76.8%
times-frac76.9%
metadata-eval76.9%
Applied egg-rr76.9%
Taylor expanded in i around 0 99.9%
Final simplification84.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 0.0)
(* 100.0 (* n (/ (expm1 i) i)))
(if (<= t_1 INFINITY)
(* n (/ (+ (* t_0 100.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 <= 0.0) {
tmp = 100.0 * (n * (expm1(i) / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = n * (((t_0 * 100.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 <= 0.0) {
tmp = 100.0 * (n * (Math.expm1(i) / i));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = n * (((t_0 * 100.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 <= 0.0: tmp = 100.0 * (n * (math.expm1(i) / i)) elif t_1 <= math.inf: tmp = n * (((t_0 * 100.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 <= 0.0) tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); elseif (t_1 <= Inf) tmp = Float64(n * Float64(Float64(Float64(t_0 * 100.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, 0.0], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(n * N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $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 0:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;n \cdot \frac{t\_0 \cdot 100 + -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)) < 0.0Initial program 24.3%
Taylor expanded in n around inf 40.8%
*-commutative40.8%
associate-/l*40.8%
expm1-define76.6%
Simplified76.6%
if 0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 99.4%
associate-/r/99.4%
associate-*r*99.4%
*-commutative99.4%
associate-*r/99.4%
sub-neg99.4%
distribute-lft-in99.5%
metadata-eval99.5%
metadata-eval99.5%
metadata-eval99.5%
fma-define99.4%
metadata-eval99.4%
Simplified99.4%
fma-undefine99.5%
*-commutative99.5%
Applied egg-rr99.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.9%
Simplified76.9%
clear-num76.8%
un-div-inv76.8%
*-un-lft-identity76.8%
times-frac76.9%
metadata-eval76.9%
Applied egg-rr76.9%
Taylor expanded in i around 0 99.9%
Final simplification84.1%
(FPCore (i n)
:precision binary64
(let* ((t_0 (/ (+ (pow (+ 1.0 (/ i n)) n) -1.0) (/ i n))))
(if (<= t_0 0.0)
(* 100.0 (* n (/ (expm1 i) i)))
(if (<= t_0 INFINITY)
(/ (+ -100.0 (* 100.0 (pow (/ i n) n))) (/ i n))
(/ 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 tmp;
if (t_0 <= 0.0) {
tmp = 100.0 * (n * (expm1(i) / i));
} else if (t_0 <= ((double) INFINITY)) {
tmp = (-100.0 + (100.0 * pow((i / n), n))) / (i / n);
} 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 tmp;
if (t_0 <= 0.0) {
tmp = 100.0 * (n * (Math.expm1(i) / i));
} else if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = (-100.0 + (100.0 * Math.pow((i / n), n))) / (i / n);
} 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) tmp = 0 if t_0 <= 0.0: tmp = 100.0 * (n * (math.expm1(i) / i)) elif t_0 <= math.inf: tmp = (-100.0 + (100.0 * math.pow((i / n), n))) / (i / n) 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)) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / 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(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]}, If[LessEqual[t$95$0, 0.0], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $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[(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}}\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\frac{-100 + 100 \cdot {\left(\frac{i}{n}\right)}^{n}}{\frac{i}{n}}\\
\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)) < 0.0Initial program 24.3%
Taylor expanded in n around inf 40.8%
*-commutative40.8%
associate-/l*40.8%
expm1-define76.6%
Simplified76.6%
if 0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 99.4%
associate-*r/99.4%
sub-neg99.4%
distribute-rgt-in99.5%
metadata-eval99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in i around inf 99.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.9%
Simplified76.9%
clear-num76.8%
un-div-inv76.8%
*-un-lft-identity76.8%
times-frac76.9%
metadata-eval76.9%
Applied egg-rr76.9%
Taylor expanded in i around 0 99.9%
Final simplification84.1%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (* n (/ (expm1 i) i)))))
(if (<= n -2.6e-158)
t_0
(if (<= n 3.6e-243)
(/ 0.0 (/ i n))
(if (<= n 0.016)
(/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005))))
t_0)))))
double code(double i, double n) {
double t_0 = 100.0 * (n * (expm1(i) / i));
double tmp;
if (n <= -2.6e-158) {
tmp = t_0;
} else if (n <= 3.6e-243) {
tmp = 0.0 / (i / n);
} else if (n <= 0.016) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = 100.0 * (n * (Math.expm1(i) / i));
double tmp;
if (n <= -2.6e-158) {
tmp = t_0;
} else if (n <= 3.6e-243) {
tmp = 0.0 / (i / n);
} else if (n <= 0.016) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (n * (math.expm1(i) / i)) tmp = 0 if n <= -2.6e-158: tmp = t_0 elif n <= 3.6e-243: tmp = 0.0 / (i / n) elif n <= 0.016: tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(n * Float64(expm1(i) / i))) tmp = 0.0 if (n <= -2.6e-158) tmp = t_0; elseif (n <= 3.6e-243) tmp = Float64(0.0 / Float64(i / n)); elseif (n <= 0.016) tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -2.6e-158], t$95$0, If[LessEqual[n, 3.6e-243], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 0.016], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{if}\;n \leq -2.6 \cdot 10^{-158}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 3.6 \cdot 10^{-243}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 0.016:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -2.6e-158 or 0.016 < n Initial program 22.9%
Taylor expanded in n around inf 38.9%
*-commutative38.9%
associate-/l*38.9%
expm1-define89.8%
Simplified89.8%
if -2.6e-158 < n < 3.6000000000000001e-243Initial program 59.0%
associate-*r/59.0%
sub-neg59.0%
distribute-rgt-in59.0%
metadata-eval59.0%
metadata-eval59.0%
Simplified59.0%
Taylor expanded in i around 0 66.2%
if 3.6000000000000001e-243 < n < 0.016Initial program 14.0%
associate-/r/14.5%
associate-*r*14.5%
*-commutative14.5%
associate-*r/14.5%
sub-neg14.5%
distribute-lft-in14.5%
metadata-eval14.5%
metadata-eval14.5%
metadata-eval14.5%
fma-define14.5%
metadata-eval14.5%
Simplified14.5%
Taylor expanded in n around inf 5.6%
sub-neg5.6%
metadata-eval5.6%
metadata-eval5.6%
distribute-lft-in5.6%
metadata-eval5.6%
sub-neg5.6%
expm1-define48.0%
Simplified48.0%
clear-num47.9%
un-div-inv47.8%
*-un-lft-identity47.8%
times-frac47.9%
metadata-eval47.9%
Applied egg-rr47.9%
Taylor expanded in i around 0 80.4%
Final simplification85.6%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* n (/ (* 100.0 (expm1 i)) i))))
(if (<= n -2.6e-158)
t_0
(if (<= n 6e-242)
(/ 0.0 (/ i n))
(if (<= n 0.016)
(/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005))))
t_0)))))
double code(double i, double n) {
double t_0 = n * ((100.0 * expm1(i)) / i);
double tmp;
if (n <= -2.6e-158) {
tmp = t_0;
} else if (n <= 6e-242) {
tmp = 0.0 / (i / n);
} else if (n <= 0.016) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = n * ((100.0 * Math.expm1(i)) / i);
double tmp;
if (n <= -2.6e-158) {
tmp = t_0;
} else if (n <= 6e-242) {
tmp = 0.0 / (i / n);
} else if (n <= 0.016) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = n * ((100.0 * math.expm1(i)) / i) tmp = 0 if n <= -2.6e-158: tmp = t_0 elif n <= 6e-242: tmp = 0.0 / (i / n) elif n <= 0.016: tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(n * Float64(Float64(100.0 * expm1(i)) / i)) tmp = 0.0 if (n <= -2.6e-158) tmp = t_0; elseif (n <= 6e-242) tmp = Float64(0.0 / Float64(i / n)); elseif (n <= 0.016) tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(n * N[(N[(100.0 * N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -2.6e-158], t$95$0, If[LessEqual[n, 6e-242], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 0.016], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \frac{100 \cdot \mathsf{expm1}\left(i\right)}{i}\\
\mathbf{if}\;n \leq -2.6 \cdot 10^{-158}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 6 \cdot 10^{-242}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 0.016:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -2.6e-158 or 0.016 < n Initial program 22.9%
associate-/r/23.4%
associate-*r*23.4%
*-commutative23.4%
associate-*r/23.4%
sub-neg23.4%
distribute-lft-in23.4%
metadata-eval23.4%
metadata-eval23.4%
metadata-eval23.4%
fma-define23.4%
metadata-eval23.4%
Simplified23.4%
Taylor expanded in n around inf 38.9%
sub-neg38.9%
metadata-eval38.9%
metadata-eval38.9%
distribute-lft-in38.9%
metadata-eval38.9%
sub-neg38.9%
expm1-define89.7%
Simplified89.7%
if -2.6e-158 < n < 6e-242Initial program 59.0%
associate-*r/59.0%
sub-neg59.0%
distribute-rgt-in59.0%
metadata-eval59.0%
metadata-eval59.0%
Simplified59.0%
Taylor expanded in i around 0 66.2%
if 6e-242 < n < 0.016Initial program 14.0%
associate-/r/14.5%
associate-*r*14.5%
*-commutative14.5%
associate-*r/14.5%
sub-neg14.5%
distribute-lft-in14.5%
metadata-eval14.5%
metadata-eval14.5%
metadata-eval14.5%
fma-define14.5%
metadata-eval14.5%
Simplified14.5%
Taylor expanded in n around inf 5.6%
sub-neg5.6%
metadata-eval5.6%
metadata-eval5.6%
distribute-lft-in5.6%
metadata-eval5.6%
sub-neg5.6%
expm1-define48.0%
Simplified48.0%
clear-num47.9%
un-div-inv47.8%
*-un-lft-identity47.8%
times-frac47.9%
metadata-eval47.9%
Applied egg-rr47.9%
Taylor expanded in i around 0 80.4%
Final simplification85.6%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (/ (expm1 i) (/ i n)))))
(if (<= i -6.5e-16)
t_0
(if (<= i 1.65e-243)
(* 100.0 (+ n (* i -0.5)))
(if (<= i 6e-25) (* 100.0 (/ (* i n) i)) t_0)))))
double code(double i, double n) {
double t_0 = 100.0 * (expm1(i) / (i / n));
double tmp;
if (i <= -6.5e-16) {
tmp = t_0;
} else if (i <= 1.65e-243) {
tmp = 100.0 * (n + (i * -0.5));
} else if (i <= 6e-25) {
tmp = 100.0 * ((i * n) / i);
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = 100.0 * (Math.expm1(i) / (i / n));
double tmp;
if (i <= -6.5e-16) {
tmp = t_0;
} else if (i <= 1.65e-243) {
tmp = 100.0 * (n + (i * -0.5));
} else if (i <= 6e-25) {
tmp = 100.0 * ((i * n) / i);
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (math.expm1(i) / (i / n)) tmp = 0 if i <= -6.5e-16: tmp = t_0 elif i <= 1.65e-243: tmp = 100.0 * (n + (i * -0.5)) elif i <= 6e-25: tmp = 100.0 * ((i * n) / i) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(expm1(i) / Float64(i / n))) tmp = 0.0 if (i <= -6.5e-16) tmp = t_0; elseif (i <= 1.65e-243) tmp = Float64(100.0 * Float64(n + Float64(i * -0.5))); elseif (i <= 6e-25) tmp = Float64(100.0 * Float64(Float64(i * n) / i)); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[i, -6.5e-16], t$95$0, If[LessEqual[i, 1.65e-243], N[(100.0 * N[(n + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 6e-25], N[(100.0 * N[(N[(i * n), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\
\mathbf{if}\;i \leq -6.5 \cdot 10^{-16}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;i \leq 1.65 \cdot 10^{-243}:\\
\;\;\;\;100 \cdot \left(n + i \cdot -0.5\right)\\
\mathbf{elif}\;i \leq 6 \cdot 10^{-25}:\\
\;\;\;\;100 \cdot \frac{i \cdot n}{i}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if i < -6.50000000000000011e-16 or 5.9999999999999995e-25 < i Initial program 43.1%
Taylor expanded in n around inf 62.1%
expm1-define63.6%
Simplified63.6%
if -6.50000000000000011e-16 < i < 1.65000000000000006e-243Initial program 5.8%
Taylor expanded in i around 0 90.8%
associate-*r*90.6%
*-commutative90.6%
associate-*r/90.6%
metadata-eval90.6%
Simplified90.6%
Taylor expanded in n around 0 90.8%
*-commutative90.8%
Simplified90.8%
if 1.65000000000000006e-243 < i < 5.9999999999999995e-25Initial program 16.5%
div-sub16.5%
clear-num11.2%
sub-neg11.2%
div-inv11.2%
clear-num16.5%
Applied egg-rr16.5%
sub-neg16.5%
Simplified16.5%
Taylor expanded in i around 0 16.5%
+-commutative16.5%
Simplified16.5%
associate-*r/16.5%
sub-div17.2%
*-commutative17.2%
Applied egg-rr17.2%
Taylor expanded in n around 0 92.9%
*-commutative92.9%
Simplified92.9%
Final simplification78.6%
(FPCore (i n)
:precision binary64
(if (<= n -2.6e-158)
(+
(* n 100.0)
(*
i
(+
(* n 50.0)
(* i (+ (* 4.166666666666667 (* i n)) (* n 16.666666666666668))))))
(if (<= n 7e-242)
(/ 0.0 (/ i n))
(if (<= n 0.016)
(/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005))))
(*
n
(+
100.0
(*
i
(+ 50.0 (* i (+ 16.666666666666668 (* i 4.166666666666667)))))))))))
double code(double i, double n) {
double tmp;
if (n <= -2.6e-158) {
tmp = (n * 100.0) + (i * ((n * 50.0) + (i * ((4.166666666666667 * (i * n)) + (n * 16.666666666666668)))));
} else if (n <= 7e-242) {
tmp = 0.0 / (i / n);
} else if (n <= 0.016) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} 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 <= (-2.6d-158)) then
tmp = (n * 100.0d0) + (i * ((n * 50.0d0) + (i * ((4.166666666666667d0 * (i * n)) + (n * 16.666666666666668d0)))))
else if (n <= 7d-242) then
tmp = 0.0d0 / (i / n)
else if (n <= 0.016d0) then
tmp = n / (0.01d0 + (i * ((i * 0.0008333333333333334d0) - 0.005d0)))
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 <= -2.6e-158) {
tmp = (n * 100.0) + (i * ((n * 50.0) + (i * ((4.166666666666667 * (i * n)) + (n * 16.666666666666668)))));
} else if (n <= 7e-242) {
tmp = 0.0 / (i / n);
} else if (n <= 0.016) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} else {
tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -2.6e-158: tmp = (n * 100.0) + (i * ((n * 50.0) + (i * ((4.166666666666667 * (i * n)) + (n * 16.666666666666668))))) elif n <= 7e-242: tmp = 0.0 / (i / n) elif n <= 0.016: tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))) 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 <= -2.6e-158) tmp = Float64(Float64(n * 100.0) + Float64(i * Float64(Float64(n * 50.0) + Float64(i * Float64(Float64(4.166666666666667 * Float64(i * n)) + Float64(n * 16.666666666666668)))))); elseif (n <= 7e-242) tmp = Float64(0.0 / Float64(i / n)); elseif (n <= 0.016) tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); 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 <= -2.6e-158) tmp = (n * 100.0) + (i * ((n * 50.0) + (i * ((4.166666666666667 * (i * n)) + (n * 16.666666666666668))))); elseif (n <= 7e-242) tmp = 0.0 / (i / n); elseif (n <= 0.016) tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))); 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, -2.6e-158], N[(N[(n * 100.0), $MachinePrecision] + N[(i * N[(N[(n * 50.0), $MachinePrecision] + N[(i * N[(N[(4.166666666666667 * N[(i * n), $MachinePrecision]), $MachinePrecision] + N[(n * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 7e-242], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 0.016], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $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 -2.6 \cdot 10^{-158}:\\
\;\;\;\;n \cdot 100 + i \cdot \left(n \cdot 50 + i \cdot \left(4.166666666666667 \cdot \left(i \cdot n\right) + n \cdot 16.666666666666668\right)\right)\\
\mathbf{elif}\;n \leq 7 \cdot 10^{-242}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 0.016:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\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 < -2.6e-158Initial program 20.6%
Taylor expanded in n around inf 30.5%
*-commutative30.5%
associate-/l*30.5%
expm1-define84.7%
Simplified84.7%
Taylor expanded in i around 0 64.5%
if -2.6e-158 < n < 6.9999999999999998e-242Initial program 59.0%
associate-*r/59.0%
sub-neg59.0%
distribute-rgt-in59.0%
metadata-eval59.0%
metadata-eval59.0%
Simplified59.0%
Taylor expanded in i around 0 66.2%
if 6.9999999999999998e-242 < n < 0.016Initial program 14.0%
associate-/r/14.5%
associate-*r*14.5%
*-commutative14.5%
associate-*r/14.5%
sub-neg14.5%
distribute-lft-in14.5%
metadata-eval14.5%
metadata-eval14.5%
metadata-eval14.5%
fma-define14.5%
metadata-eval14.5%
Simplified14.5%
Taylor expanded in n around inf 5.6%
sub-neg5.6%
metadata-eval5.6%
metadata-eval5.6%
distribute-lft-in5.6%
metadata-eval5.6%
sub-neg5.6%
expm1-define48.0%
Simplified48.0%
clear-num47.9%
un-div-inv47.8%
*-un-lft-identity47.8%
times-frac47.9%
metadata-eval47.9%
Applied egg-rr47.9%
Taylor expanded in i around 0 80.4%
if 0.016 < n Initial program 26.4%
associate-/r/27.0%
associate-*r*27.0%
*-commutative27.0%
associate-*r/27.0%
sub-neg27.0%
distribute-lft-in27.0%
metadata-eval27.0%
metadata-eval27.0%
metadata-eval27.0%
fma-define27.0%
metadata-eval27.0%
Simplified27.0%
Taylor expanded in n around inf 51.1%
sub-neg51.1%
metadata-eval51.1%
metadata-eval51.1%
distribute-lft-in51.1%
metadata-eval51.1%
sub-neg51.1%
expm1-define97.2%
Simplified97.2%
Taylor expanded in i around 0 82.0%
*-commutative82.0%
Simplified82.0%
Final simplification72.5%
(FPCore (i n)
:precision binary64
(let* ((t_0
(*
n
(+
100.0
(*
i
(+ 50.0 (* i (+ 16.666666666666668 (* i 4.166666666666667)))))))))
(if (<= n -7.1e-158)
t_0
(if (<= n 6.6e-242)
(/ 0.0 (/ i n))
(if (<= n 0.026)
(/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005))))
t_0)))))
double code(double i, double n) {
double t_0 = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
double tmp;
if (n <= -7.1e-158) {
tmp = t_0;
} else if (n <= 6.6e-242) {
tmp = 0.0 / (i / n);
} else if (n <= 0.026) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = n * (100.0d0 + (i * (50.0d0 + (i * (16.666666666666668d0 + (i * 4.166666666666667d0))))))
if (n <= (-7.1d-158)) then
tmp = t_0
else if (n <= 6.6d-242) then
tmp = 0.0d0 / (i / n)
else if (n <= 0.026d0) then
tmp = n / (0.01d0 + (i * ((i * 0.0008333333333333334d0) - 0.005d0)))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double i, double n) {
double t_0 = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
double tmp;
if (n <= -7.1e-158) {
tmp = t_0;
} else if (n <= 6.6e-242) {
tmp = 0.0 / (i / n);
} else if (n <= 0.026) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667)))))) tmp = 0 if n <= -7.1e-158: tmp = t_0 elif n <= 6.6e-242: tmp = 0.0 / (i / n) elif n <= 0.026: tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * Float64(16.666666666666668 + Float64(i * 4.166666666666667))))))) tmp = 0.0 if (n <= -7.1e-158) tmp = t_0; elseif (n <= 6.6e-242) tmp = Float64(0.0 / Float64(i / n)); elseif (n <= 0.026) tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); else tmp = t_0; end return tmp end
function tmp_2 = code(i, n) t_0 = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667)))))); tmp = 0.0; if (n <= -7.1e-158) tmp = t_0; elseif (n <= 6.6e-242) tmp = 0.0 / (i / n); elseif (n <= 0.026) tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))); else tmp = t_0; end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * N[(16.666666666666668 + N[(i * 4.166666666666667), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -7.1e-158], t$95$0, If[LessEqual[n, 6.6e-242], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 0.026], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(100 + i \cdot \left(50 + i \cdot \left(16.666666666666668 + i \cdot 4.166666666666667\right)\right)\right)\\
\mathbf{if}\;n \leq -7.1 \cdot 10^{-158}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 6.6 \cdot 10^{-242}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 0.026:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -7.10000000000000003e-158 or 0.0259999999999999988 < n Initial program 22.9%
associate-/r/23.4%
associate-*r*23.4%
*-commutative23.4%
associate-*r/23.4%
sub-neg23.4%
distribute-lft-in23.4%
metadata-eval23.4%
metadata-eval23.4%
metadata-eval23.4%
fma-define23.4%
metadata-eval23.4%
Simplified23.4%
Taylor expanded in n around inf 38.9%
sub-neg38.9%
metadata-eval38.9%
metadata-eval38.9%
distribute-lft-in38.9%
metadata-eval38.9%
sub-neg38.9%
expm1-define89.7%
Simplified89.7%
Taylor expanded in i around 0 71.6%
*-commutative71.6%
Simplified71.6%
if -7.10000000000000003e-158 < n < 6.59999999999999963e-242Initial program 59.0%
associate-*r/59.0%
sub-neg59.0%
distribute-rgt-in59.0%
metadata-eval59.0%
metadata-eval59.0%
Simplified59.0%
Taylor expanded in i around 0 66.2%
if 6.59999999999999963e-242 < n < 0.0259999999999999988Initial program 14.0%
associate-/r/14.5%
associate-*r*14.5%
*-commutative14.5%
associate-*r/14.5%
sub-neg14.5%
distribute-lft-in14.5%
metadata-eval14.5%
metadata-eval14.5%
metadata-eval14.5%
fma-define14.5%
metadata-eval14.5%
Simplified14.5%
Taylor expanded in n around inf 5.6%
sub-neg5.6%
metadata-eval5.6%
metadata-eval5.6%
distribute-lft-in5.6%
metadata-eval5.6%
sub-neg5.6%
expm1-define48.0%
Simplified48.0%
clear-num47.9%
un-div-inv47.8%
*-un-lft-identity47.8%
times-frac47.9%
metadata-eval47.9%
Applied egg-rr47.9%
Taylor expanded in i around 0 80.4%
Final simplification72.5%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668)))))))
(if (<= n -4.8e-158)
t_0
(if (<= n 2.7e-244)
(/ 0.0 (/ i n))
(if (<= n 0.026)
(/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005))))
t_0)))))
double code(double i, double n) {
double t_0 = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
double tmp;
if (n <= -4.8e-158) {
tmp = t_0;
} else if (n <= 2.7e-244) {
tmp = 0.0 / (i / n);
} else if (n <= 0.026) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
if (n <= (-4.8d-158)) then
tmp = t_0
else if (n <= 2.7d-244) then
tmp = 0.0d0 / (i / n)
else if (n <= 0.026d0) then
tmp = n / (0.01d0 + (i * ((i * 0.0008333333333333334d0) - 0.005d0)))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double i, double n) {
double t_0 = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
double tmp;
if (n <= -4.8e-158) {
tmp = t_0;
} else if (n <= 2.7e-244) {
tmp = 0.0 / (i / n);
} else if (n <= 0.026) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) tmp = 0 if n <= -4.8e-158: tmp = t_0 elif n <= 2.7e-244: tmp = 0.0 / (i / n) elif n <= 0.026: tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))) tmp = 0.0 if (n <= -4.8e-158) tmp = t_0; elseif (n <= 2.7e-244) tmp = Float64(0.0 / Float64(i / n)); elseif (n <= 0.026) tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); else tmp = t_0; end return tmp end
function tmp_2 = code(i, n) t_0 = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); tmp = 0.0; if (n <= -4.8e-158) tmp = t_0; elseif (n <= 2.7e-244) tmp = 0.0 / (i / n); elseif (n <= 0.026) tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))); else tmp = t_0; end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -4.8e-158], t$95$0, If[LessEqual[n, 2.7e-244], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 0.026], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\mathbf{if}\;n \leq -4.8 \cdot 10^{-158}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 2.7 \cdot 10^{-244}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 0.026:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -4.80000000000000015e-158 or 0.0259999999999999988 < n Initial program 22.9%
associate-/r/23.4%
associate-*r*23.4%
*-commutative23.4%
associate-*r/23.4%
sub-neg23.4%
distribute-lft-in23.4%
metadata-eval23.4%
metadata-eval23.4%
metadata-eval23.4%
fma-define23.4%
metadata-eval23.4%
Simplified23.4%
Taylor expanded in n around inf 38.9%
sub-neg38.9%
metadata-eval38.9%
metadata-eval38.9%
distribute-lft-in38.9%
metadata-eval38.9%
sub-neg38.9%
expm1-define89.7%
Simplified89.7%
Taylor expanded in i around 0 69.6%
*-commutative69.6%
Simplified69.6%
if -4.80000000000000015e-158 < n < 2.7e-244Initial program 59.0%
associate-*r/59.0%
sub-neg59.0%
distribute-rgt-in59.0%
metadata-eval59.0%
metadata-eval59.0%
Simplified59.0%
Taylor expanded in i around 0 66.2%
if 2.7e-244 < n < 0.0259999999999999988Initial program 14.0%
associate-/r/14.5%
associate-*r*14.5%
*-commutative14.5%
associate-*r/14.5%
sub-neg14.5%
distribute-lft-in14.5%
metadata-eval14.5%
metadata-eval14.5%
metadata-eval14.5%
fma-define14.5%
metadata-eval14.5%
Simplified14.5%
Taylor expanded in n around inf 5.6%
sub-neg5.6%
metadata-eval5.6%
metadata-eval5.6%
distribute-lft-in5.6%
metadata-eval5.6%
sub-neg5.6%
expm1-define48.0%
Simplified48.0%
clear-num47.9%
un-div-inv47.8%
*-un-lft-identity47.8%
times-frac47.9%
metadata-eval47.9%
Applied egg-rr47.9%
Taylor expanded in i around 0 80.4%
Final simplification71.0%
(FPCore (i n)
:precision binary64
(if (<= n -7.5e-299)
(/ n (+ 0.01 (* i -0.005)))
(if (<= n 4e-245)
(* 100.0 (/ (* i n) i))
(if (<= n 0.028) (* 100.0 (/ i (/ i n))) (* n (+ 100.0 (* i 50.0)))))))
double code(double i, double n) {
double tmp;
if (n <= -7.5e-299) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 4e-245) {
tmp = 100.0 * ((i * n) / i);
} else if (n <= 0.028) {
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 <= (-7.5d-299)) then
tmp = n / (0.01d0 + (i * (-0.005d0)))
else if (n <= 4d-245) then
tmp = 100.0d0 * ((i * n) / i)
else if (n <= 0.028d0) 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 <= -7.5e-299) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 4e-245) {
tmp = 100.0 * ((i * n) / i);
} else if (n <= 0.028) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -7.5e-299: tmp = n / (0.01 + (i * -0.005)) elif n <= 4e-245: tmp = 100.0 * ((i * n) / i) elif n <= 0.028: 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 <= -7.5e-299) tmp = Float64(n / Float64(0.01 + Float64(i * -0.005))); elseif (n <= 4e-245) tmp = Float64(100.0 * Float64(Float64(i * n) / i)); elseif (n <= 0.028) 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 <= -7.5e-299) tmp = n / (0.01 + (i * -0.005)); elseif (n <= 4e-245) tmp = 100.0 * ((i * n) / i); elseif (n <= 0.028) 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, -7.5e-299], N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 4e-245], N[(100.0 * N[(N[(i * n), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 0.028], 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 -7.5 \cdot 10^{-299}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{elif}\;n \leq 4 \cdot 10^{-245}:\\
\;\;\;\;100 \cdot \frac{i \cdot n}{i}\\
\mathbf{elif}\;n \leq 0.028:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < -7.4999999999999999e-299Initial program 24.8%
associate-/r/25.2%
associate-*r*25.1%
*-commutative25.1%
associate-*r/25.1%
sub-neg25.1%
distribute-lft-in25.1%
metadata-eval25.1%
metadata-eval25.1%
metadata-eval25.1%
fma-define25.1%
metadata-eval25.1%
Simplified25.1%
Taylor expanded in n around inf 31.7%
sub-neg31.7%
metadata-eval31.7%
metadata-eval31.7%
distribute-lft-in31.7%
metadata-eval31.7%
sub-neg31.7%
expm1-define79.7%
Simplified79.7%
clear-num79.7%
un-div-inv79.6%
*-un-lft-identity79.6%
times-frac79.7%
metadata-eval79.7%
Applied egg-rr79.7%
Taylor expanded in i around 0 58.8%
*-commutative58.8%
Simplified58.8%
if -7.4999999999999999e-299 < n < 3.9999999999999997e-245Initial program 69.5%
div-sub69.5%
clear-num39.4%
sub-neg39.4%
div-inv39.4%
clear-num69.5%
Applied egg-rr69.5%
sub-neg69.5%
Simplified69.5%
Taylor expanded in i around 0 87.6%
+-commutative87.6%
Simplified87.6%
associate-*r/71.5%
sub-div71.5%
*-commutative71.5%
Applied egg-rr71.5%
Taylor expanded in n around 0 71.5%
*-commutative71.5%
Simplified71.5%
if 3.9999999999999997e-245 < n < 0.0280000000000000006Initial program 14.0%
Taylor expanded in i around 0 75.8%
if 0.0280000000000000006 < n Initial program 26.4%
associate-/r/27.0%
associate-*r*27.0%
*-commutative27.0%
associate-*r/27.0%
sub-neg27.0%
distribute-lft-in27.0%
metadata-eval27.0%
metadata-eval27.0%
metadata-eval27.0%
fma-define27.0%
metadata-eval27.0%
Simplified27.0%
Taylor expanded in n around inf 51.1%
sub-neg51.1%
metadata-eval51.1%
metadata-eval51.1%
distribute-lft-in51.1%
metadata-eval51.1%
sub-neg51.1%
expm1-define97.2%
Simplified97.2%
Taylor expanded in i around 0 68.2%
*-commutative68.2%
Simplified68.2%
Final simplification65.0%
(FPCore (i n) :precision binary64 (if (or (<= n -2.6e-158) (not (<= n 5.2e-113))) (* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668))))) (/ 0.0 (/ i n))))
double code(double i, double n) {
double tmp;
if ((n <= -2.6e-158) || !(n <= 5.2e-113)) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-2.6d-158)) .or. (.not. (n <= 5.2d-113))) then
tmp = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
else
tmp = 0.0d0 / (i / n)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -2.6e-158) || !(n <= 5.2e-113)) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -2.6e-158) or not (n <= 5.2e-113): tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) else: tmp = 0.0 / (i / n) return tmp
function code(i, n) tmp = 0.0 if ((n <= -2.6e-158) || !(n <= 5.2e-113)) tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))); else tmp = Float64(0.0 / Float64(i / n)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -2.6e-158) || ~((n <= 5.2e-113))) tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); else tmp = 0.0 / (i / n); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -2.6e-158], N[Not[LessEqual[n, 5.2e-113]], $MachinePrecision]], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.6 \cdot 10^{-158} \lor \neg \left(n \leq 5.2 \cdot 10^{-113}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -2.6e-158 or 5.1999999999999998e-113 < n Initial program 21.5%
associate-/r/21.9%
associate-*r*21.9%
*-commutative21.9%
associate-*r/21.9%
sub-neg21.9%
distribute-lft-in21.9%
metadata-eval21.9%
metadata-eval21.9%
metadata-eval21.9%
fma-define21.9%
metadata-eval21.9%
Simplified21.9%
Taylor expanded in n around inf 34.7%
sub-neg34.7%
metadata-eval34.7%
metadata-eval34.7%
distribute-lft-in34.7%
metadata-eval34.7%
sub-neg34.7%
expm1-define86.8%
Simplified86.8%
Taylor expanded in i around 0 69.1%
*-commutative69.1%
Simplified69.1%
if -2.6e-158 < n < 5.1999999999999998e-113Initial program 43.3%
associate-*r/43.3%
sub-neg43.3%
distribute-rgt-in43.3%
metadata-eval43.3%
metadata-eval43.3%
Simplified43.3%
Taylor expanded in i around 0 67.2%
Final simplification68.7%
(FPCore (i n) :precision binary64 (if (or (<= n -2.1e-42) (not (<= n 5e+23))) (* 100.0 (/ (* i n) i)) (* 100.0 (/ i (/ i n)))))
double code(double i, double n) {
double tmp;
if ((n <= -2.1e-42) || !(n <= 5e+23)) {
tmp = 100.0 * ((i * n) / i);
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-2.1d-42)) .or. (.not. (n <= 5d+23))) then
tmp = 100.0d0 * ((i * n) / i)
else
tmp = 100.0d0 * (i / (i / n))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -2.1e-42) || !(n <= 5e+23)) {
tmp = 100.0 * ((i * n) / i);
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -2.1e-42) or not (n <= 5e+23): tmp = 100.0 * ((i * n) / i) else: tmp = 100.0 * (i / (i / n)) return tmp
function code(i, n) tmp = 0.0 if ((n <= -2.1e-42) || !(n <= 5e+23)) tmp = Float64(100.0 * Float64(Float64(i * n) / i)); else tmp = Float64(100.0 * Float64(i / Float64(i / n))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -2.1e-42) || ~((n <= 5e+23))) tmp = 100.0 * ((i * n) / i); else tmp = 100.0 * (i / (i / n)); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -2.1e-42], N[Not[LessEqual[n, 5e+23]], $MachinePrecision]], N[(100.0 * N[(N[(i * n), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.1 \cdot 10^{-42} \lor \neg \left(n \leq 5 \cdot 10^{+23}\right):\\
\;\;\;\;100 \cdot \frac{i \cdot n}{i}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -2.10000000000000006e-42 or 4.9999999999999999e23 < n Initial program 23.5%
div-sub23.4%
clear-num23.6%
sub-neg23.6%
div-inv23.6%
clear-num23.4%
Applied egg-rr23.4%
sub-neg23.4%
Simplified23.4%
Taylor expanded in i around 0 3.3%
+-commutative3.3%
Simplified3.3%
associate-*r/12.1%
sub-div12.7%
*-commutative12.7%
Applied egg-rr12.7%
Taylor expanded in n around 0 63.3%
*-commutative63.3%
Simplified63.3%
if -2.10000000000000006e-42 < n < 4.9999999999999999e23Initial program 28.4%
Taylor expanded in i around 0 59.9%
Final simplification62.0%
(FPCore (i n) :precision binary64 (if (<= n -2.6e-158) (/ n (+ 0.01 (* i -0.005))) (if (<= n 4e-113) (/ 0.0 (/ i n)) (* n (+ 100.0 (* i 50.0))))))
double code(double i, double n) {
double tmp;
if (n <= -2.6e-158) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 4e-113) {
tmp = 0.0 / (i / n);
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-2.6d-158)) then
tmp = n / (0.01d0 + (i * (-0.005d0)))
else if (n <= 4d-113) then
tmp = 0.0d0 / (i / n)
else
tmp = n * (100.0d0 + (i * 50.0d0))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -2.6e-158) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 4e-113) {
tmp = 0.0 / (i / n);
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -2.6e-158: tmp = n / (0.01 + (i * -0.005)) elif n <= 4e-113: tmp = 0.0 / (i / n) else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) tmp = 0.0 if (n <= -2.6e-158) tmp = Float64(n / Float64(0.01 + Float64(i * -0.005))); elseif (n <= 4e-113) tmp = Float64(0.0 / Float64(i / n)); else tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -2.6e-158) tmp = n / (0.01 + (i * -0.005)); elseif (n <= 4e-113) tmp = 0.0 / (i / n); else tmp = n * (100.0 + (i * 50.0)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -2.6e-158], N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 4e-113], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.6 \cdot 10^{-158}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{elif}\;n \leq 4 \cdot 10^{-113}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < -2.6e-158Initial program 20.6%
associate-/r/21.0%
associate-*r*21.0%
*-commutative21.0%
associate-*r/21.0%
sub-neg21.0%
distribute-lft-in21.0%
metadata-eval21.0%
metadata-eval21.0%
metadata-eval21.0%
fma-define21.0%
metadata-eval21.0%
Simplified21.0%
Taylor expanded in n around inf 30.5%
sub-neg30.5%
metadata-eval30.5%
metadata-eval30.5%
distribute-lft-in30.5%
metadata-eval30.5%
sub-neg30.5%
expm1-define84.6%
Simplified84.6%
clear-num84.6%
un-div-inv84.6%
*-un-lft-identity84.6%
times-frac84.6%
metadata-eval84.6%
Applied egg-rr84.6%
Taylor expanded in i around 0 60.6%
*-commutative60.6%
Simplified60.6%
if -2.6e-158 < n < 3.99999999999999991e-113Initial program 43.3%
associate-*r/43.3%
sub-neg43.3%
distribute-rgt-in43.3%
metadata-eval43.3%
metadata-eval43.3%
Simplified43.3%
Taylor expanded in i around 0 67.2%
if 3.99999999999999991e-113 < n Initial program 22.5%
associate-/r/22.9%
associate-*r*22.9%
*-commutative22.9%
associate-*r/22.9%
sub-neg22.9%
distribute-lft-in23.0%
metadata-eval23.0%
metadata-eval23.0%
metadata-eval23.0%
fma-define22.9%
metadata-eval22.9%
Simplified22.9%
Taylor expanded in n around inf 39.2%
sub-neg39.2%
metadata-eval39.2%
metadata-eval39.2%
distribute-lft-in39.2%
metadata-eval39.2%
sub-neg39.2%
expm1-define89.1%
Simplified89.1%
Taylor expanded in i around 0 67.5%
*-commutative67.5%
Simplified67.5%
Final simplification64.5%
(FPCore (i n) :precision binary64 (if (<= n -2e-42) (* 100.0 (/ (* i n) i)) (if (<= n 0.03) (* 100.0 (/ i (/ i n))) (* n (+ 100.0 (* i 50.0))))))
double code(double i, double n) {
double tmp;
if (n <= -2e-42) {
tmp = 100.0 * ((i * n) / i);
} else if (n <= 0.03) {
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 <= (-2d-42)) then
tmp = 100.0d0 * ((i * n) / i)
else if (n <= 0.03d0) 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 <= -2e-42) {
tmp = 100.0 * ((i * n) / i);
} else if (n <= 0.03) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -2e-42: tmp = 100.0 * ((i * n) / i) elif n <= 0.03: 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 <= -2e-42) tmp = Float64(100.0 * Float64(Float64(i * n) / i)); elseif (n <= 0.03) 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 <= -2e-42) tmp = 100.0 * ((i * n) / i); elseif (n <= 0.03) 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, -2e-42], N[(100.0 * N[(N[(i * n), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 0.03], 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 -2 \cdot 10^{-42}:\\
\;\;\;\;100 \cdot \frac{i \cdot n}{i}\\
\mathbf{elif}\;n \leq 0.03:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < -2.00000000000000008e-42Initial program 23.4%
div-sub23.3%
clear-num23.4%
sub-neg23.4%
div-inv23.4%
clear-num23.3%
Applied egg-rr23.3%
sub-neg23.3%
Simplified23.3%
Taylor expanded in i around 0 2.8%
+-commutative2.8%
Simplified2.8%
associate-*r/5.8%
sub-div6.4%
*-commutative6.4%
Applied egg-rr6.4%
Taylor expanded in n around 0 60.0%
*-commutative60.0%
Simplified60.0%
if -2.00000000000000008e-42 < n < 0.029999999999999999Initial program 26.4%
Taylor expanded in i around 0 61.3%
if 0.029999999999999999 < n Initial program 26.4%
associate-/r/27.0%
associate-*r*27.0%
*-commutative27.0%
associate-*r/27.0%
sub-neg27.0%
distribute-lft-in27.0%
metadata-eval27.0%
metadata-eval27.0%
metadata-eval27.0%
fma-define27.0%
metadata-eval27.0%
Simplified27.0%
Taylor expanded in n around inf 51.1%
sub-neg51.1%
metadata-eval51.1%
metadata-eval51.1%
distribute-lft-in51.1%
metadata-eval51.1%
sub-neg51.1%
expm1-define97.2%
Simplified97.2%
Taylor expanded in i around 0 68.2%
*-commutative68.2%
Simplified68.2%
Final simplification62.9%
(FPCore (i n) :precision binary64 (if (<= i 5e-54) (* n 100.0) (* 100.0 (/ i (/ i n)))))
double code(double i, double n) {
double tmp;
if (i <= 5e-54) {
tmp = n * 100.0;
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= 5d-54) then
tmp = n * 100.0d0
else
tmp = 100.0d0 * (i / (i / n))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= 5e-54) {
tmp = n * 100.0;
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 5e-54: tmp = n * 100.0 else: tmp = 100.0 * (i / (i / n)) return tmp
function code(i, n) tmp = 0.0 if (i <= 5e-54) tmp = Float64(n * 100.0); else tmp = Float64(100.0 * Float64(i / Float64(i / n))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= 5e-54) tmp = n * 100.0; else tmp = 100.0 * (i / (i / n)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, 5e-54], N[(n * 100.0), $MachinePrecision], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 5 \cdot 10^{-54}:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\end{array}
\end{array}
if i < 5.00000000000000015e-54Initial program 20.1%
associate-/r/20.6%
associate-*r*20.5%
*-commutative20.5%
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 i around 0 65.4%
*-commutative65.4%
Simplified65.4%
if 5.00000000000000015e-54 < i Initial program 39.4%
Taylor expanded in i around 0 28.0%
(FPCore (i n) :precision binary64 (if (<= i 2e-7) (* n 100.0) (* 100.0 (* i (/ n i)))))
double code(double i, double n) {
double tmp;
if (i <= 2e-7) {
tmp = n * 100.0;
} else {
tmp = 100.0 * (i * (n / i));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= 2d-7) then
tmp = n * 100.0d0
else
tmp = 100.0d0 * (i * (n / i))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= 2e-7) {
tmp = n * 100.0;
} else {
tmp = 100.0 * (i * (n / i));
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 2e-7: tmp = n * 100.0 else: tmp = 100.0 * (i * (n / i)) return tmp
function code(i, n) tmp = 0.0 if (i <= 2e-7) tmp = Float64(n * 100.0); else tmp = Float64(100.0 * Float64(i * Float64(n / i))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= 2e-7) tmp = n * 100.0; else tmp = 100.0 * (i * (n / i)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, 2e-7], N[(n * 100.0), $MachinePrecision], N[(100.0 * N[(i * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 2 \cdot 10^{-7}:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(i \cdot \frac{n}{i}\right)\\
\end{array}
\end{array}
if i < 1.9999999999999999e-7Initial program 20.4%
associate-/r/20.9%
associate-*r*20.9%
*-commutative20.9%
associate-*r/20.9%
sub-neg20.9%
distribute-lft-in20.9%
metadata-eval20.9%
metadata-eval20.9%
metadata-eval20.9%
fma-define20.9%
metadata-eval20.9%
Simplified20.9%
Taylor expanded in i around 0 64.4%
*-commutative64.4%
Simplified64.4%
if 1.9999999999999999e-7 < i Initial program 40.9%
div-sub40.8%
clear-num39.4%
sub-neg39.4%
div-inv39.4%
clear-num40.9%
Applied egg-rr40.9%
sub-neg40.9%
Simplified40.9%
Taylor expanded in i around 0 18.6%
+-commutative18.6%
Simplified18.6%
*-un-lft-identity18.6%
distribute-rgt-out--18.6%
add-exp-log18.6%
expm1-undefine18.6%
+-commutative18.6%
log1p-define18.6%
expm1-log1p-u18.6%
Applied egg-rr18.6%
Final simplification53.3%
(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 25.4%
associate-/r/25.8%
associate-*r*25.8%
*-commutative25.8%
associate-*r/25.8%
sub-neg25.8%
distribute-lft-in25.8%
metadata-eval25.8%
metadata-eval25.8%
metadata-eval25.8%
fma-define25.8%
metadata-eval25.8%
Simplified25.8%
Taylor expanded in i around 0 50.0%
*-commutative50.0%
Simplified50.0%
(FPCore (i n) :precision binary64 (* i -50.0))
double code(double i, double n) {
return i * -50.0;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = i * (-50.0d0)
end function
public static double code(double i, double n) {
return i * -50.0;
}
def code(i, n): return i * -50.0
function code(i, n) return Float64(i * -50.0) end
function tmp = code(i, n) tmp = i * -50.0; end
code[i_, n_] := N[(i * -50.0), $MachinePrecision]
\begin{array}{l}
\\
i \cdot -50
\end{array}
Initial program 25.4%
Taylor expanded in i around 0 55.5%
associate-*r*55.6%
*-commutative55.6%
associate-*r/55.6%
metadata-eval55.6%
Simplified55.6%
Taylor expanded in n around 0 2.8%
*-commutative2.8%
Simplified2.8%
(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 2024184
(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))))