
(FPCore (i n) :precision binary64 (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))
double code(double i, double n) {
return 100.0 * ((pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 100.0d0 * ((((1.0d0 + (i / n)) ** n) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
return 100.0 * ((Math.pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
def code(i, n): return 100.0 * ((math.pow((1.0 + (i / n)), n) - 1.0) / (i / n))
function code(i, n) return Float64(100.0 * Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) - 1.0) / Float64(i / n))) end
function tmp = code(i, n) tmp = 100.0 * ((((1.0 + (i / n)) ^ n) - 1.0) / (i / n)); end
code[i_, n_] := N[(100.0 * N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (i n) :precision binary64 (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))
double code(double i, double n) {
return 100.0 * ((pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 100.0d0 * ((((1.0d0 + (i / n)) ** n) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
return 100.0 * ((Math.pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
def code(i, n): return 100.0 * ((math.pow((1.0 + (i / n)), n) - 1.0) / (i / n))
function code(i, n) return Float64(100.0 * Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) - 1.0) / Float64(i / n))) end
function tmp = code(i, n) tmp = 100.0 * ((((1.0 + (i / n)) ^ n) - 1.0) / (i / n)); end
code[i_, n_] := N[(100.0 * N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}
\end{array}
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 0.0)
(/ (* (expm1 (* n (log1p (/ i n)))) 100.0) (/ i n))
(if (<= t_1 INFINITY)
(* 100.0 (/ (- (* n t_0) n) i))
(* n (pow (+ 0.01 (* (* i 0.01) (+ (/ 0.5 n) -0.5))) -1.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 <= 0.0) {
tmp = (expm1((n * log1p((i / n)))) * 100.0) / (i / n);
} else if (t_1 <= ((double) INFINITY)) {
tmp = 100.0 * (((n * t_0) - n) / i);
} else {
tmp = n * pow((0.01 + ((i * 0.01) * ((0.5 / n) + -0.5))), -1.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 <= 0.0) {
tmp = (Math.expm1((n * Math.log1p((i / n)))) * 100.0) / (i / n);
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = 100.0 * (((n * t_0) - n) / i);
} else {
tmp = n * Math.pow((0.01 + ((i * 0.01) * ((0.5 / n) + -0.5))), -1.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 <= 0.0: tmp = (math.expm1((n * math.log1p((i / n)))) * 100.0) / (i / n) elif t_1 <= math.inf: tmp = 100.0 * (((n * t_0) - n) / i) else: tmp = n * math.pow((0.01 + ((i * 0.01) * ((0.5 / n) + -0.5))), -1.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 <= 0.0) tmp = Float64(Float64(expm1(Float64(n * log1p(Float64(i / n)))) * 100.0) / Float64(i / n)); elseif (t_1 <= Inf) tmp = Float64(100.0 * Float64(Float64(Float64(n * t_0) - n) / i)); else tmp = Float64(n * (Float64(0.01 + Float64(Float64(i * 0.01) * Float64(Float64(0.5 / n) + -0.5))) ^ -1.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, 0.0], N[(N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] * 100.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(100.0 * N[(N[(N[(n * t$95$0), $MachinePrecision] - n), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(n * N[Power[N[(0.01 + N[(N[(i * 0.01), $MachinePrecision] * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1.0], $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) \cdot 100}{\frac{i}{n}}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;100 \cdot \frac{n \cdot t\_0 - n}{i}\\
\mathbf{else}:\\
\;\;\;\;n \cdot {\left(0.01 + \left(i \cdot 0.01\right) \cdot \left(\frac{0.5}{n} + -0.5\right)\right)}^{-1}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -0.0Initial program 25.5%
associate-*r/25.5%
*-commutative25.5%
add-exp-log25.5%
expm1-define25.5%
log-pow36.3%
log1p-define98.5%
Applied egg-rr98.5%
if -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 95.8%
div-sub95.7%
div-inv95.7%
clear-num95.6%
clear-num95.9%
Applied egg-rr95.9%
associate-*r/95.9%
sub-div96.5%
+-commutative96.5%
Applied egg-rr96.5%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
add00.0%
*-commutative0.0%
div-inv0.0%
clear-num0.0%
associate-*l*0.0%
add-exp-log0.0%
expm1-define0.0%
log-pow0.0%
log1p-define0.0%
Applied egg-rr0.0%
add00.0%
*-commutative0.0%
associate-*l*0.0%
*-commutative0.0%
associate-*l/1.9%
associate-*r/1.9%
associate-/l*1.8%
Simplified1.8%
clear-num1.8%
un-div-inv1.9%
div-inv1.9%
metadata-eval1.9%
Applied egg-rr1.9%
clear-num1.9%
inv-pow1.9%
Applied egg-rr1.9%
Taylor expanded in i around 0 100.0%
associate-*r*100.0%
*-commutative100.0%
sub-neg100.0%
associate-*r/100.0%
metadata-eval100.0%
metadata-eval100.0%
Simplified100.0%
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 (/ (- (* n t_0) n) i))
(* n (pow (+ 0.01 (* (* i 0.01) (+ (/ 0.5 n) -0.5))) -1.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 <= 0.0) {
tmp = n * (expm1((n * log1p((i / n)))) * (100.0 / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = 100.0 * (((n * t_0) - n) / i);
} else {
tmp = n * pow((0.01 + ((i * 0.01) * ((0.5 / n) + -0.5))), -1.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 <= 0.0) {
tmp = n * (Math.expm1((n * Math.log1p((i / n)))) * (100.0 / i));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = 100.0 * (((n * t_0) - n) / i);
} else {
tmp = n * Math.pow((0.01 + ((i * 0.01) * ((0.5 / n) + -0.5))), -1.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 <= 0.0: tmp = n * (math.expm1((n * math.log1p((i / n)))) * (100.0 / i)) elif t_1 <= math.inf: tmp = 100.0 * (((n * t_0) - n) / i) else: tmp = n * math.pow((0.01 + ((i * 0.01) * ((0.5 / n) + -0.5))), -1.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 <= 0.0) tmp = Float64(n * Float64(expm1(Float64(n * log1p(Float64(i / n)))) * Float64(100.0 / i))); elseif (t_1 <= Inf) tmp = Float64(100.0 * Float64(Float64(Float64(n * t_0) - n) / i)); else tmp = Float64(n * (Float64(0.01 + Float64(Float64(i * 0.01) * Float64(Float64(0.5 / n) + -0.5))) ^ -1.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, 0.0], N[(n * N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] * N[(100.0 / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(100.0 * N[(N[(N[(n * t$95$0), $MachinePrecision] - n), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(n * N[Power[N[(0.01 + N[(N[(i * 0.01), $MachinePrecision] * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1.0], $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 \left(\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot \frac{100}{i}\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;100 \cdot \frac{n \cdot t\_0 - n}{i}\\
\mathbf{else}:\\
\;\;\;\;n \cdot {\left(0.01 + \left(i \cdot 0.01\right) \cdot \left(\frac{0.5}{n} + -0.5\right)\right)}^{-1}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -0.0Initial program 25.5%
add025.5%
*-commutative25.5%
div-inv25.4%
clear-num25.0%
associate-*l*25.0%
add-exp-log25.0%
expm1-define25.0%
log-pow35.8%
log1p-define95.6%
Applied egg-rr95.6%
add095.6%
*-commutative95.6%
associate-*l*95.6%
*-commutative95.6%
associate-*l/87.3%
associate-*r/97.1%
associate-/l*97.1%
Simplified97.1%
if -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 95.8%
div-sub95.7%
div-inv95.7%
clear-num95.6%
clear-num95.9%
Applied egg-rr95.9%
associate-*r/95.9%
sub-div96.5%
+-commutative96.5%
Applied egg-rr96.5%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
add00.0%
*-commutative0.0%
div-inv0.0%
clear-num0.0%
associate-*l*0.0%
add-exp-log0.0%
expm1-define0.0%
log-pow0.0%
log1p-define0.0%
Applied egg-rr0.0%
add00.0%
*-commutative0.0%
associate-*l*0.0%
*-commutative0.0%
associate-*l/1.9%
associate-*r/1.9%
associate-/l*1.8%
Simplified1.8%
clear-num1.8%
un-div-inv1.9%
div-inv1.9%
metadata-eval1.9%
Applied egg-rr1.9%
clear-num1.9%
inv-pow1.9%
Applied egg-rr1.9%
Taylor expanded in i around 0 100.0%
associate-*r*100.0%
*-commutative100.0%
sub-neg100.0%
associate-*r/100.0%
metadata-eval100.0%
metadata-eval100.0%
Simplified100.0%
Final simplification97.5%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 0.0)
(/ 100.0 (/ (/ i n) (expm1 (* n (log1p (/ i n))))))
(if (<= t_1 INFINITY)
(* 100.0 (/ (- (* n t_0) n) i))
(* n (pow (+ 0.01 (* (* i 0.01) (+ (/ 0.5 n) -0.5))) -1.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 <= 0.0) {
tmp = 100.0 / ((i / n) / expm1((n * log1p((i / n)))));
} else if (t_1 <= ((double) INFINITY)) {
tmp = 100.0 * (((n * t_0) - n) / i);
} else {
tmp = n * pow((0.01 + ((i * 0.01) * ((0.5 / n) + -0.5))), -1.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 <= 0.0) {
tmp = 100.0 / ((i / n) / Math.expm1((n * Math.log1p((i / n)))));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = 100.0 * (((n * t_0) - n) / i);
} else {
tmp = n * Math.pow((0.01 + ((i * 0.01) * ((0.5 / n) + -0.5))), -1.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 <= 0.0: tmp = 100.0 / ((i / n) / math.expm1((n * math.log1p((i / n))))) elif t_1 <= math.inf: tmp = 100.0 * (((n * t_0) - n) / i) else: tmp = n * math.pow((0.01 + ((i * 0.01) * ((0.5 / n) + -0.5))), -1.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 <= 0.0) tmp = Float64(100.0 / Float64(Float64(i / n) / expm1(Float64(n * log1p(Float64(i / n)))))); elseif (t_1 <= Inf) tmp = Float64(100.0 * Float64(Float64(Float64(n * t_0) - n) / i)); else tmp = Float64(n * (Float64(0.01 + Float64(Float64(i * 0.01) * Float64(Float64(0.5 / n) + -0.5))) ^ -1.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, 0.0], N[(100.0 / N[(N[(i / n), $MachinePrecision] / N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(100.0 * N[(N[(N[(n * t$95$0), $MachinePrecision] - n), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(n * N[Power[N[(0.01 + N[(N[(i * 0.01), $MachinePrecision] * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1.0], $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{100}{\frac{\frac{i}{n}}{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;100 \cdot \frac{n \cdot t\_0 - n}{i}\\
\mathbf{else}:\\
\;\;\;\;n \cdot {\left(0.01 + \left(i \cdot 0.01\right) \cdot \left(\frac{0.5}{n} + -0.5\right)\right)}^{-1}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -0.0Initial program 25.5%
clear-num25.5%
un-div-inv25.5%
add-exp-log25.5%
expm1-define25.5%
log-pow36.2%
log1p-define98.5%
Applied egg-rr98.5%
if -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 95.8%
div-sub95.7%
div-inv95.7%
clear-num95.6%
clear-num95.9%
Applied egg-rr95.9%
associate-*r/95.9%
sub-div96.5%
+-commutative96.5%
Applied egg-rr96.5%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
add00.0%
*-commutative0.0%
div-inv0.0%
clear-num0.0%
associate-*l*0.0%
add-exp-log0.0%
expm1-define0.0%
log-pow0.0%
log1p-define0.0%
Applied egg-rr0.0%
add00.0%
*-commutative0.0%
associate-*l*0.0%
*-commutative0.0%
associate-*l/1.9%
associate-*r/1.9%
associate-/l*1.8%
Simplified1.8%
clear-num1.8%
un-div-inv1.9%
div-inv1.9%
metadata-eval1.9%
Applied egg-rr1.9%
clear-num1.9%
inv-pow1.9%
Applied egg-rr1.9%
Taylor expanded in i around 0 100.0%
associate-*r*100.0%
*-commutative100.0%
sub-neg100.0%
associate-*r/100.0%
metadata-eval100.0%
metadata-eval100.0%
Simplified100.0%
Final simplification98.5%
(FPCore (i n)
:precision binary64
(if (<= n -9.8e-5)
(* n (/ (* 100.0 (expm1 i)) i))
(if (<= n 1.15)
(* n (pow (+ 0.01 (* (* i 0.01) (+ (/ 0.5 n) -0.5))) -1.0))
(* 100.0 (* n (/ (expm1 i) i))))))
double code(double i, double n) {
double tmp;
if (n <= -9.8e-5) {
tmp = n * ((100.0 * expm1(i)) / i);
} else if (n <= 1.15) {
tmp = n * pow((0.01 + ((i * 0.01) * ((0.5 / n) + -0.5))), -1.0);
} else {
tmp = 100.0 * (n * (expm1(i) / i));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if (n <= -9.8e-5) {
tmp = n * ((100.0 * Math.expm1(i)) / i);
} else if (n <= 1.15) {
tmp = n * Math.pow((0.01 + ((i * 0.01) * ((0.5 / n) + -0.5))), -1.0);
} else {
tmp = 100.0 * (n * (Math.expm1(i) / i));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -9.8e-5: tmp = n * ((100.0 * math.expm1(i)) / i) elif n <= 1.15: tmp = n * math.pow((0.01 + ((i * 0.01) * ((0.5 / n) + -0.5))), -1.0) else: tmp = 100.0 * (n * (math.expm1(i) / i)) return tmp
function code(i, n) tmp = 0.0 if (n <= -9.8e-5) tmp = Float64(n * Float64(Float64(100.0 * expm1(i)) / i)); elseif (n <= 1.15) tmp = Float64(n * (Float64(0.01 + Float64(Float64(i * 0.01) * Float64(Float64(0.5 / n) + -0.5))) ^ -1.0)); else tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); end return tmp end
code[i_, n_] := If[LessEqual[n, -9.8e-5], N[(n * N[(N[(100.0 * N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.15], N[(n * N[Power[N[(0.01 + N[(N[(i * 0.01), $MachinePrecision] * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -9.8 \cdot 10^{-5}:\\
\;\;\;\;n \cdot \frac{100 \cdot \mathsf{expm1}\left(i\right)}{i}\\
\mathbf{elif}\;n \leq 1.15:\\
\;\;\;\;n \cdot {\left(0.01 + \left(i \cdot 0.01\right) \cdot \left(\frac{0.5}{n} + -0.5\right)\right)}^{-1}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\end{array}
\end{array}
if n < -9.8e-5Initial program 26.3%
add026.3%
*-commutative26.3%
div-inv26.3%
clear-num26.3%
associate-*l*26.3%
add-exp-log26.3%
expm1-define26.3%
log-pow17.2%
log1p-define67.5%
Applied egg-rr67.5%
add067.5%
*-commutative67.5%
associate-*l*67.5%
*-commutative67.5%
associate-*l/66.2%
associate-*r/68.5%
associate-/l*68.4%
Simplified68.4%
Taylor expanded in n around inf 40.4%
associate-*r/40.4%
expm1-define89.7%
Simplified89.7%
if -9.8e-5 < n < 1.1499999999999999Initial program 35.6%
add035.6%
*-commutative35.6%
div-inv35.6%
clear-num34.7%
associate-*l*34.7%
add-exp-log34.7%
expm1-define34.7%
log-pow60.9%
log1p-define93.0%
Applied egg-rr93.0%
add093.0%
*-commutative93.0%
associate-*l*93.2%
*-commutative93.2%
associate-*l/74.7%
associate-*r/93.3%
associate-/l*93.3%
Simplified93.3%
clear-num93.2%
un-div-inv93.2%
div-inv93.3%
metadata-eval93.3%
Applied egg-rr93.3%
clear-num93.4%
inv-pow93.4%
Applied egg-rr93.4%
Taylor expanded in i around 0 77.5%
associate-*r*77.5%
*-commutative77.5%
sub-neg77.5%
associate-*r/77.5%
metadata-eval77.5%
metadata-eval77.5%
Simplified77.5%
if 1.1499999999999999 < n Initial program 21.5%
Taylor expanded in n around inf 43.8%
*-commutative43.8%
associate-/l*43.8%
expm1-define97.3%
Simplified97.3%
Final simplification87.8%
(FPCore (i n) :precision binary64 (if (or (<= i -1.8e-23) (not (<= i 7.5e-79))) (* 100.0 (/ (expm1 i) (/ i n))) (* n (+ 100.0 (* (* i 100.0) (- 0.5 (/ 0.5 n)))))))
double code(double i, double n) {
double tmp;
if ((i <= -1.8e-23) || !(i <= 7.5e-79)) {
tmp = 100.0 * (expm1(i) / (i / n));
} else {
tmp = n * (100.0 + ((i * 100.0) * (0.5 - (0.5 / n))));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((i <= -1.8e-23) || !(i <= 7.5e-79)) {
tmp = 100.0 * (Math.expm1(i) / (i / n));
} else {
tmp = n * (100.0 + ((i * 100.0) * (0.5 - (0.5 / n))));
}
return tmp;
}
def code(i, n): tmp = 0 if (i <= -1.8e-23) or not (i <= 7.5e-79): tmp = 100.0 * (math.expm1(i) / (i / n)) else: tmp = n * (100.0 + ((i * 100.0) * (0.5 - (0.5 / n)))) return tmp
function code(i, n) tmp = 0.0 if ((i <= -1.8e-23) || !(i <= 7.5e-79)) tmp = Float64(100.0 * Float64(expm1(i) / Float64(i / n))); else tmp = Float64(n * Float64(100.0 + Float64(Float64(i * 100.0) * Float64(0.5 - Float64(0.5 / n))))); end return tmp end
code[i_, n_] := If[Or[LessEqual[i, -1.8e-23], N[Not[LessEqual[i, 7.5e-79]], $MachinePrecision]], N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(N[(i * 100.0), $MachinePrecision] * N[(0.5 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -1.8 \cdot 10^{-23} \lor \neg \left(i \leq 7.5 \cdot 10^{-79}\right):\\
\;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + \left(i \cdot 100\right) \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\\
\end{array}
\end{array}
if i < -1.7999999999999999e-23 or 7.49999999999999969e-79 < i Initial program 46.8%
Taylor expanded in n around inf 58.5%
expm1-define68.2%
Simplified68.2%
if -1.7999999999999999e-23 < i < 7.49999999999999969e-79Initial program 5.8%
add05.8%
*-commutative5.8%
div-inv5.7%
clear-num5.7%
associate-*l*5.7%
add-exp-log5.7%
expm1-define5.7%
log-pow15.1%
log1p-define66.4%
Applied egg-rr66.4%
add066.4%
*-commutative66.4%
associate-*l*66.5%
*-commutative66.5%
associate-*l/54.3%
associate-*r/68.6%
associate-/l*68.6%
Simplified68.6%
Taylor expanded in i around 0 89.5%
associate-*r*89.5%
*-commutative89.5%
associate-*r/89.5%
metadata-eval89.5%
Simplified89.5%
Final simplification77.9%
(FPCore (i n) :precision binary64 (if (or (<= n -1.3e-105) (not (<= n 7.6e-143))) (* n (/ (expm1 i) (* i 0.01))) (* 0.0 (/ n i))))
double code(double i, double n) {
double tmp;
if ((n <= -1.3e-105) || !(n <= 7.6e-143)) {
tmp = n * (expm1(i) / (i * 0.01));
} else {
tmp = 0.0 * (n / i);
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((n <= -1.3e-105) || !(n <= 7.6e-143)) {
tmp = n * (Math.expm1(i) / (i * 0.01));
} else {
tmp = 0.0 * (n / i);
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -1.3e-105) or not (n <= 7.6e-143): tmp = n * (math.expm1(i) / (i * 0.01)) else: tmp = 0.0 * (n / i) return tmp
function code(i, n) tmp = 0.0 if ((n <= -1.3e-105) || !(n <= 7.6e-143)) tmp = Float64(n * Float64(expm1(i) / Float64(i * 0.01))); else tmp = Float64(0.0 * Float64(n / i)); end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -1.3e-105], N[Not[LessEqual[n, 7.6e-143]], $MachinePrecision]], N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / N[(i * 0.01), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.0 * N[(n / i), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.3 \cdot 10^{-105} \lor \neg \left(n \leq 7.6 \cdot 10^{-143}\right):\\
\;\;\;\;n \cdot \frac{\mathsf{expm1}\left(i\right)}{i \cdot 0.01}\\
\mathbf{else}:\\
\;\;\;\;0 \cdot \frac{n}{i}\\
\end{array}
\end{array}
if n < -1.2999999999999999e-105 or 7.59999999999999962e-143 < n Initial program 22.0%
add022.0%
*-commutative22.0%
div-inv22.0%
clear-num21.9%
associate-*l*21.9%
add-exp-log21.9%
expm1-define21.9%
log-pow24.6%
log1p-define76.1%
Applied egg-rr76.1%
add076.1%
*-commutative76.1%
associate-*l*76.2%
*-commutative76.2%
associate-*l/74.2%
associate-*r/77.7%
associate-/l*77.8%
Simplified77.8%
clear-num77.7%
un-div-inv77.7%
div-inv77.7%
metadata-eval77.7%
Applied egg-rr77.7%
Taylor expanded in n around inf 85.5%
if -1.2999999999999999e-105 < n < 7.59999999999999962e-143Initial program 58.1%
associate-*r/58.1%
associate-/r/57.0%
associate-*l/57.0%
associate-/l*56.8%
sub-neg56.8%
distribute-lft-in56.8%
metadata-eval56.8%
metadata-eval56.8%
metadata-eval56.8%
fma-define56.8%
metadata-eval56.8%
Simplified56.8%
fma-undefine56.8%
*-commutative56.8%
Applied egg-rr56.8%
Taylor expanded in i around 0 69.7%
Final simplification82.8%
(FPCore (i n) :precision binary64 (if (or (<= n -1.3e-105) (not (<= n 7.8e-143))) (* n (/ (* 100.0 (expm1 i)) i)) (* 0.0 (/ n i))))
double code(double i, double n) {
double tmp;
if ((n <= -1.3e-105) || !(n <= 7.8e-143)) {
tmp = n * ((100.0 * expm1(i)) / i);
} else {
tmp = 0.0 * (n / i);
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((n <= -1.3e-105) || !(n <= 7.8e-143)) {
tmp = n * ((100.0 * Math.expm1(i)) / i);
} else {
tmp = 0.0 * (n / i);
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -1.3e-105) or not (n <= 7.8e-143): tmp = n * ((100.0 * math.expm1(i)) / i) else: tmp = 0.0 * (n / i) return tmp
function code(i, n) tmp = 0.0 if ((n <= -1.3e-105) || !(n <= 7.8e-143)) tmp = Float64(n * Float64(Float64(100.0 * expm1(i)) / i)); else tmp = Float64(0.0 * Float64(n / i)); end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -1.3e-105], N[Not[LessEqual[n, 7.8e-143]], $MachinePrecision]], N[(n * N[(N[(100.0 * N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(0.0 * N[(n / i), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.3 \cdot 10^{-105} \lor \neg \left(n \leq 7.8 \cdot 10^{-143}\right):\\
\;\;\;\;n \cdot \frac{100 \cdot \mathsf{expm1}\left(i\right)}{i}\\
\mathbf{else}:\\
\;\;\;\;0 \cdot \frac{n}{i}\\
\end{array}
\end{array}
if n < -1.2999999999999999e-105 or 7.80000000000000007e-143 < n Initial program 22.0%
add022.0%
*-commutative22.0%
div-inv22.0%
clear-num21.9%
associate-*l*21.9%
add-exp-log21.9%
expm1-define21.9%
log-pow24.6%
log1p-define76.1%
Applied egg-rr76.1%
add076.1%
*-commutative76.1%
associate-*l*76.2%
*-commutative76.2%
associate-*l/74.2%
associate-*r/77.7%
associate-/l*77.8%
Simplified77.8%
Taylor expanded in n around inf 33.9%
associate-*r/34.0%
expm1-define85.6%
Simplified85.6%
if -1.2999999999999999e-105 < n < 7.80000000000000007e-143Initial program 58.1%
associate-*r/58.1%
associate-/r/57.0%
associate-*l/57.0%
associate-/l*56.8%
sub-neg56.8%
distribute-lft-in56.8%
metadata-eval56.8%
metadata-eval56.8%
metadata-eval56.8%
fma-define56.8%
metadata-eval56.8%
Simplified56.8%
fma-undefine56.8%
*-commutative56.8%
Applied egg-rr56.8%
Taylor expanded in i around 0 69.7%
Final simplification82.9%
(FPCore (i n) :precision binary64 (if (<= n -1.3e-105) (* n (/ (* 100.0 (expm1 i)) i)) (if (<= n 1.65e-142) (* 0.0 (/ n i)) (* 100.0 (* n (/ (expm1 i) i))))))
double code(double i, double n) {
double tmp;
if (n <= -1.3e-105) {
tmp = n * ((100.0 * expm1(i)) / i);
} else if (n <= 1.65e-142) {
tmp = 0.0 * (n / i);
} else {
tmp = 100.0 * (n * (expm1(i) / i));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if (n <= -1.3e-105) {
tmp = n * ((100.0 * Math.expm1(i)) / i);
} else if (n <= 1.65e-142) {
tmp = 0.0 * (n / i);
} else {
tmp = 100.0 * (n * (Math.expm1(i) / i));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -1.3e-105: tmp = n * ((100.0 * math.expm1(i)) / i) elif n <= 1.65e-142: tmp = 0.0 * (n / i) else: tmp = 100.0 * (n * (math.expm1(i) / i)) return tmp
function code(i, n) tmp = 0.0 if (n <= -1.3e-105) tmp = Float64(n * Float64(Float64(100.0 * expm1(i)) / i)); elseif (n <= 1.65e-142) tmp = Float64(0.0 * Float64(n / i)); else tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); end return tmp end
code[i_, n_] := If[LessEqual[n, -1.3e-105], N[(n * N[(N[(100.0 * N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.65e-142], N[(0.0 * N[(n / i), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.3 \cdot 10^{-105}:\\
\;\;\;\;n \cdot \frac{100 \cdot \mathsf{expm1}\left(i\right)}{i}\\
\mathbf{elif}\;n \leq 1.65 \cdot 10^{-142}:\\
\;\;\;\;0 \cdot \frac{n}{i}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\end{array}
\end{array}
if n < -1.2999999999999999e-105Initial program 23.3%
add023.3%
*-commutative23.3%
div-inv23.2%
clear-num23.0%
associate-*l*23.0%
add-exp-log23.0%
expm1-define23.0%
log-pow24.0%
log1p-define73.4%
Applied egg-rr73.4%
add073.4%
*-commutative73.4%
associate-*l*73.5%
*-commutative73.5%
associate-*l/69.1%
associate-*r/74.3%
associate-/l*74.3%
Simplified74.3%
Taylor expanded in n around inf 34.1%
associate-*r/34.2%
expm1-define83.3%
Simplified83.3%
if -1.2999999999999999e-105 < n < 1.6499999999999998e-142Initial program 58.1%
associate-*r/58.1%
associate-/r/57.0%
associate-*l/57.0%
associate-/l*56.8%
sub-neg56.8%
distribute-lft-in56.8%
metadata-eval56.8%
metadata-eval56.8%
metadata-eval56.8%
fma-define56.8%
metadata-eval56.8%
Simplified56.8%
fma-undefine56.8%
*-commutative56.8%
Applied egg-rr56.8%
Taylor expanded in i around 0 69.7%
if 1.6499999999999998e-142 < n Initial program 20.8%
Taylor expanded in n around inf 33.8%
*-commutative33.8%
associate-/l*33.8%
expm1-define88.0%
Simplified88.0%
Final simplification82.9%
(FPCore (i n) :precision binary64 (if (<= n -1.45e-102) (* n (+ 100.0 (* i 50.0))) (if (<= n 1.16e-142) (* 0.0 (/ n i)) (* (* n 100.0) (+ 1.0 (* i 0.5))))))
double code(double i, double n) {
double tmp;
if (n <= -1.45e-102) {
tmp = n * (100.0 + (i * 50.0));
} else if (n <= 1.16e-142) {
tmp = 0.0 * (n / i);
} else {
tmp = (n * 100.0) * (1.0 + (i * 0.5));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-1.45d-102)) then
tmp = n * (100.0d0 + (i * 50.0d0))
else if (n <= 1.16d-142) then
tmp = 0.0d0 * (n / i)
else
tmp = (n * 100.0d0) * (1.0d0 + (i * 0.5d0))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -1.45e-102) {
tmp = n * (100.0 + (i * 50.0));
} else if (n <= 1.16e-142) {
tmp = 0.0 * (n / i);
} else {
tmp = (n * 100.0) * (1.0 + (i * 0.5));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -1.45e-102: tmp = n * (100.0 + (i * 50.0)) elif n <= 1.16e-142: tmp = 0.0 * (n / i) else: tmp = (n * 100.0) * (1.0 + (i * 0.5)) return tmp
function code(i, n) tmp = 0.0 if (n <= -1.45e-102) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); elseif (n <= 1.16e-142) tmp = Float64(0.0 * Float64(n / i)); else tmp = Float64(Float64(n * 100.0) * Float64(1.0 + Float64(i * 0.5))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -1.45e-102) tmp = n * (100.0 + (i * 50.0)); elseif (n <= 1.16e-142) tmp = 0.0 * (n / i); else tmp = (n * 100.0) * (1.0 + (i * 0.5)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -1.45e-102], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.16e-142], N[(0.0 * N[(n / i), $MachinePrecision]), $MachinePrecision], N[(N[(n * 100.0), $MachinePrecision] * N[(1.0 + N[(i * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.45 \cdot 10^{-102}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{elif}\;n \leq 1.16 \cdot 10^{-142}:\\
\;\;\;\;0 \cdot \frac{n}{i}\\
\mathbf{else}:\\
\;\;\;\;\left(n \cdot 100\right) \cdot \left(1 + i \cdot 0.5\right)\\
\end{array}
\end{array}
if n < -1.44999999999999993e-102Initial program 23.3%
Taylor expanded in i around 0 55.1%
Taylor expanded in n around inf 55.0%
associate-*r*55.0%
*-commutative55.0%
*-commutative55.0%
Simplified55.0%
Taylor expanded in i around 0 55.0%
associate-*r*55.0%
distribute-rgt-out55.0%
Simplified55.0%
if -1.44999999999999993e-102 < n < 1.16e-142Initial program 58.1%
associate-*r/58.1%
associate-/r/57.0%
associate-*l/57.0%
associate-/l*56.8%
sub-neg56.8%
distribute-lft-in56.8%
metadata-eval56.8%
metadata-eval56.8%
metadata-eval56.8%
fma-define56.8%
metadata-eval56.8%
Simplified56.8%
fma-undefine56.8%
*-commutative56.8%
Applied egg-rr56.8%
Taylor expanded in i around 0 69.7%
if 1.16e-142 < n Initial program 20.8%
Taylor expanded in i around 0 69.7%
Taylor expanded in n around inf 70.1%
associate-*r*70.1%
*-commutative70.1%
*-commutative70.1%
Simplified70.1%
Final simplification63.7%
(FPCore (i n) :precision binary64 (if (<= n -1.3e-105) (* n (+ 100.0 (* i 50.0))) (if (<= n 7.8e-143) (* 0.0 (/ n i)) (+ (* 50.0 (* i n)) (* n 100.0)))))
double code(double i, double n) {
double tmp;
if (n <= -1.3e-105) {
tmp = n * (100.0 + (i * 50.0));
} else if (n <= 7.8e-143) {
tmp = 0.0 * (n / i);
} else {
tmp = (50.0 * (i * n)) + (n * 100.0);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-1.3d-105)) then
tmp = n * (100.0d0 + (i * 50.0d0))
else if (n <= 7.8d-143) then
tmp = 0.0d0 * (n / i)
else
tmp = (50.0d0 * (i * n)) + (n * 100.0d0)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -1.3e-105) {
tmp = n * (100.0 + (i * 50.0));
} else if (n <= 7.8e-143) {
tmp = 0.0 * (n / i);
} else {
tmp = (50.0 * (i * n)) + (n * 100.0);
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -1.3e-105: tmp = n * (100.0 + (i * 50.0)) elif n <= 7.8e-143: tmp = 0.0 * (n / i) else: tmp = (50.0 * (i * n)) + (n * 100.0) return tmp
function code(i, n) tmp = 0.0 if (n <= -1.3e-105) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); elseif (n <= 7.8e-143) tmp = Float64(0.0 * Float64(n / i)); else tmp = Float64(Float64(50.0 * Float64(i * n)) + Float64(n * 100.0)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -1.3e-105) tmp = n * (100.0 + (i * 50.0)); elseif (n <= 7.8e-143) tmp = 0.0 * (n / i); else tmp = (50.0 * (i * n)) + (n * 100.0); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -1.3e-105], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 7.8e-143], N[(0.0 * N[(n / i), $MachinePrecision]), $MachinePrecision], N[(N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision] + N[(n * 100.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.3 \cdot 10^{-105}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{elif}\;n \leq 7.8 \cdot 10^{-143}:\\
\;\;\;\;0 \cdot \frac{n}{i}\\
\mathbf{else}:\\
\;\;\;\;50 \cdot \left(i \cdot n\right) + n \cdot 100\\
\end{array}
\end{array}
if n < -1.2999999999999999e-105Initial program 23.3%
Taylor expanded in i around 0 55.1%
Taylor expanded in n around inf 55.0%
associate-*r*55.0%
*-commutative55.0%
*-commutative55.0%
Simplified55.0%
Taylor expanded in i around 0 55.0%
associate-*r*55.0%
distribute-rgt-out55.0%
Simplified55.0%
if -1.2999999999999999e-105 < n < 7.80000000000000007e-143Initial program 58.1%
associate-*r/58.1%
associate-/r/57.0%
associate-*l/57.0%
associate-/l*56.8%
sub-neg56.8%
distribute-lft-in56.8%
metadata-eval56.8%
metadata-eval56.8%
metadata-eval56.8%
fma-define56.8%
metadata-eval56.8%
Simplified56.8%
fma-undefine56.8%
*-commutative56.8%
Applied egg-rr56.8%
Taylor expanded in i around 0 69.7%
if 7.80000000000000007e-143 < n Initial program 20.8%
Taylor expanded in i around 0 69.7%
Taylor expanded in n around inf 70.1%
associate-*r*70.1%
*-commutative70.1%
*-commutative70.1%
Simplified70.1%
Taylor expanded in i around 0 70.1%
Final simplification63.7%
(FPCore (i n) :precision binary64 (if (<= n -1.35e-105) (* 100.0 (+ n (* (- 0.5 (/ 0.5 n)) (* i n)))) (if (<= n 1.02e-142) (* 0.0 (/ n i)) (+ (* 50.0 (* i n)) (* n 100.0)))))
double code(double i, double n) {
double tmp;
if (n <= -1.35e-105) {
tmp = 100.0 * (n + ((0.5 - (0.5 / n)) * (i * n)));
} else if (n <= 1.02e-142) {
tmp = 0.0 * (n / i);
} else {
tmp = (50.0 * (i * n)) + (n * 100.0);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-1.35d-105)) then
tmp = 100.0d0 * (n + ((0.5d0 - (0.5d0 / n)) * (i * n)))
else if (n <= 1.02d-142) then
tmp = 0.0d0 * (n / i)
else
tmp = (50.0d0 * (i * n)) + (n * 100.0d0)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -1.35e-105) {
tmp = 100.0 * (n + ((0.5 - (0.5 / n)) * (i * n)));
} else if (n <= 1.02e-142) {
tmp = 0.0 * (n / i);
} else {
tmp = (50.0 * (i * n)) + (n * 100.0);
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -1.35e-105: tmp = 100.0 * (n + ((0.5 - (0.5 / n)) * (i * n))) elif n <= 1.02e-142: tmp = 0.0 * (n / i) else: tmp = (50.0 * (i * n)) + (n * 100.0) return tmp
function code(i, n) tmp = 0.0 if (n <= -1.35e-105) tmp = Float64(100.0 * Float64(n + Float64(Float64(0.5 - Float64(0.5 / n)) * Float64(i * n)))); elseif (n <= 1.02e-142) tmp = Float64(0.0 * Float64(n / i)); else tmp = Float64(Float64(50.0 * Float64(i * n)) + Float64(n * 100.0)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -1.35e-105) tmp = 100.0 * (n + ((0.5 - (0.5 / n)) * (i * n))); elseif (n <= 1.02e-142) tmp = 0.0 * (n / i); else tmp = (50.0 * (i * n)) + (n * 100.0); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -1.35e-105], N[(100.0 * N[(n + N[(N[(0.5 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] * N[(i * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.02e-142], N[(0.0 * N[(n / i), $MachinePrecision]), $MachinePrecision], N[(N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision] + N[(n * 100.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.35 \cdot 10^{-105}:\\
\;\;\;\;100 \cdot \left(n + \left(0.5 - \frac{0.5}{n}\right) \cdot \left(i \cdot n\right)\right)\\
\mathbf{elif}\;n \leq 1.02 \cdot 10^{-142}:\\
\;\;\;\;0 \cdot \frac{n}{i}\\
\mathbf{else}:\\
\;\;\;\;50 \cdot \left(i \cdot n\right) + n \cdot 100\\
\end{array}
\end{array}
if n < -1.34999999999999996e-105Initial program 23.3%
Taylor expanded in i around 0 55.1%
associate-*r*55.1%
associate-*r/55.1%
metadata-eval55.1%
Simplified55.1%
if -1.34999999999999996e-105 < n < 1.0200000000000001e-142Initial program 58.1%
associate-*r/58.1%
associate-/r/57.0%
associate-*l/57.0%
associate-/l*56.8%
sub-neg56.8%
distribute-lft-in56.8%
metadata-eval56.8%
metadata-eval56.8%
metadata-eval56.8%
fma-define56.8%
metadata-eval56.8%
Simplified56.8%
fma-undefine56.8%
*-commutative56.8%
Applied egg-rr56.8%
Taylor expanded in i around 0 69.7%
if 1.0200000000000001e-142 < n Initial program 20.8%
Taylor expanded in i around 0 69.7%
Taylor expanded in n around inf 70.1%
associate-*r*70.1%
*-commutative70.1%
*-commutative70.1%
Simplified70.1%
Taylor expanded in i around 0 70.1%
Final simplification63.7%
(FPCore (i n) :precision binary64 (if (<= n -1.3e-105) (+ (* i -50.0) (* 100.0 (* n (+ 1.0 (* i 0.5))))) (if (<= n 7.6e-143) (* 0.0 (/ n i)) (+ (* 50.0 (* i n)) (* n 100.0)))))
double code(double i, double n) {
double tmp;
if (n <= -1.3e-105) {
tmp = (i * -50.0) + (100.0 * (n * (1.0 + (i * 0.5))));
} else if (n <= 7.6e-143) {
tmp = 0.0 * (n / i);
} else {
tmp = (50.0 * (i * n)) + (n * 100.0);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-1.3d-105)) then
tmp = (i * (-50.0d0)) + (100.0d0 * (n * (1.0d0 + (i * 0.5d0))))
else if (n <= 7.6d-143) then
tmp = 0.0d0 * (n / i)
else
tmp = (50.0d0 * (i * n)) + (n * 100.0d0)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -1.3e-105) {
tmp = (i * -50.0) + (100.0 * (n * (1.0 + (i * 0.5))));
} else if (n <= 7.6e-143) {
tmp = 0.0 * (n / i);
} else {
tmp = (50.0 * (i * n)) + (n * 100.0);
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -1.3e-105: tmp = (i * -50.0) + (100.0 * (n * (1.0 + (i * 0.5)))) elif n <= 7.6e-143: tmp = 0.0 * (n / i) else: tmp = (50.0 * (i * n)) + (n * 100.0) return tmp
function code(i, n) tmp = 0.0 if (n <= -1.3e-105) tmp = Float64(Float64(i * -50.0) + Float64(100.0 * Float64(n * Float64(1.0 + Float64(i * 0.5))))); elseif (n <= 7.6e-143) tmp = Float64(0.0 * Float64(n / i)); else tmp = Float64(Float64(50.0 * Float64(i * n)) + Float64(n * 100.0)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -1.3e-105) tmp = (i * -50.0) + (100.0 * (n * (1.0 + (i * 0.5)))); elseif (n <= 7.6e-143) tmp = 0.0 * (n / i); else tmp = (50.0 * (i * n)) + (n * 100.0); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -1.3e-105], N[(N[(i * -50.0), $MachinePrecision] + N[(100.0 * N[(n * N[(1.0 + N[(i * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 7.6e-143], N[(0.0 * N[(n / i), $MachinePrecision]), $MachinePrecision], N[(N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision] + N[(n * 100.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.3 \cdot 10^{-105}:\\
\;\;\;\;i \cdot -50 + 100 \cdot \left(n \cdot \left(1 + i \cdot 0.5\right)\right)\\
\mathbf{elif}\;n \leq 7.6 \cdot 10^{-143}:\\
\;\;\;\;0 \cdot \frac{n}{i}\\
\mathbf{else}:\\
\;\;\;\;50 \cdot \left(i \cdot n\right) + n \cdot 100\\
\end{array}
\end{array}
if n < -1.2999999999999999e-105Initial program 23.3%
associate-*r/23.3%
sub-neg23.3%
distribute-lft-in23.3%
metadata-eval23.3%
metadata-eval23.3%
metadata-eval23.3%
fma-define23.3%
metadata-eval23.3%
Simplified23.3%
Taylor expanded in i around 0 38.0%
distribute-lft-out38.0%
associate-*r/38.0%
metadata-eval38.0%
Simplified38.0%
Taylor expanded in n around 0 55.1%
if -1.2999999999999999e-105 < n < 7.59999999999999962e-143Initial program 58.1%
associate-*r/58.1%
associate-/r/57.0%
associate-*l/57.0%
associate-/l*56.8%
sub-neg56.8%
distribute-lft-in56.8%
metadata-eval56.8%
metadata-eval56.8%
metadata-eval56.8%
fma-define56.8%
metadata-eval56.8%
Simplified56.8%
fma-undefine56.8%
*-commutative56.8%
Applied egg-rr56.8%
Taylor expanded in i around 0 69.7%
if 7.59999999999999962e-143 < n Initial program 20.8%
Taylor expanded in i around 0 69.7%
Taylor expanded in n around inf 70.1%
associate-*r*70.1%
*-commutative70.1%
*-commutative70.1%
Simplified70.1%
Taylor expanded in i around 0 70.1%
Final simplification63.7%
(FPCore (i n) :precision binary64 (if (or (<= n -1.3e-105) (not (<= n 1.26e-142))) (* n (+ 100.0 (* i 50.0))) (* 0.0 (/ n i))))
double code(double i, double n) {
double tmp;
if ((n <= -1.3e-105) || !(n <= 1.26e-142)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 0.0 * (n / i);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-1.3d-105)) .or. (.not. (n <= 1.26d-142))) then
tmp = n * (100.0d0 + (i * 50.0d0))
else
tmp = 0.0d0 * (n / i)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -1.3e-105) || !(n <= 1.26e-142)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 0.0 * (n / i);
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -1.3e-105) or not (n <= 1.26e-142): tmp = n * (100.0 + (i * 50.0)) else: tmp = 0.0 * (n / i) return tmp
function code(i, n) tmp = 0.0 if ((n <= -1.3e-105) || !(n <= 1.26e-142)) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); else tmp = Float64(0.0 * Float64(n / i)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -1.3e-105) || ~((n <= 1.26e-142))) tmp = n * (100.0 + (i * 50.0)); else tmp = 0.0 * (n / i); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -1.3e-105], N[Not[LessEqual[n, 1.26e-142]], $MachinePrecision]], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.0 * N[(n / i), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.3 \cdot 10^{-105} \lor \neg \left(n \leq 1.26 \cdot 10^{-142}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;0 \cdot \frac{n}{i}\\
\end{array}
\end{array}
if n < -1.2999999999999999e-105 or 1.26000000000000007e-142 < n Initial program 22.0%
Taylor expanded in i around 0 62.3%
Taylor expanded in n around inf 62.4%
associate-*r*62.4%
*-commutative62.4%
*-commutative62.4%
Simplified62.4%
Taylor expanded in i around 0 62.4%
associate-*r*62.4%
distribute-rgt-out62.4%
Simplified62.4%
if -1.2999999999999999e-105 < n < 1.26000000000000007e-142Initial program 58.1%
associate-*r/58.1%
associate-/r/57.0%
associate-*l/57.0%
associate-/l*56.8%
sub-neg56.8%
distribute-lft-in56.8%
metadata-eval56.8%
metadata-eval56.8%
metadata-eval56.8%
fma-define56.8%
metadata-eval56.8%
Simplified56.8%
fma-undefine56.8%
*-commutative56.8%
Applied egg-rr56.8%
Taylor expanded in i around 0 69.7%
Final simplification63.7%
(FPCore (i n) :precision binary64 (if (<= i -9e-23) (* 100.0 (/ i (/ i n))) (if (<= i 1.7) (* 100.0 (+ n (* i -0.5))) (* 50.0 (* i n)))))
double code(double i, double n) {
double tmp;
if (i <= -9e-23) {
tmp = 100.0 * (i / (i / n));
} else if (i <= 1.7) {
tmp = 100.0 * (n + (i * -0.5));
} else {
tmp = 50.0 * (i * n);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= (-9d-23)) then
tmp = 100.0d0 * (i / (i / n))
else if (i <= 1.7d0) then
tmp = 100.0d0 * (n + (i * (-0.5d0)))
else
tmp = 50.0d0 * (i * n)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= -9e-23) {
tmp = 100.0 * (i / (i / n));
} else if (i <= 1.7) {
tmp = 100.0 * (n + (i * -0.5));
} else {
tmp = 50.0 * (i * n);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -9e-23: tmp = 100.0 * (i / (i / n)) elif i <= 1.7: tmp = 100.0 * (n + (i * -0.5)) else: tmp = 50.0 * (i * n) return tmp
function code(i, n) tmp = 0.0 if (i <= -9e-23) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (i <= 1.7) tmp = Float64(100.0 * Float64(n + Float64(i * -0.5))); else tmp = Float64(50.0 * Float64(i * n)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -9e-23) tmp = 100.0 * (i / (i / n)); elseif (i <= 1.7) tmp = 100.0 * (n + (i * -0.5)); else tmp = 50.0 * (i * n); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -9e-23], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 1.7], N[(100.0 * N[(n + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -9 \cdot 10^{-23}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;i \leq 1.7:\\
\;\;\;\;100 \cdot \left(n + i \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;50 \cdot \left(i \cdot n\right)\\
\end{array}
\end{array}
if i < -8.9999999999999995e-23Initial program 55.1%
Taylor expanded in i around 0 21.7%
if -8.9999999999999995e-23 < i < 1.69999999999999996Initial program 7.3%
Taylor expanded in i around 0 86.2%
Taylor expanded in n around 0 85.6%
if 1.69999999999999996 < i Initial program 51.5%
Taylor expanded in i around 0 33.7%
Taylor expanded in n around inf 34.2%
associate-*r*34.2%
*-commutative34.2%
*-commutative34.2%
Simplified34.2%
Taylor expanded in i around inf 34.2%
*-commutative34.2%
Simplified34.2%
Final simplification59.4%
(FPCore (i n) :precision binary64 (if (<= i -1.4) (* 100.0 (/ i (/ i n))) (* n (+ 100.0 (* i 50.0)))))
double code(double i, double n) {
double tmp;
if (i <= -1.4) {
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 (i <= (-1.4d0)) 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 (i <= -1.4) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -1.4: tmp = 100.0 * (i / (i / n)) else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) tmp = 0.0 if (i <= -1.4) 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 (i <= -1.4) tmp = 100.0 * (i / (i / n)); else tmp = n * (100.0 + (i * 50.0)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -1.4], 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}\;i \leq -1.4:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if i < -1.3999999999999999Initial program 56.9%
Taylor expanded in i around 0 19.5%
if -1.3999999999999999 < i Initial program 19.2%
Taylor expanded in i around 0 71.9%
Taylor expanded in n around inf 71.6%
associate-*r*71.6%
*-commutative71.6%
*-commutative71.6%
Simplified71.6%
Taylor expanded in i around 0 71.6%
associate-*r*71.6%
distribute-rgt-out71.6%
Simplified71.6%
Final simplification59.4%
(FPCore (i n) :precision binary64 (if (<= i 1060.0) (* n 100.0) (* 50.0 (* i n))))
double code(double i, double n) {
double tmp;
if (i <= 1060.0) {
tmp = n * 100.0;
} else {
tmp = 50.0 * (i * n);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= 1060.0d0) then
tmp = n * 100.0d0
else
tmp = 50.0d0 * (i * n)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= 1060.0) {
tmp = n * 100.0;
} else {
tmp = 50.0 * (i * n);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 1060.0: tmp = n * 100.0 else: tmp = 50.0 * (i * n) return tmp
function code(i, n) tmp = 0.0 if (i <= 1060.0) tmp = Float64(n * 100.0); else tmp = Float64(50.0 * Float64(i * n)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= 1060.0) tmp = n * 100.0; else tmp = 50.0 * (i * n); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, 1060.0], N[(n * 100.0), $MachinePrecision], N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 1060:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;50 \cdot \left(i \cdot n\right)\\
\end{array}
\end{array}
if i < 1060Initial program 22.2%
Taylor expanded in i around 0 60.8%
*-commutative60.8%
Simplified60.8%
if 1060 < i Initial program 52.4%
Taylor expanded in i around 0 34.4%
Taylor expanded in n around inf 34.8%
associate-*r*34.8%
*-commutative34.8%
*-commutative34.8%
Simplified34.8%
Taylor expanded in i around inf 34.8%
*-commutative34.8%
Simplified34.8%
Final simplification55.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 28.1%
Taylor expanded in i around 0 55.3%
Taylor expanded in n around 0 2.7%
*-commutative2.7%
Simplified2.7%
Final simplification2.7%
(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 28.1%
Taylor expanded in i around 0 49.9%
*-commutative49.9%
Simplified49.9%
Final simplification49.9%
(FPCore (i n)
:precision binary64
(let* ((t_0 (+ 1.0 (/ i n))))
(*
100.0
(/
(-
(exp
(*
n
(if (== t_0 1.0)
(/ i n)
(/ (* (/ i n) (log t_0)) (- (+ (/ i n) 1.0) 1.0)))))
1.0)
(/ i n)))))
double code(double i, double n) {
double t_0 = 1.0 + (i / n);
double tmp;
if (t_0 == 1.0) {
tmp = i / n;
} else {
tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0) - 1.0);
}
return 100.0 * ((exp((n * tmp)) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + (i / n)
if (t_0 == 1.0d0) then
tmp = i / n
else
tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0d0) - 1.0d0)
end if
code = 100.0d0 * ((exp((n * tmp)) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
double t_0 = 1.0 + (i / n);
double tmp;
if (t_0 == 1.0) {
tmp = i / n;
} else {
tmp = ((i / n) * Math.log(t_0)) / (((i / n) + 1.0) - 1.0);
}
return 100.0 * ((Math.exp((n * tmp)) - 1.0) / (i / n));
}
def code(i, n): t_0 = 1.0 + (i / n) tmp = 0 if t_0 == 1.0: tmp = i / n else: tmp = ((i / n) * math.log(t_0)) / (((i / n) + 1.0) - 1.0) return 100.0 * ((math.exp((n * tmp)) - 1.0) / (i / n))
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) tmp = 0.0 if (t_0 == 1.0) tmp = Float64(i / n); else tmp = Float64(Float64(Float64(i / n) * log(t_0)) / Float64(Float64(Float64(i / n) + 1.0) - 1.0)); end return Float64(100.0 * Float64(Float64(exp(Float64(n * tmp)) - 1.0) / Float64(i / n))) end
function tmp_2 = code(i, n) t_0 = 1.0 + (i / n); tmp = 0.0; if (t_0 == 1.0) tmp = i / n; else tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0) - 1.0); end tmp_2 = 100.0 * ((exp((n * tmp)) - 1.0) / (i / n)); end
code[i_, n_] := Block[{t$95$0 = N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision]}, N[(100.0 * N[(N[(N[Exp[N[(n * If[Equal[t$95$0, 1.0], N[(i / n), $MachinePrecision], N[(N[(N[(i / n), $MachinePrecision] * N[Log[t$95$0], $MachinePrecision]), $MachinePrecision] / N[(N[(N[(i / n), $MachinePrecision] + 1.0), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{i}{n}\\
100 \cdot \frac{e^{n \cdot \begin{array}{l}
\mathbf{if}\;t\_0 = 1:\\
\;\;\;\;\frac{i}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{i}{n} \cdot \log t\_0}{\left(\frac{i}{n} + 1\right) - 1}\\
\end{array}} - 1}{\frac{i}{n}}
\end{array}
\end{array}
herbie shell --seed 2024046
(FPCore (i n)
:name "Compound Interest"
:precision binary64
:alt
(* 100.0 (/ (- (exp (* n (if (== (+ 1.0 (/ i n)) 1.0) (/ i n) (/ (* (/ i n) (log (+ 1.0 (/ i n)))) (- (+ (/ i n) 1.0) 1.0))))) 1.0) (/ i n)))
(* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))