
(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) -1.0) (/ i n))))
(if (<= t_0 -5e-124)
(* 100.0 (/ (+ (pow (/ i n) n) -1.0) (/ i n)))
(if (<= t_0 2e-221)
(* (/ (expm1 (* n (log1p (/ i n)))) i) (* n 100.0))
(if (<= t_0 INFINITY) (* t_0 100.0) (* n 100.0))))))
double code(double i, double n) {
double t_0 = (pow((1.0 + (i / n)), n) + -1.0) / (i / n);
double tmp;
if (t_0 <= -5e-124) {
tmp = 100.0 * ((pow((i / n), n) + -1.0) / (i / n));
} else if (t_0 <= 2e-221) {
tmp = (expm1((n * log1p((i / n)))) / i) * (n * 100.0);
} else if (t_0 <= ((double) INFINITY)) {
tmp = t_0 * 100.0;
} else {
tmp = n * 100.0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = (Math.pow((1.0 + (i / n)), n) + -1.0) / (i / n);
double tmp;
if (t_0 <= -5e-124) {
tmp = 100.0 * ((Math.pow((i / n), n) + -1.0) / (i / n));
} else if (t_0 <= 2e-221) {
tmp = (Math.expm1((n * Math.log1p((i / n)))) / i) * (n * 100.0);
} else if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = t_0 * 100.0;
} else {
tmp = n * 100.0;
}
return tmp;
}
def code(i, n): t_0 = (math.pow((1.0 + (i / n)), n) + -1.0) / (i / n) tmp = 0 if t_0 <= -5e-124: tmp = 100.0 * ((math.pow((i / n), n) + -1.0) / (i / n)) elif t_0 <= 2e-221: tmp = (math.expm1((n * math.log1p((i / n)))) / i) * (n * 100.0) elif t_0 <= math.inf: tmp = t_0 * 100.0 else: tmp = n * 100.0 return tmp
function code(i, n) t_0 = Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0) / Float64(i / n)) tmp = 0.0 if (t_0 <= -5e-124) tmp = Float64(100.0 * Float64(Float64((Float64(i / n) ^ n) + -1.0) / Float64(i / n))); elseif (t_0 <= 2e-221) tmp = Float64(Float64(expm1(Float64(n * log1p(Float64(i / n)))) / i) * Float64(n * 100.0)); elseif (t_0 <= Inf) tmp = Float64(t_0 * 100.0); else tmp = Float64(n * 100.0); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-124], N[(100.0 * N[(N[(N[Power[N[(i / n), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e-221], 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$0, Infinity], N[(t$95$0 * 100.0), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-124}:\\
\;\;\;\;100 \cdot \frac{{\left(\frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}}\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-221}:\\
\;\;\;\;\frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{i} \cdot \left(n \cdot 100\right)\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;t\_0 \cdot 100\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < -5.0000000000000003e-124Initial program 100.0%
Taylor expanded in i around inf 100.0%
if -5.0000000000000003e-124 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 2.00000000000000003e-221Initial program 22.1%
associate-*r/22.1%
sub-neg22.1%
distribute-rgt-in22.1%
metadata-eval22.1%
metadata-eval22.1%
Simplified22.1%
metadata-eval22.1%
metadata-eval22.1%
distribute-rgt-in22.1%
sub-neg22.1%
associate-*r/22.1%
*-commutative22.1%
associate-/r/22.2%
associate-*l*22.2%
add-exp-log22.2%
expm1-define22.2%
log-pow31.9%
log1p-define98.4%
Applied egg-rr98.4%
if 2.00000000000000003e-221 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 99.9%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) Initial program 0.0%
associate-/r/1.9%
associate-*r*1.9%
*-commutative1.9%
associate-*r/1.9%
sub-neg1.9%
distribute-lft-in1.9%
metadata-eval1.9%
metadata-eval1.9%
metadata-eval1.9%
fma-define1.9%
metadata-eval1.9%
Simplified1.9%
Taylor expanded in i around 0 86.5%
*-commutative86.5%
Simplified86.5%
Final simplification96.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 (- INFINITY))
(* 100.0 (* (+ (pow (/ i n) n) -1.0) (/ n i)))
(if (<= t_1 0.0)
(* (expm1 (* n (log1p (/ i n)))) (/ 100.0 (/ i n)))
(if (<= t_1 INFINITY)
(* n (/ (+ (* t_0 100.0) -100.0) i))
(* n 100.0))))))
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 <= -((double) INFINITY)) {
tmp = 100.0 * ((pow((i / n), n) + -1.0) * (n / i));
} else if (t_1 <= 0.0) {
tmp = expm1((n * log1p((i / n)))) * (100.0 / (i / n));
} else if (t_1 <= ((double) INFINITY)) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else {
tmp = n * 100.0;
}
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 <= -Double.POSITIVE_INFINITY) {
tmp = 100.0 * ((Math.pow((i / n), n) + -1.0) * (n / i));
} else if (t_1 <= 0.0) {
tmp = Math.expm1((n * Math.log1p((i / n)))) * (100.0 / (i / n));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else {
tmp = n * 100.0;
}
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 <= -math.inf: tmp = 100.0 * ((math.pow((i / n), n) + -1.0) * (n / i)) elif t_1 <= 0.0: tmp = math.expm1((n * math.log1p((i / n)))) * (100.0 / (i / n)) elif t_1 <= math.inf: tmp = n * (((t_0 * 100.0) + -100.0) / i) else: tmp = n * 100.0 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 <= Float64(-Inf)) tmp = Float64(100.0 * Float64(Float64((Float64(i / n) ^ n) + -1.0) * Float64(n / i))); elseif (t_1 <= 0.0) tmp = Float64(expm1(Float64(n * log1p(Float64(i / n)))) * Float64(100.0 / Float64(i / n))); elseif (t_1 <= Inf) tmp = Float64(n * Float64(Float64(Float64(t_0 * 100.0) + -100.0) / i)); else tmp = Float64(n * 100.0); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(100.0 * N[(N[(N[Power[N[(i / n), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision] * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] * N[(100.0 / N[(i / n), $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 * 100.0), $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 -\infty:\\
\;\;\;\;100 \cdot \left(\left({\left(\frac{i}{n}\right)}^{n} + -1\right) \cdot \frac{n}{i}\right)\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot \frac{100}{\frac{i}{n}}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;n \cdot \frac{t\_0 \cdot 100 + -100}{i}\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < -inf.0Initial program 100.0%
Taylor expanded in i around inf 100.0%
div-inv100.0%
sub-neg100.0%
metadata-eval100.0%
clear-num100.0%
Applied egg-rr100.0%
if -inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 0.0Initial program 23.4%
associate-/r/23.4%
associate-*r*23.4%
*-commutative23.4%
associate-*r/23.4%
sub-neg23.4%
distribute-lft-in23.3%
metadata-eval23.3%
metadata-eval23.3%
metadata-eval23.3%
fma-define23.4%
metadata-eval23.4%
Simplified23.4%
*-commutative23.4%
fma-undefine23.3%
*-commutative23.3%
associate-/r/23.3%
metadata-eval23.3%
metadata-eval23.3%
distribute-rgt-in23.4%
sub-neg23.4%
associate-*r/23.4%
clear-num23.4%
un-div-inv23.4%
add-exp-log23.4%
expm1-define23.4%
log-pow32.2%
log1p-define98.8%
Applied egg-rr98.8%
associate-/r/96.7%
Simplified96.7%
if 0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 99.9%
associate-/r/99.9%
associate-*r*99.9%
*-commutative99.9%
associate-*r/99.9%
sub-neg99.9%
distribute-lft-in99.9%
metadata-eval99.9%
metadata-eval99.9%
metadata-eval99.9%
fma-define99.9%
metadata-eval99.9%
Simplified99.9%
fma-undefine99.9%
*-commutative99.9%
Applied egg-rr99.9%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) Initial program 0.0%
associate-/r/1.9%
associate-*r*1.9%
*-commutative1.9%
associate-*r/1.9%
sub-neg1.9%
distribute-lft-in1.9%
metadata-eval1.9%
metadata-eval1.9%
metadata-eval1.9%
fma-define1.9%
metadata-eval1.9%
Simplified1.9%
Taylor expanded in i around 0 86.5%
*-commutative86.5%
Simplified86.5%
Final simplification95.3%
(FPCore (i n)
:precision binary64
(if (<= i -3500000000000.0)
(* 100.0 (* (+ (pow (/ i n) n) -1.0) (/ n i)))
(if (<= i 5.6e+104)
(* 100.0 (* n (/ (expm1 i) i)))
(* 100.0 (+ (pow (/ i n) (+ n -1.0)) (* n (/ -1.0 i)))))))
double code(double i, double n) {
double tmp;
if (i <= -3500000000000.0) {
tmp = 100.0 * ((pow((i / n), n) + -1.0) * (n / i));
} else if (i <= 5.6e+104) {
tmp = 100.0 * (n * (expm1(i) / i));
} else {
tmp = 100.0 * (pow((i / n), (n + -1.0)) + (n * (-1.0 / i)));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if (i <= -3500000000000.0) {
tmp = 100.0 * ((Math.pow((i / n), n) + -1.0) * (n / i));
} else if (i <= 5.6e+104) {
tmp = 100.0 * (n * (Math.expm1(i) / i));
} else {
tmp = 100.0 * (Math.pow((i / n), (n + -1.0)) + (n * (-1.0 / i)));
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -3500000000000.0: tmp = 100.0 * ((math.pow((i / n), n) + -1.0) * (n / i)) elif i <= 5.6e+104: tmp = 100.0 * (n * (math.expm1(i) / i)) else: tmp = 100.0 * (math.pow((i / n), (n + -1.0)) + (n * (-1.0 / i))) return tmp
function code(i, n) tmp = 0.0 if (i <= -3500000000000.0) tmp = Float64(100.0 * Float64(Float64((Float64(i / n) ^ n) + -1.0) * Float64(n / i))); elseif (i <= 5.6e+104) tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); else tmp = Float64(100.0 * Float64((Float64(i / n) ^ Float64(n + -1.0)) + Float64(n * Float64(-1.0 / i)))); end return tmp end
code[i_, n_] := If[LessEqual[i, -3500000000000.0], N[(100.0 * N[(N[(N[Power[N[(i / n), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision] * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 5.6e+104], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(N[Power[N[(i / n), $MachinePrecision], N[(n + -1.0), $MachinePrecision]], $MachinePrecision] + N[(n * N[(-1.0 / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -3500000000000:\\
\;\;\;\;100 \cdot \left(\left({\left(\frac{i}{n}\right)}^{n} + -1\right) \cdot \frac{n}{i}\right)\\
\mathbf{elif}\;i \leq 5.6 \cdot 10^{+104}:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left({\left(\frac{i}{n}\right)}^{\left(n + -1\right)} + n \cdot \frac{-1}{i}\right)\\
\end{array}
\end{array}
if i < -3.5e12Initial program 57.9%
Taylor expanded in i around inf 85.4%
div-inv85.4%
sub-neg85.4%
metadata-eval85.4%
clear-num85.4%
Applied egg-rr85.4%
if -3.5e12 < i < 5.6e104Initial program 9.7%
Taylor expanded in n around inf 18.7%
*-commutative18.7%
associate-/l*18.7%
expm1-define85.0%
Simplified85.0%
if 5.6e104 < i Initial program 58.9%
Taylor expanded in i around inf 66.7%
div-sub66.7%
clear-num64.3%
div-inv65.2%
cancel-sign-sub-inv65.2%
pow165.2%
pow-div73.1%
Applied egg-rr73.1%
Final simplification83.4%
(FPCore (i n) :precision binary64 (if (or (<= n -2.65e-160) (not (<= n 2.7e-126))) (* 100.0 (* n (/ (expm1 i) i))) (/ 0.0 (/ i n))))
double code(double i, double n) {
double tmp;
if ((n <= -2.65e-160) || !(n <= 2.7e-126)) {
tmp = 100.0 * (n * (expm1(i) / i));
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((n <= -2.65e-160) || !(n <= 2.7e-126)) {
tmp = 100.0 * (n * (Math.expm1(i) / i));
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -2.65e-160) or not (n <= 2.7e-126): tmp = 100.0 * (n * (math.expm1(i) / i)) else: tmp = 0.0 / (i / n) return tmp
function code(i, n) tmp = 0.0 if ((n <= -2.65e-160) || !(n <= 2.7e-126)) tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); else tmp = Float64(0.0 / Float64(i / n)); end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -2.65e-160], N[Not[LessEqual[n, 2.7e-126]], $MachinePrecision]], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.65 \cdot 10^{-160} \lor \neg \left(n \leq 2.7 \cdot 10^{-126}\right):\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -2.6500000000000001e-160 or 2.69999999999999995e-126 < n Initial program 21.3%
Taylor expanded in n around inf 33.1%
*-commutative33.1%
associate-/l*33.0%
expm1-define85.5%
Simplified85.5%
if -2.6500000000000001e-160 < n < 2.69999999999999995e-126Initial program 56.6%
associate-*r/56.6%
sub-neg56.6%
distribute-rgt-in56.6%
metadata-eval56.6%
metadata-eval56.6%
Simplified56.6%
Taylor expanded in i around inf 56.0%
Taylor expanded in n around 0 70.2%
Final simplification82.9%
(FPCore (i n) :precision binary64 (if (or (<= n -1.2e-161) (not (<= n 4.7e-126))) (* n (/ (* 100.0 (expm1 i)) i)) (/ 0.0 (/ i n))))
double code(double i, double n) {
double tmp;
if ((n <= -1.2e-161) || !(n <= 4.7e-126)) {
tmp = n * ((100.0 * expm1(i)) / i);
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((n <= -1.2e-161) || !(n <= 4.7e-126)) {
tmp = n * ((100.0 * Math.expm1(i)) / i);
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -1.2e-161) or not (n <= 4.7e-126): tmp = n * ((100.0 * math.expm1(i)) / i) else: tmp = 0.0 / (i / n) return tmp
function code(i, n) tmp = 0.0 if ((n <= -1.2e-161) || !(n <= 4.7e-126)) tmp = Float64(n * Float64(Float64(100.0 * expm1(i)) / i)); else tmp = Float64(0.0 / Float64(i / n)); end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -1.2e-161], N[Not[LessEqual[n, 4.7e-126]], $MachinePrecision]], N[(n * N[(N[(100.0 * N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.2 \cdot 10^{-161} \lor \neg \left(n \leq 4.7 \cdot 10^{-126}\right):\\
\;\;\;\;n \cdot \frac{100 \cdot \mathsf{expm1}\left(i\right)}{i}\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -1.19999999999999999e-161 or 4.70000000000000017e-126 < n Initial program 21.3%
associate-/r/21.6%
associate-*r*21.6%
*-commutative21.6%
associate-*r/21.6%
sub-neg21.6%
distribute-lft-in21.6%
metadata-eval21.6%
metadata-eval21.6%
metadata-eval21.6%
fma-define21.6%
metadata-eval21.6%
Simplified21.6%
Taylor expanded in n around inf 33.0%
sub-neg33.0%
metadata-eval33.0%
metadata-eval33.0%
distribute-lft-in33.0%
metadata-eval33.0%
sub-neg33.0%
expm1-define85.5%
Simplified85.5%
if -1.19999999999999999e-161 < n < 4.70000000000000017e-126Initial program 56.6%
associate-*r/56.6%
sub-neg56.6%
distribute-rgt-in56.6%
metadata-eval56.6%
metadata-eval56.6%
Simplified56.6%
Taylor expanded in i around inf 56.0%
Taylor expanded in n around 0 70.2%
Final simplification82.9%
(FPCore (i n) :precision binary64 (if (or (<= i -4.1e-60) (not (<= i 2.65e-88))) (* 100.0 (* (/ n i) (expm1 i))) (* 100.0 (+ n (* (* i n) (- 0.5 (/ 0.5 n)))))))
double code(double i, double n) {
double tmp;
if ((i <= -4.1e-60) || !(i <= 2.65e-88)) {
tmp = 100.0 * ((n / i) * expm1(i));
} else {
tmp = 100.0 * (n + ((i * n) * (0.5 - (0.5 / n))));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((i <= -4.1e-60) || !(i <= 2.65e-88)) {
tmp = 100.0 * ((n / i) * Math.expm1(i));
} else {
tmp = 100.0 * (n + ((i * n) * (0.5 - (0.5 / n))));
}
return tmp;
}
def code(i, n): tmp = 0 if (i <= -4.1e-60) or not (i <= 2.65e-88): tmp = 100.0 * ((n / i) * math.expm1(i)) else: tmp = 100.0 * (n + ((i * n) * (0.5 - (0.5 / n)))) return tmp
function code(i, n) tmp = 0.0 if ((i <= -4.1e-60) || !(i <= 2.65e-88)) tmp = Float64(100.0 * Float64(Float64(n / i) * expm1(i))); else tmp = Float64(100.0 * Float64(n + Float64(Float64(i * n) * Float64(0.5 - Float64(0.5 / n))))); end return tmp end
code[i_, n_] := If[Or[LessEqual[i, -4.1e-60], N[Not[LessEqual[i, 2.65e-88]], $MachinePrecision]], N[(100.0 * N[(N[(n / i), $MachinePrecision] * N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n + N[(N[(i * n), $MachinePrecision] * N[(0.5 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -4.1 \cdot 10^{-60} \lor \neg \left(i \leq 2.65 \cdot 10^{-88}\right):\\
\;\;\;\;100 \cdot \left(\frac{n}{i} \cdot \mathsf{expm1}\left(i\right)\right)\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n + \left(i \cdot n\right) \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\\
\end{array}
\end{array}
if i < -4.10000000000000013e-60 or 2.65000000000000004e-88 < i Initial program 43.1%
associate-*r/43.1%
sub-neg43.1%
distribute-rgt-in43.0%
metadata-eval43.0%
metadata-eval43.0%
Simplified43.0%
metadata-eval43.0%
metadata-eval43.0%
distribute-rgt-in43.1%
sub-neg43.1%
associate-*r/43.1%
*-commutative43.1%
associate-/r/43.1%
associate-*l*43.1%
add-exp-log43.1%
expm1-define43.1%
log-pow38.8%
log1p-define84.5%
Applied egg-rr84.5%
Taylor expanded in n around inf 54.8%
expm1-define67.5%
associate-*l/66.8%
Simplified66.8%
if -4.10000000000000013e-60 < i < 2.65000000000000004e-88Initial program 7.4%
Taylor expanded in i around 0 88.5%
associate-*r*88.7%
*-commutative88.7%
associate-*r/88.7%
metadata-eval88.7%
Simplified88.7%
Final simplification76.5%
(FPCore (i n)
:precision binary64
(if (<= i -9.8e-61)
(* 100.0 (* (/ n i) (expm1 i)))
(if (<= i 1.18e-77)
(* 100.0 (+ n (* (* i n) (- 0.5 (/ 0.5 n)))))
(* 100.0 (/ (expm1 i) (/ i n))))))
double code(double i, double n) {
double tmp;
if (i <= -9.8e-61) {
tmp = 100.0 * ((n / i) * expm1(i));
} else if (i <= 1.18e-77) {
tmp = 100.0 * (n + ((i * n) * (0.5 - (0.5 / n))));
} else {
tmp = 100.0 * (expm1(i) / (i / n));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if (i <= -9.8e-61) {
tmp = 100.0 * ((n / i) * Math.expm1(i));
} else if (i <= 1.18e-77) {
tmp = 100.0 * (n + ((i * n) * (0.5 - (0.5 / n))));
} else {
tmp = 100.0 * (Math.expm1(i) / (i / n));
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -9.8e-61: tmp = 100.0 * ((n / i) * math.expm1(i)) elif i <= 1.18e-77: tmp = 100.0 * (n + ((i * n) * (0.5 - (0.5 / n)))) else: tmp = 100.0 * (math.expm1(i) / (i / n)) return tmp
function code(i, n) tmp = 0.0 if (i <= -9.8e-61) tmp = Float64(100.0 * Float64(Float64(n / i) * expm1(i))); elseif (i <= 1.18e-77) tmp = Float64(100.0 * Float64(n + Float64(Float64(i * n) * Float64(0.5 - Float64(0.5 / n))))); else tmp = Float64(100.0 * Float64(expm1(i) / Float64(i / n))); end return tmp end
code[i_, n_] := If[LessEqual[i, -9.8e-61], N[(100.0 * N[(N[(n / i), $MachinePrecision] * N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 1.18e-77], N[(100.0 * N[(n + N[(N[(i * n), $MachinePrecision] * N[(0.5 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -9.8 \cdot 10^{-61}:\\
\;\;\;\;100 \cdot \left(\frac{n}{i} \cdot \mathsf{expm1}\left(i\right)\right)\\
\mathbf{elif}\;i \leq 1.18 \cdot 10^{-77}:\\
\;\;\;\;100 \cdot \left(n + \left(i \cdot n\right) \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\
\end{array}
\end{array}
if i < -9.80000000000000004e-61Initial program 46.3%
associate-*r/46.3%
sub-neg46.3%
distribute-rgt-in46.2%
metadata-eval46.2%
metadata-eval46.2%
Simplified46.2%
metadata-eval46.2%
metadata-eval46.2%
distribute-rgt-in46.3%
sub-neg46.3%
associate-*r/46.3%
*-commutative46.3%
associate-/r/46.3%
associate-*l*46.3%
add-exp-log46.3%
expm1-define46.3%
log-pow43.7%
log1p-define94.2%
Applied egg-rr94.2%
Taylor expanded in n around inf 66.2%
expm1-define80.6%
associate-*l/80.6%
Simplified80.6%
if -9.80000000000000004e-61 < i < 1.1800000000000001e-77Initial program 7.4%
Taylor expanded in i around 0 88.5%
associate-*r*88.7%
*-commutative88.7%
associate-*r/88.7%
metadata-eval88.7%
Simplified88.7%
if 1.1800000000000001e-77 < i Initial program 39.6%
Taylor expanded in n around inf 42.9%
expm1-define52.4%
Simplified52.4%
Final simplification76.5%
(FPCore (i n)
:precision binary64
(if (<= n -6.5e+48)
(*
100.0
(*
n
(+
1.0
(* i (+ 0.5 (* i (+ 0.16666666666666666 (* i 0.041666666666666664))))))))
(if (<= n -1.6e-144)
(* 100.0 (/ i (/ i n)))
(if (<= n 6e-127)
(/ 0.0 (/ i n))
(*
100.0
(+
n
(*
i
(+
(* n 0.5)
(*
i
(+
(* (* i n) 0.041666666666666664)
(* n 0.16666666666666666)))))))))))
double code(double i, double n) {
double tmp;
if (n <= -6.5e+48) {
tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * (0.16666666666666666 + (i * 0.041666666666666664)))))));
} else if (n <= -1.6e-144) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 6e-127) {
tmp = 0.0 / (i / n);
} else {
tmp = 100.0 * (n + (i * ((n * 0.5) + (i * (((i * n) * 0.041666666666666664) + (n * 0.16666666666666666))))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-6.5d+48)) then
tmp = 100.0d0 * (n * (1.0d0 + (i * (0.5d0 + (i * (0.16666666666666666d0 + (i * 0.041666666666666664d0)))))))
else if (n <= (-1.6d-144)) then
tmp = 100.0d0 * (i / (i / n))
else if (n <= 6d-127) then
tmp = 0.0d0 / (i / n)
else
tmp = 100.0d0 * (n + (i * ((n * 0.5d0) + (i * (((i * n) * 0.041666666666666664d0) + (n * 0.16666666666666666d0))))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -6.5e+48) {
tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * (0.16666666666666666 + (i * 0.041666666666666664)))))));
} else if (n <= -1.6e-144) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 6e-127) {
tmp = 0.0 / (i / n);
} else {
tmp = 100.0 * (n + (i * ((n * 0.5) + (i * (((i * n) * 0.041666666666666664) + (n * 0.16666666666666666))))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -6.5e+48: tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * (0.16666666666666666 + (i * 0.041666666666666664))))))) elif n <= -1.6e-144: tmp = 100.0 * (i / (i / n)) elif n <= 6e-127: tmp = 0.0 / (i / n) else: tmp = 100.0 * (n + (i * ((n * 0.5) + (i * (((i * n) * 0.041666666666666664) + (n * 0.16666666666666666)))))) return tmp
function code(i, n) tmp = 0.0 if (n <= -6.5e+48) tmp = Float64(100.0 * Float64(n * Float64(1.0 + Float64(i * Float64(0.5 + Float64(i * Float64(0.16666666666666666 + Float64(i * 0.041666666666666664)))))))); elseif (n <= -1.6e-144) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (n <= 6e-127) tmp = Float64(0.0 / Float64(i / n)); else tmp = Float64(100.0 * Float64(n + Float64(i * Float64(Float64(n * 0.5) + Float64(i * Float64(Float64(Float64(i * n) * 0.041666666666666664) + Float64(n * 0.16666666666666666))))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -6.5e+48) tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * (0.16666666666666666 + (i * 0.041666666666666664))))))); elseif (n <= -1.6e-144) tmp = 100.0 * (i / (i / n)); elseif (n <= 6e-127) tmp = 0.0 / (i / n); else tmp = 100.0 * (n + (i * ((n * 0.5) + (i * (((i * n) * 0.041666666666666664) + (n * 0.16666666666666666)))))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -6.5e+48], 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], If[LessEqual[n, -1.6e-144], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 6e-127], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n + N[(i * N[(N[(n * 0.5), $MachinePrecision] + N[(i * N[(N[(N[(i * n), $MachinePrecision] * 0.041666666666666664), $MachinePrecision] + N[(n * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -6.5 \cdot 10^{+48}:\\
\;\;\;\;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)\\
\mathbf{elif}\;n \leq -1.6 \cdot 10^{-144}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 6 \cdot 10^{-127}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n + i \cdot \left(n \cdot 0.5 + i \cdot \left(\left(i \cdot n\right) \cdot 0.041666666666666664 + n \cdot 0.16666666666666666\right)\right)\right)\\
\end{array}
\end{array}
if n < -6.49999999999999972e48Initial program 17.0%
Taylor expanded in n around inf 38.6%
*-commutative38.6%
associate-/l*38.6%
expm1-define91.4%
Simplified91.4%
Taylor expanded in i around 0 66.9%
*-commutative66.9%
Simplified66.9%
if -6.49999999999999972e48 < n < -1.59999999999999986e-144Initial program 37.9%
Taylor expanded in i around 0 69.2%
if -1.59999999999999986e-144 < n < 6.00000000000000017e-127Initial program 57.3%
associate-*r/57.3%
sub-neg57.3%
distribute-rgt-in57.3%
metadata-eval57.3%
metadata-eval57.3%
Simplified57.3%
Taylor expanded in i around inf 56.8%
Taylor expanded in n around 0 70.1%
if 6.00000000000000017e-127 < n Initial program 17.0%
Taylor expanded in n around inf 35.2%
expm1-define69.9%
Simplified69.9%
Taylor expanded in i around 0 70.5%
Final simplification69.3%
(FPCore (i n)
:precision binary64
(let* ((t_0
(*
100.0
(*
n
(+
1.0
(*
i
(+
0.5
(* i (+ 0.16666666666666666 (* i 0.041666666666666664))))))))))
(if (<= n -8.8e+49)
t_0
(if (<= n -2.9e-144)
(* 100.0 (/ i (/ i n)))
(if (<= n 6e-127) (/ 0.0 (/ i n)) t_0)))))
double code(double i, double n) {
double t_0 = 100.0 * (n * (1.0 + (i * (0.5 + (i * (0.16666666666666666 + (i * 0.041666666666666664)))))));
double tmp;
if (n <= -8.8e+49) {
tmp = t_0;
} else if (n <= -2.9e-144) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 6e-127) {
tmp = 0.0 / (i / n);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = 100.0d0 * (n * (1.0d0 + (i * (0.5d0 + (i * (0.16666666666666666d0 + (i * 0.041666666666666664d0)))))))
if (n <= (-8.8d+49)) then
tmp = t_0
else if (n <= (-2.9d-144)) then
tmp = 100.0d0 * (i / (i / n))
else if (n <= 6d-127) then
tmp = 0.0d0 / (i / n)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double i, double n) {
double t_0 = 100.0 * (n * (1.0 + (i * (0.5 + (i * (0.16666666666666666 + (i * 0.041666666666666664)))))));
double tmp;
if (n <= -8.8e+49) {
tmp = t_0;
} else if (n <= -2.9e-144) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 6e-127) {
tmp = 0.0 / (i / n);
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (n * (1.0 + (i * (0.5 + (i * (0.16666666666666666 + (i * 0.041666666666666664))))))) tmp = 0 if n <= -8.8e+49: tmp = t_0 elif n <= -2.9e-144: tmp = 100.0 * (i / (i / n)) elif n <= 6e-127: tmp = 0.0 / (i / n) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(n * Float64(1.0 + Float64(i * Float64(0.5 + Float64(i * Float64(0.16666666666666666 + Float64(i * 0.041666666666666664)))))))) tmp = 0.0 if (n <= -8.8e+49) tmp = t_0; elseif (n <= -2.9e-144) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (n <= 6e-127) tmp = Float64(0.0 / Float64(i / n)); else tmp = t_0; end return tmp end
function tmp_2 = code(i, n) t_0 = 100.0 * (n * (1.0 + (i * (0.5 + (i * (0.16666666666666666 + (i * 0.041666666666666664))))))); tmp = 0.0; if (n <= -8.8e+49) tmp = t_0; elseif (n <= -2.9e-144) tmp = 100.0 * (i / (i / n)); elseif (n <= 6e-127) tmp = 0.0 / (i / n); else tmp = t_0; end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(n * N[(1.0 + N[(i * N[(0.5 + N[(i * N[(0.16666666666666666 + N[(i * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -8.8e+49], t$95$0, If[LessEqual[n, -2.9e-144], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 6e-127], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 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)\\
\mathbf{if}\;n \leq -8.8 \cdot 10^{+49}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq -2.9 \cdot 10^{-144}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 6 \cdot 10^{-127}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -8.8000000000000003e49 or 6.00000000000000017e-127 < n Initial program 17.0%
Taylor expanded in n around inf 36.8%
*-commutative36.8%
associate-/l*36.8%
expm1-define89.1%
Simplified89.1%
Taylor expanded in i around 0 69.1%
*-commutative69.1%
Simplified69.1%
if -8.8000000000000003e49 < n < -2.9000000000000002e-144Initial program 37.9%
Taylor expanded in i around 0 69.2%
if -2.9000000000000002e-144 < n < 6.00000000000000017e-127Initial program 57.3%
associate-*r/57.3%
sub-neg57.3%
distribute-rgt-in57.3%
metadata-eval57.3%
metadata-eval57.3%
Simplified57.3%
Taylor expanded in i around inf 56.8%
Taylor expanded in n around 0 70.1%
Final simplification69.3%
(FPCore (i n)
:precision binary64
(if (<= n -1.06e+47)
(* 100.0 (* n (+ 1.0 (* i (+ 0.5 (* i 0.16666666666666666))))))
(if (<= n -1.75e-144)
(* 100.0 (/ i (/ i n)))
(if (<= n 6.3e-127)
(/ 0.0 (/ i n))
(* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668)))))))))
double code(double i, double n) {
double tmp;
if (n <= -1.06e+47) {
tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * 0.16666666666666666)))));
} else if (n <= -1.75e-144) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 6.3e-127) {
tmp = 0.0 / (i / n);
} else {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-1.06d+47)) then
tmp = 100.0d0 * (n * (1.0d0 + (i * (0.5d0 + (i * 0.16666666666666666d0)))))
else if (n <= (-1.75d-144)) then
tmp = 100.0d0 * (i / (i / n))
else if (n <= 6.3d-127) then
tmp = 0.0d0 / (i / n)
else
tmp = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -1.06e+47) {
tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * 0.16666666666666666)))));
} else if (n <= -1.75e-144) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 6.3e-127) {
tmp = 0.0 / (i / n);
} else {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -1.06e+47: tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * 0.16666666666666666))))) elif n <= -1.75e-144: tmp = 100.0 * (i / (i / n)) elif n <= 6.3e-127: tmp = 0.0 / (i / n) else: tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) return tmp
function code(i, n) tmp = 0.0 if (n <= -1.06e+47) tmp = Float64(100.0 * Float64(n * Float64(1.0 + Float64(i * Float64(0.5 + Float64(i * 0.16666666666666666)))))); elseif (n <= -1.75e-144) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (n <= 6.3e-127) tmp = Float64(0.0 / Float64(i / n)); else tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -1.06e+47) tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * 0.16666666666666666))))); elseif (n <= -1.75e-144) tmp = 100.0 * (i / (i / n)); elseif (n <= 6.3e-127) tmp = 0.0 / (i / n); else tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -1.06e+47], N[(100.0 * N[(n * N[(1.0 + N[(i * N[(0.5 + N[(i * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -1.75e-144], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 6.3e-127], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.06 \cdot 10^{+47}:\\
\;\;\;\;100 \cdot \left(n \cdot \left(1 + i \cdot \left(0.5 + i \cdot 0.16666666666666666\right)\right)\right)\\
\mathbf{elif}\;n \leq -1.75 \cdot 10^{-144}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 6.3 \cdot 10^{-127}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\end{array}
\end{array}
if n < -1.05999999999999996e47Initial program 17.0%
Taylor expanded in n around inf 38.6%
*-commutative38.6%
associate-/l*38.6%
expm1-define91.4%
Simplified91.4%
Taylor expanded in i around 0 65.9%
*-commutative65.9%
Simplified65.9%
if -1.05999999999999996e47 < n < -1.7499999999999999e-144Initial program 37.9%
Taylor expanded in i around 0 69.2%
if -1.7499999999999999e-144 < n < 6.2999999999999999e-127Initial program 57.3%
associate-*r/57.3%
sub-neg57.3%
distribute-rgt-in57.3%
metadata-eval57.3%
metadata-eval57.3%
Simplified57.3%
Taylor expanded in i around inf 56.8%
Taylor expanded in n around 0 70.1%
if 6.2999999999999999e-127 < n Initial program 17.0%
Taylor expanded in n around inf 35.2%
expm1-define69.9%
Simplified69.9%
Taylor expanded in i around 0 66.5%
Taylor expanded in n around 0 66.5%
Final simplification67.4%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668)))))))
(if (<= n -6.4e+47)
t_0
(if (<= n -1.6e-144)
(* 100.0 (/ i (/ i n)))
(if (<= n 1.3e-125) (/ 0.0 (/ i n)) t_0)))))
double code(double i, double n) {
double t_0 = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
double tmp;
if (n <= -6.4e+47) {
tmp = t_0;
} else if (n <= -1.6e-144) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 1.3e-125) {
tmp = 0.0 / (i / n);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
if (n <= (-6.4d+47)) then
tmp = t_0
else if (n <= (-1.6d-144)) then
tmp = 100.0d0 * (i / (i / n))
else if (n <= 1.3d-125) then
tmp = 0.0d0 / (i / n)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double i, double n) {
double t_0 = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
double tmp;
if (n <= -6.4e+47) {
tmp = t_0;
} else if (n <= -1.6e-144) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 1.3e-125) {
tmp = 0.0 / (i / n);
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) tmp = 0 if n <= -6.4e+47: tmp = t_0 elif n <= -1.6e-144: tmp = 100.0 * (i / (i / n)) elif n <= 1.3e-125: tmp = 0.0 / (i / n) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))) tmp = 0.0 if (n <= -6.4e+47) tmp = t_0; elseif (n <= -1.6e-144) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (n <= 1.3e-125) tmp = Float64(0.0 / Float64(i / n)); else tmp = t_0; end return tmp end
function tmp_2 = code(i, n) t_0 = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); tmp = 0.0; if (n <= -6.4e+47) tmp = t_0; elseif (n <= -1.6e-144) tmp = 100.0 * (i / (i / n)); elseif (n <= 1.3e-125) tmp = 0.0 / (i / n); else tmp = t_0; end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -6.4e+47], t$95$0, If[LessEqual[n, -1.6e-144], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.3e-125], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\mathbf{if}\;n \leq -6.4 \cdot 10^{+47}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq -1.6 \cdot 10^{-144}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 1.3 \cdot 10^{-125}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -6.4e47 or 1.30000000000000003e-125 < n Initial program 17.0%
Taylor expanded in n around inf 36.4%
expm1-define68.2%
Simplified68.2%
Taylor expanded in i around 0 66.3%
Taylor expanded in n around 0 66.3%
if -6.4e47 < n < -1.59999999999999986e-144Initial program 37.9%
Taylor expanded in i around 0 69.2%
if -1.59999999999999986e-144 < n < 1.30000000000000003e-125Initial program 57.3%
associate-*r/57.3%
sub-neg57.3%
distribute-rgt-in57.3%
metadata-eval57.3%
metadata-eval57.3%
Simplified57.3%
Taylor expanded in i around inf 56.8%
Taylor expanded in n around 0 70.1%
Final simplification67.4%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* n (+ 100.0 (* i 50.0)))))
(if (<= n -1.45e+47)
t_0
(if (<= n -1.9e-144)
(* 100.0 (/ i (/ i n)))
(if (<= n 6e-127) (/ 0.0 (/ i n)) t_0)))))
double code(double i, double n) {
double t_0 = n * (100.0 + (i * 50.0));
double tmp;
if (n <= -1.45e+47) {
tmp = t_0;
} else if (n <= -1.9e-144) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 6e-127) {
tmp = 0.0 / (i / n);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = n * (100.0d0 + (i * 50.0d0))
if (n <= (-1.45d+47)) then
tmp = t_0
else if (n <= (-1.9d-144)) then
tmp = 100.0d0 * (i / (i / n))
else if (n <= 6d-127) then
tmp = 0.0d0 / (i / n)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double i, double n) {
double t_0 = n * (100.0 + (i * 50.0));
double tmp;
if (n <= -1.45e+47) {
tmp = t_0;
} else if (n <= -1.9e-144) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 6e-127) {
tmp = 0.0 / (i / n);
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = n * (100.0 + (i * 50.0)) tmp = 0 if n <= -1.45e+47: tmp = t_0 elif n <= -1.9e-144: tmp = 100.0 * (i / (i / n)) elif n <= 6e-127: tmp = 0.0 / (i / n) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(n * Float64(100.0 + Float64(i * 50.0))) tmp = 0.0 if (n <= -1.45e+47) tmp = t_0; elseif (n <= -1.9e-144) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (n <= 6e-127) tmp = Float64(0.0 / Float64(i / n)); else tmp = t_0; end return tmp end
function tmp_2 = code(i, n) t_0 = n * (100.0 + (i * 50.0)); tmp = 0.0; if (n <= -1.45e+47) tmp = t_0; elseif (n <= -1.9e-144) tmp = 100.0 * (i / (i / n)); elseif (n <= 6e-127) tmp = 0.0 / (i / n); else tmp = t_0; end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1.45e+47], t$95$0, If[LessEqual[n, -1.9e-144], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 6e-127], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{if}\;n \leq -1.45 \cdot 10^{+47}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq -1.9 \cdot 10^{-144}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 6 \cdot 10^{-127}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -1.4499999999999999e47 or 6.00000000000000017e-127 < n Initial program 17.0%
Taylor expanded in n around inf 36.4%
expm1-define68.2%
Simplified68.2%
Taylor expanded in i around 0 64.4%
associate-*r*64.4%
distribute-rgt-out64.4%
Applied egg-rr64.4%
if -1.4499999999999999e47 < n < -1.89999999999999996e-144Initial program 37.9%
Taylor expanded in i around 0 69.2%
if -1.89999999999999996e-144 < n < 6.00000000000000017e-127Initial program 57.3%
associate-*r/57.3%
sub-neg57.3%
distribute-rgt-in57.3%
metadata-eval57.3%
metadata-eval57.3%
Simplified57.3%
Taylor expanded in i around inf 56.8%
Taylor expanded in n around 0 70.1%
Final simplification66.1%
(FPCore (i n) :precision binary64 (if (or (<= n -1.2e+47) (not (<= n 1.5))) (* n (+ 100.0 (* i 50.0))) (* 100.0 (/ i (/ i n)))))
double code(double i, double n) {
double tmp;
if ((n <= -1.2e+47) || !(n <= 1.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 <= (-1.2d+47)) .or. (.not. (n <= 1.5d0))) 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 <= -1.2e+47) || !(n <= 1.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 <= -1.2e+47) or not (n <= 1.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 <= -1.2e+47) || !(n <= 1.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 <= -1.2e+47) || ~((n <= 1.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, -1.2e+47], N[Not[LessEqual[n, 1.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 -1.2 \cdot 10^{+47} \lor \neg \left(n \leq 1.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 < -1.20000000000000009e47 or 1.5 < n Initial program 17.4%
Taylor expanded in n around inf 41.7%
expm1-define69.0%
Simplified69.0%
Taylor expanded in i around 0 64.4%
associate-*r*64.4%
distribute-rgt-out64.4%
Applied egg-rr64.4%
if -1.20000000000000009e47 < n < 1.5Initial program 41.1%
Taylor expanded in i around 0 58.5%
Final simplification61.9%
(FPCore (i n) :precision binary64 (if (<= i -2e+31) (* 100.0 (/ i (/ i n))) (if (<= i 0.96) (* n 100.0) (* (* i n) 50.0))))
double code(double i, double n) {
double tmp;
if (i <= -2e+31) {
tmp = 100.0 * (i / (i / n));
} else if (i <= 0.96) {
tmp = n * 100.0;
} else {
tmp = (i * n) * 50.0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= (-2d+31)) then
tmp = 100.0d0 * (i / (i / n))
else if (i <= 0.96d0) then
tmp = n * 100.0d0
else
tmp = (i * n) * 50.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= -2e+31) {
tmp = 100.0 * (i / (i / n));
} else if (i <= 0.96) {
tmp = n * 100.0;
} else {
tmp = (i * n) * 50.0;
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -2e+31: tmp = 100.0 * (i / (i / n)) elif i <= 0.96: tmp = n * 100.0 else: tmp = (i * n) * 50.0 return tmp
function code(i, n) tmp = 0.0 if (i <= -2e+31) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (i <= 0.96) tmp = Float64(n * 100.0); else tmp = Float64(Float64(i * n) * 50.0); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -2e+31) tmp = 100.0 * (i / (i / n)); elseif (i <= 0.96) tmp = n * 100.0; else tmp = (i * n) * 50.0; end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -2e+31], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 0.96], N[(n * 100.0), $MachinePrecision], N[(N[(i * n), $MachinePrecision] * 50.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -2 \cdot 10^{+31}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;i \leq 0.96:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;\left(i \cdot n\right) \cdot 50\\
\end{array}
\end{array}
if i < -1.9999999999999999e31Initial program 58.7%
Taylor expanded in i around 0 29.2%
if -1.9999999999999999e31 < i < 0.95999999999999996Initial program 9.7%
associate-/r/10.2%
associate-*r*10.2%
*-commutative10.2%
associate-*r/10.2%
sub-neg10.2%
distribute-lft-in10.2%
metadata-eval10.2%
metadata-eval10.2%
metadata-eval10.2%
fma-define10.2%
metadata-eval10.2%
Simplified10.2%
Taylor expanded in i around 0 81.3%
*-commutative81.3%
Simplified81.3%
if 0.95999999999999996 < i Initial program 46.6%
Taylor expanded in n around inf 48.9%
expm1-define48.9%
Simplified48.9%
Taylor expanded in i around 0 27.8%
Taylor expanded in i around inf 27.8%
*-commutative27.8%
Simplified27.8%
Final simplification59.4%
(FPCore (i n) :precision binary64 (if (<= i 0.96) (* n 100.0) (* (* i n) 50.0)))
double code(double i, double n) {
double tmp;
if (i <= 0.96) {
tmp = n * 100.0;
} else {
tmp = (i * n) * 50.0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= 0.96d0) then
tmp = n * 100.0d0
else
tmp = (i * n) * 50.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= 0.96) {
tmp = n * 100.0;
} else {
tmp = (i * n) * 50.0;
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 0.96: tmp = n * 100.0 else: tmp = (i * n) * 50.0 return tmp
function code(i, n) tmp = 0.0 if (i <= 0.96) tmp = Float64(n * 100.0); else tmp = Float64(Float64(i * n) * 50.0); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= 0.96) tmp = n * 100.0; else tmp = (i * n) * 50.0; end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, 0.96], N[(n * 100.0), $MachinePrecision], N[(N[(i * n), $MachinePrecision] * 50.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 0.96:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;\left(i \cdot n\right) \cdot 50\\
\end{array}
\end{array}
if i < 0.95999999999999996Initial program 21.9%
associate-/r/22.3%
associate-*r*22.3%
*-commutative22.3%
associate-*r/22.3%
sub-neg22.3%
distribute-lft-in22.2%
metadata-eval22.2%
metadata-eval22.2%
metadata-eval22.2%
fma-define22.3%
metadata-eval22.3%
Simplified22.3%
Taylor expanded in i around 0 62.2%
*-commutative62.2%
Simplified62.2%
if 0.95999999999999996 < i Initial program 46.6%
Taylor expanded in n around inf 48.9%
expm1-define48.9%
Simplified48.9%
Taylor expanded in i around 0 27.8%
Taylor expanded in i around inf 27.8%
*-commutative27.8%
Simplified27.8%
Final simplification54.6%
(FPCore (i n) :precision binary64 (* n 100.0))
double code(double i, double n) {
return n * 100.0;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = n * 100.0d0
end function
public static double code(double i, double n) {
return n * 100.0;
}
def code(i, n): return n * 100.0
function code(i, n) return Float64(n * 100.0) end
function tmp = code(i, n) tmp = n * 100.0; end
code[i_, n_] := N[(n * 100.0), $MachinePrecision]
\begin{array}{l}
\\
n \cdot 100
\end{array}
Initial program 27.3%
associate-/r/27.6%
associate-*r*27.6%
*-commutative27.6%
associate-*r/27.6%
sub-neg27.6%
distribute-lft-in27.6%
metadata-eval27.6%
metadata-eval27.6%
metadata-eval27.6%
fma-define27.6%
metadata-eval27.6%
Simplified27.6%
Taylor expanded in i around 0 49.7%
*-commutative49.7%
Simplified49.7%
(FPCore (i n) :precision binary64 (* i -50.0))
double code(double i, double n) {
return i * -50.0;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = i * (-50.0d0)
end function
public static double code(double i, double n) {
return i * -50.0;
}
def code(i, n): return i * -50.0
function code(i, n) return Float64(i * -50.0) end
function tmp = code(i, n) tmp = i * -50.0; end
code[i_, n_] := N[(i * -50.0), $MachinePrecision]
\begin{array}{l}
\\
i \cdot -50
\end{array}
Initial program 27.3%
Taylor expanded in i around 0 54.3%
associate-*r*54.4%
*-commutative54.4%
associate-*r/54.4%
metadata-eval54.4%
Simplified54.4%
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 2024163
(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))))