
(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 21 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)
(/ (+ (* t_0 100.0) -100.0) (/ i n))
(/ 100.0 (+ (* (/ i n) -0.5) (/ 1.0 n)))))))
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 = ((t_0 * 100.0) + -100.0) / (i / n);
} else {
tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n));
}
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 = ((t_0 * 100.0) + -100.0) / (i / n);
} else {
tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n));
}
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 = ((t_0 * 100.0) + -100.0) / (i / n) else: tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n)) 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(Float64(Float64(t_0 * 100.0) + -100.0) / Float64(i / n)); else tmp = Float64(100.0 / Float64(Float64(Float64(i / n) * -0.5) + Float64(1.0 / n))); 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[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(100.0 / N[(N[(N[(i / n), $MachinePrecision] * -0.5), $MachinePrecision] + N[(1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t_1 \leq 0:\\
\;\;\;\;\frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot 100}{\frac{i}{n}}\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;\frac{t_0 \cdot 100 + -100}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;\frac{100}{\frac{i}{n} \cdot -0.5 + \frac{1}{n}}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -0.0Initial program 20.1%
associate-*r/20.2%
*-commutative20.2%
pow-to-exp19.1%
expm1-def29.2%
*-commutative29.2%
log1p-udef98.6%
Applied egg-rr98.6%
if -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 99.7%
associate-*r/99.9%
sub-neg99.9%
distribute-lft-in99.9%
fma-def99.9%
metadata-eval99.9%
metadata-eval99.9%
Simplified99.9%
fma-udef99.9%
*-commutative99.9%
Applied egg-rr99.9%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
Taylor expanded in n around inf 1.9%
*-commutative1.9%
associate-/l*1.9%
expm1-def84.0%
Simplified84.0%
*-commutative84.0%
clear-num83.8%
un-div-inv83.8%
Applied egg-rr83.8%
Taylor expanded in i around 0 99.8%
Final simplification98.9%
(FPCore (i n)
:precision binary64
(let* ((t_0 (/ (+ (pow (+ 1.0 (/ i n)) n) -1.0) (/ i n))))
(if (<= t_0 0.0)
(/ 100.0 (/ (/ i (expm1 i)) n))
(if (<= t_0 INFINITY)
(* t_0 100.0)
(/ 100.0 (+ (* (/ i n) -0.5) (/ 1.0 n)))))))
double code(double i, double n) {
double t_0 = (pow((1.0 + (i / n)), n) + -1.0) / (i / n);
double tmp;
if (t_0 <= 0.0) {
tmp = 100.0 / ((i / expm1(i)) / n);
} else if (t_0 <= ((double) INFINITY)) {
tmp = t_0 * 100.0;
} else {
tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = (Math.pow((1.0 + (i / n)), n) + -1.0) / (i / n);
double tmp;
if (t_0 <= 0.0) {
tmp = 100.0 / ((i / Math.expm1(i)) / n);
} else if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = t_0 * 100.0;
} else {
tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n));
}
return tmp;
}
def code(i, n): t_0 = (math.pow((1.0 + (i / n)), n) + -1.0) / (i / n) tmp = 0 if t_0 <= 0.0: tmp = 100.0 / ((i / math.expm1(i)) / n) elif t_0 <= math.inf: tmp = t_0 * 100.0 else: tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n)) return tmp
function code(i, n) t_0 = Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0) / Float64(i / n)) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(100.0 / Float64(Float64(i / expm1(i)) / n)); elseif (t_0 <= Inf) tmp = Float64(t_0 * 100.0); else tmp = Float64(100.0 / Float64(Float64(Float64(i / n) * -0.5) + Float64(1.0 / n))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(100.0 / N[(N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(t$95$0 * 100.0), $MachinePrecision], N[(100.0 / N[(N[(N[(i / n), $MachinePrecision] * -0.5), $MachinePrecision] + N[(1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}}\\
\mathbf{if}\;t_0 \leq 0:\\
\;\;\;\;\frac{100}{\frac{\frac{i}{\mathsf{expm1}\left(i\right)}}{n}}\\
\mathbf{elif}\;t_0 \leq \infty:\\
\;\;\;\;t_0 \cdot 100\\
\mathbf{else}:\\
\;\;\;\;\frac{100}{\frac{i}{n} \cdot -0.5 + \frac{1}{n}}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -0.0Initial program 20.1%
Taylor expanded in n around inf 38.0%
*-commutative38.0%
associate-/l*38.0%
expm1-def83.3%
Simplified83.3%
*-commutative83.3%
clear-num83.5%
un-div-inv83.5%
Applied egg-rr83.5%
if -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 99.7%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
Taylor expanded in n around inf 1.9%
*-commutative1.9%
associate-/l*1.9%
expm1-def84.0%
Simplified84.0%
*-commutative84.0%
clear-num83.8%
un-div-inv83.8%
Applied egg-rr83.8%
Taylor expanded in i around 0 99.8%
Final simplification87.7%
(FPCore (i n)
:precision binary64
(let* ((t_0 (+ (pow (+ 1.0 (/ i n)) n) -1.0)) (t_1 (/ t_0 (/ i n))))
(if (<= t_1 0.0)
(/ 100.0 (/ (/ i (expm1 i)) n))
(if (<= t_1 INFINITY)
(* (* n 100.0) (/ t_0 i))
(/ 100.0 (+ (* (/ i n) -0.5) (/ 1.0 n)))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n) + -1.0;
double t_1 = t_0 / (i / n);
double tmp;
if (t_1 <= 0.0) {
tmp = 100.0 / ((i / expm1(i)) / n);
} else if (t_1 <= ((double) INFINITY)) {
tmp = (n * 100.0) * (t_0 / i);
} else {
tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n) + -1.0;
double t_1 = t_0 / (i / n);
double tmp;
if (t_1 <= 0.0) {
tmp = 100.0 / ((i / Math.expm1(i)) / n);
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = (n * 100.0) * (t_0 / i);
} else {
tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n));
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) + -1.0 t_1 = t_0 / (i / n) tmp = 0 if t_1 <= 0.0: tmp = 100.0 / ((i / math.expm1(i)) / n) elif t_1 <= math.inf: tmp = (n * 100.0) * (t_0 / i) else: tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n)) return tmp
function code(i, n) t_0 = Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0) t_1 = Float64(t_0 / Float64(i / n)) tmp = 0.0 if (t_1 <= 0.0) tmp = Float64(100.0 / Float64(Float64(i / expm1(i)) / n)); elseif (t_1 <= Inf) tmp = Float64(Float64(n * 100.0) * Float64(t_0 / i)); else tmp = Float64(100.0 / Float64(Float64(Float64(i / n) * -0.5) + Float64(1.0 / n))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[(100.0 / N[(N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(n * 100.0), $MachinePrecision] * N[(t$95$0 / i), $MachinePrecision]), $MachinePrecision], N[(100.0 / N[(N[(N[(i / n), $MachinePrecision] * -0.5), $MachinePrecision] + N[(1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n} + -1\\
t_1 := \frac{t_0}{\frac{i}{n}}\\
\mathbf{if}\;t_1 \leq 0:\\
\;\;\;\;\frac{100}{\frac{\frac{i}{\mathsf{expm1}\left(i\right)}}{n}}\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;\left(n \cdot 100\right) \cdot \frac{t_0}{i}\\
\mathbf{else}:\\
\;\;\;\;\frac{100}{\frac{i}{n} \cdot -0.5 + \frac{1}{n}}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -0.0Initial program 20.1%
Taylor expanded in n around inf 38.0%
*-commutative38.0%
associate-/l*38.0%
expm1-def83.3%
Simplified83.3%
*-commutative83.3%
clear-num83.5%
un-div-inv83.5%
Applied egg-rr83.5%
if -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 99.7%
*-commutative99.7%
associate-/r/99.6%
associate-*l*99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
Taylor expanded in n around inf 1.9%
*-commutative1.9%
associate-/l*1.9%
expm1-def84.0%
Simplified84.0%
*-commutative84.0%
clear-num83.8%
un-div-inv83.8%
Applied egg-rr83.8%
Taylor expanded in i around 0 99.8%
Final simplification87.7%
(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 (expm1 i)) n))
(if (<= t_1 INFINITY)
(/ (+ (* t_0 100.0) -100.0) (/ i n))
(/ 100.0 (+ (* (/ i n) -0.5) (/ 1.0 n)))))))
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 / expm1(i)) / n);
} else if (t_1 <= ((double) INFINITY)) {
tmp = ((t_0 * 100.0) + -100.0) / (i / n);
} else {
tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n));
}
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 / Math.expm1(i)) / n);
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = ((t_0 * 100.0) + -100.0) / (i / n);
} else {
tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n));
}
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 / math.expm1(i)) / n) elif t_1 <= math.inf: tmp = ((t_0 * 100.0) + -100.0) / (i / n) else: tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n)) 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 / expm1(i)) / n)); elseif (t_1 <= Inf) tmp = Float64(Float64(Float64(t_0 * 100.0) + -100.0) / Float64(i / n)); else tmp = Float64(100.0 / Float64(Float64(Float64(i / n) * -0.5) + Float64(1.0 / n))); 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[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(100.0 / N[(N[(N[(i / n), $MachinePrecision] * -0.5), $MachinePrecision] + N[(1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t_1 \leq 0:\\
\;\;\;\;\frac{100}{\frac{\frac{i}{\mathsf{expm1}\left(i\right)}}{n}}\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;\frac{t_0 \cdot 100 + -100}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;\frac{100}{\frac{i}{n} \cdot -0.5 + \frac{1}{n}}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -0.0Initial program 20.1%
Taylor expanded in n around inf 38.0%
*-commutative38.0%
associate-/l*38.0%
expm1-def83.3%
Simplified83.3%
*-commutative83.3%
clear-num83.5%
un-div-inv83.5%
Applied egg-rr83.5%
if -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 99.7%
associate-*r/99.9%
sub-neg99.9%
distribute-lft-in99.9%
fma-def99.9%
metadata-eval99.9%
metadata-eval99.9%
Simplified99.9%
fma-udef99.9%
*-commutative99.9%
Applied egg-rr99.9%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
Taylor expanded in n around inf 1.9%
*-commutative1.9%
associate-/l*1.9%
expm1-def84.0%
Simplified84.0%
*-commutative84.0%
clear-num83.8%
un-div-inv83.8%
Applied egg-rr83.8%
Taylor expanded in i around 0 99.8%
Final simplification87.7%
(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) (/ n i))
(if (<= t_1 INFINITY)
(/ (+ (* t_0 100.0) -100.0) (/ i n))
(/ 100.0 (+ (* (/ i n) -0.5) (/ 1.0 n)))))))
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) * (n / i);
} else if (t_1 <= ((double) INFINITY)) {
tmp = ((t_0 * 100.0) + -100.0) / (i / n);
} else {
tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n));
}
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) * (n / i);
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = ((t_0 * 100.0) + -100.0) / (i / n);
} else {
tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n));
}
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) * (n / i) elif t_1 <= math.inf: tmp = ((t_0 * 100.0) + -100.0) / (i / n) else: tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n)) 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(n / i)); elseif (t_1 <= Inf) tmp = Float64(Float64(Float64(t_0 * 100.0) + -100.0) / Float64(i / n)); else tmp = Float64(100.0 / Float64(Float64(Float64(i / n) * -0.5) + Float64(1.0 / n))); 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[(n / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(100.0 / N[(N[(N[(i / n), $MachinePrecision] * -0.5), $MachinePrecision] + N[(1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t_1 \leq 0:\\
\;\;\;\;\left(\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot 100\right) \cdot \frac{n}{i}\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;\frac{t_0 \cdot 100 + -100}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;\frac{100}{\frac{i}{n} \cdot -0.5 + \frac{1}{n}}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -0.0Initial program 20.1%
associate-*r/20.2%
sub-neg20.2%
distribute-lft-in20.2%
fma-def20.2%
metadata-eval20.2%
metadata-eval20.2%
Simplified20.2%
clear-num20.1%
associate-/r/20.1%
clear-num19.8%
fma-udef19.8%
metadata-eval19.8%
distribute-lft-in19.8%
metadata-eval19.8%
sub-neg19.8%
*-commutative19.8%
pow-to-exp18.7%
expm1-def28.8%
*-commutative28.8%
log1p-udef96.2%
Applied egg-rr96.2%
if -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 99.7%
associate-*r/99.9%
sub-neg99.9%
distribute-lft-in99.9%
fma-def99.9%
metadata-eval99.9%
metadata-eval99.9%
Simplified99.9%
fma-udef99.9%
*-commutative99.9%
Applied egg-rr99.9%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
Taylor expanded in n around inf 1.9%
*-commutative1.9%
associate-/l*1.9%
expm1-def84.0%
Simplified84.0%
*-commutative84.0%
clear-num83.8%
un-div-inv83.8%
Applied egg-rr83.8%
Taylor expanded in i around 0 99.8%
Final simplification97.2%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 0.0)
(* (/ (expm1 (* n (log1p (/ i n)))) i) (* n 100.0))
(if (<= t_1 INFINITY)
(/ (+ (* t_0 100.0) -100.0) (/ i n))
(/ 100.0 (+ (* (/ i n) -0.5) (/ 1.0 n)))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 0.0) {
tmp = (expm1((n * log1p((i / n)))) / i) * (n * 100.0);
} else if (t_1 <= ((double) INFINITY)) {
tmp = ((t_0 * 100.0) + -100.0) / (i / n);
} else {
tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 0.0) {
tmp = (Math.expm1((n * Math.log1p((i / n)))) / i) * (n * 100.0);
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = ((t_0 * 100.0) + -100.0) / (i / n);
} else {
tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n));
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = (t_0 + -1.0) / (i / n) tmp = 0 if t_1 <= 0.0: tmp = (math.expm1((n * math.log1p((i / n)))) / i) * (n * 100.0) elif t_1 <= math.inf: tmp = ((t_0 * 100.0) + -100.0) / (i / n) else: tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n)) return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_1 <= 0.0) tmp = Float64(Float64(expm1(Float64(n * log1p(Float64(i / n)))) / i) * Float64(n * 100.0)); elseif (t_1 <= Inf) tmp = Float64(Float64(Float64(t_0 * 100.0) + -100.0) / Float64(i / n)); else tmp = Float64(100.0 / Float64(Float64(Float64(i / n) * -0.5) + Float64(1.0 / n))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[(N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] / i), $MachinePrecision] * N[(n * 100.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(100.0 / N[(N[(N[(i / n), $MachinePrecision] * -0.5), $MachinePrecision] + N[(1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t_1 \leq 0:\\
\;\;\;\;\frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{i} \cdot \left(n \cdot 100\right)\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;\frac{t_0 \cdot 100 + -100}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;\frac{100}{\frac{i}{n} \cdot -0.5 + \frac{1}{n}}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -0.0Initial program 20.1%
*-commutative20.1%
associate-/r/19.8%
associate-*l*19.8%
sub-neg19.8%
metadata-eval19.8%
Simplified19.8%
expm1-log1p-u18.8%
expm1-udef14.1%
metadata-eval14.1%
sub-neg14.1%
pow-to-exp14.1%
expm1-def17.3%
*-commutative17.3%
log1p-udef75.7%
Applied egg-rr75.7%
expm1-def97.3%
expm1-log1p97.3%
Simplified97.3%
if -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 99.7%
associate-*r/99.9%
sub-neg99.9%
distribute-lft-in99.9%
fma-def99.9%
metadata-eval99.9%
metadata-eval99.9%
Simplified99.9%
fma-udef99.9%
*-commutative99.9%
Applied egg-rr99.9%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
Taylor expanded in n around inf 1.9%
*-commutative1.9%
associate-/l*1.9%
expm1-def84.0%
Simplified84.0%
*-commutative84.0%
clear-num83.8%
un-div-inv83.8%
Applied egg-rr83.8%
Taylor expanded in i around 0 99.8%
Final simplification98.0%
(FPCore (i n) :precision binary64 (if (<= i 9.5e+176) (/ 100.0 (/ (/ i (expm1 i)) n)) (* 100.0 (* (/ n i) (+ -1.0 (pow (/ i n) n))))))
double code(double i, double n) {
double tmp;
if (i <= 9.5e+176) {
tmp = 100.0 / ((i / expm1(i)) / n);
} else {
tmp = 100.0 * ((n / i) * (-1.0 + pow((i / n), n)));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if (i <= 9.5e+176) {
tmp = 100.0 / ((i / Math.expm1(i)) / n);
} else {
tmp = 100.0 * ((n / i) * (-1.0 + Math.pow((i / n), n)));
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 9.5e+176: tmp = 100.0 / ((i / math.expm1(i)) / n) else: tmp = 100.0 * ((n / i) * (-1.0 + math.pow((i / n), n))) return tmp
function code(i, n) tmp = 0.0 if (i <= 9.5e+176) tmp = Float64(100.0 / Float64(Float64(i / expm1(i)) / n)); else tmp = Float64(100.0 * Float64(Float64(n / i) * Float64(-1.0 + (Float64(i / n) ^ n)))); end return tmp end
code[i_, n_] := If[LessEqual[i, 9.5e+176], N[(100.0 / N[(N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(N[(n / i), $MachinePrecision] * N[(-1.0 + N[Power[N[(i / n), $MachinePrecision], n], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 9.5 \cdot 10^{+176}:\\
\;\;\;\;\frac{100}{\frac{\frac{i}{\mathsf{expm1}\left(i\right)}}{n}}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(\frac{n}{i} \cdot \left(-1 + {\left(\frac{i}{n}\right)}^{n}\right)\right)\\
\end{array}
\end{array}
if i < 9.4999999999999995e176Initial program 20.2%
Taylor expanded in n around inf 33.7%
*-commutative33.7%
associate-/l*33.7%
expm1-def85.6%
Simplified85.6%
*-commutative85.6%
clear-num85.7%
un-div-inv85.7%
Applied egg-rr85.7%
if 9.4999999999999995e176 < i Initial program 63.0%
associate-*r/63.2%
*-commutative63.2%
pow-to-exp26.9%
expm1-def36.4%
*-commutative36.4%
log1p-udef40.8%
Applied egg-rr40.8%
Taylor expanded in i around inf 45.0%
associate-/l*45.0%
associate-/r/45.0%
sub-neg45.0%
metadata-eval45.0%
+-commutative45.0%
*-commutative45.0%
exp-prod22.3%
Simplified63.0%
Final simplification83.7%
(FPCore (i n) :precision binary64 (if (<= i 9.5e+176) (/ 100.0 (/ (/ i (expm1 i)) n)) (* (* n 100.0) (/ (+ -1.0 (pow (/ i n) n)) i))))
double code(double i, double n) {
double tmp;
if (i <= 9.5e+176) {
tmp = 100.0 / ((i / expm1(i)) / n);
} else {
tmp = (n * 100.0) * ((-1.0 + pow((i / n), n)) / i);
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if (i <= 9.5e+176) {
tmp = 100.0 / ((i / Math.expm1(i)) / n);
} else {
tmp = (n * 100.0) * ((-1.0 + Math.pow((i / n), n)) / i);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 9.5e+176: tmp = 100.0 / ((i / math.expm1(i)) / n) else: tmp = (n * 100.0) * ((-1.0 + math.pow((i / n), n)) / i) return tmp
function code(i, n) tmp = 0.0 if (i <= 9.5e+176) tmp = Float64(100.0 / Float64(Float64(i / expm1(i)) / n)); else tmp = Float64(Float64(n * 100.0) * Float64(Float64(-1.0 + (Float64(i / n) ^ n)) / i)); end return tmp end
code[i_, n_] := If[LessEqual[i, 9.5e+176], N[(100.0 / N[(N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], N[(N[(n * 100.0), $MachinePrecision] * N[(N[(-1.0 + N[Power[N[(i / n), $MachinePrecision], n], $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 9.5 \cdot 10^{+176}:\\
\;\;\;\;\frac{100}{\frac{\frac{i}{\mathsf{expm1}\left(i\right)}}{n}}\\
\mathbf{else}:\\
\;\;\;\;\left(n \cdot 100\right) \cdot \frac{-1 + {\left(\frac{i}{n}\right)}^{n}}{i}\\
\end{array}
\end{array}
if i < 9.4999999999999995e176Initial program 20.2%
Taylor expanded in n around inf 33.7%
*-commutative33.7%
associate-/l*33.7%
expm1-def85.6%
Simplified85.6%
*-commutative85.6%
clear-num85.7%
un-div-inv85.7%
Applied egg-rr85.7%
if 9.4999999999999995e176 < i Initial program 63.0%
*-commutative63.0%
associate-/r/63.3%
associate-*l*63.5%
sub-neg63.5%
metadata-eval63.5%
Simplified63.5%
Taylor expanded in i around inf 63.4%
Final simplification83.8%
(FPCore (i n) :precision binary64 (if (or (<= i -1.6e-70) (not (<= i 2.7e-27))) (* 100.0 (/ (expm1 i) (/ i n))) (* (* n 100.0) (+ 1.0 (* i (- 0.5 (/ 0.5 n)))))))
double code(double i, double n) {
double tmp;
if ((i <= -1.6e-70) || !(i <= 2.7e-27)) {
tmp = 100.0 * (expm1(i) / (i / n));
} else {
tmp = (n * 100.0) * (1.0 + (i * (0.5 - (0.5 / n))));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((i <= -1.6e-70) || !(i <= 2.7e-27)) {
tmp = 100.0 * (Math.expm1(i) / (i / n));
} else {
tmp = (n * 100.0) * (1.0 + (i * (0.5 - (0.5 / n))));
}
return tmp;
}
def code(i, n): tmp = 0 if (i <= -1.6e-70) or not (i <= 2.7e-27): tmp = 100.0 * (math.expm1(i) / (i / n)) else: tmp = (n * 100.0) * (1.0 + (i * (0.5 - (0.5 / n)))) return tmp
function code(i, n) tmp = 0.0 if ((i <= -1.6e-70) || !(i <= 2.7e-27)) tmp = Float64(100.0 * Float64(expm1(i) / Float64(i / n))); else tmp = Float64(Float64(n * 100.0) * Float64(1.0 + Float64(i * Float64(0.5 - Float64(0.5 / n))))); end return tmp end
code[i_, n_] := If[Or[LessEqual[i, -1.6e-70], N[Not[LessEqual[i, 2.7e-27]], $MachinePrecision]], N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(n * 100.0), $MachinePrecision] * N[(1.0 + N[(i * N[(0.5 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -1.6 \cdot 10^{-70} \lor \neg \left(i \leq 2.7 \cdot 10^{-27}\right):\\
\;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;\left(n \cdot 100\right) \cdot \left(1 + i \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\\
\end{array}
\end{array}
if i < -1.5999999999999999e-70 or 2.69999999999999989e-27 < i Initial program 44.1%
Taylor expanded in n around inf 63.2%
expm1-def67.8%
Simplified67.8%
if -1.5999999999999999e-70 < i < 2.69999999999999989e-27Initial program 4.9%
*-commutative4.9%
associate-/r/5.4%
associate-*l*5.4%
sub-neg5.4%
metadata-eval5.4%
Simplified5.4%
Taylor expanded in i around 0 93.7%
associate-*r/93.7%
metadata-eval93.7%
Simplified93.7%
Final simplification81.1%
(FPCore (i n) :precision binary64 (if (<= i 1e+98) (/ 100.0 (/ (/ i (expm1 i)) n)) (cbrt (* (* n 100.0) (* (* n n) 10000.0)))))
double code(double i, double n) {
double tmp;
if (i <= 1e+98) {
tmp = 100.0 / ((i / expm1(i)) / n);
} else {
tmp = cbrt(((n * 100.0) * ((n * n) * 10000.0)));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if (i <= 1e+98) {
tmp = 100.0 / ((i / Math.expm1(i)) / n);
} else {
tmp = Math.cbrt(((n * 100.0) * ((n * n) * 10000.0)));
}
return tmp;
}
function code(i, n) tmp = 0.0 if (i <= 1e+98) tmp = Float64(100.0 / Float64(Float64(i / expm1(i)) / n)); else tmp = cbrt(Float64(Float64(n * 100.0) * Float64(Float64(n * n) * 10000.0))); end return tmp end
code[i_, n_] := If[LessEqual[i, 1e+98], N[(100.0 / N[(N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], N[Power[N[(N[(n * 100.0), $MachinePrecision] * N[(N[(n * n), $MachinePrecision] * 10000.0), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 10^{+98}:\\
\;\;\;\;\frac{100}{\frac{\frac{i}{\mathsf{expm1}\left(i\right)}}{n}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{\left(n \cdot 100\right) \cdot \left(\left(n \cdot n\right) \cdot 10000\right)}\\
\end{array}
\end{array}
if i < 9.99999999999999998e97Initial program 18.1%
Taylor expanded in n around inf 31.4%
*-commutative31.4%
associate-/l*31.4%
expm1-def87.6%
Simplified87.6%
*-commutative87.6%
clear-num87.7%
un-div-inv87.7%
Applied egg-rr87.7%
if 9.99999999999999998e97 < i Initial program 55.1%
Taylor expanded in n around inf 43.2%
*-commutative43.2%
associate-/l*43.2%
expm1-def43.2%
Simplified43.2%
*-commutative43.2%
clear-num43.2%
un-div-inv43.2%
Applied egg-rr43.2%
Taylor expanded in i around 0 4.5%
associate-/r/4.5%
metadata-eval4.5%
*-commutative4.5%
add-cbrt-cube58.4%
Applied egg-rr58.4%
associate-*l*58.4%
*-commutative58.4%
swap-sqr58.4%
metadata-eval58.4%
Simplified58.4%
Final simplification83.1%
(FPCore (i n) :precision binary64 (* 100.0 (/ n (/ i (expm1 i)))))
double code(double i, double n) {
return 100.0 * (n / (i / expm1(i)));
}
public static double code(double i, double n) {
return 100.0 * (n / (i / Math.expm1(i)));
}
def code(i, n): return 100.0 * (n / (i / math.expm1(i)))
function code(i, n) return Float64(100.0 * Float64(n / Float64(i / expm1(i)))) end
code[i_, n_] := N[(100.0 * N[(n / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}
\end{array}
Initial program 23.9%
Taylor expanded in n around inf 33.2%
*-commutative33.2%
associate-/l*33.2%
expm1-def80.6%
Simplified80.6%
Final simplification80.6%
(FPCore (i n) :precision binary64 (/ 100.0 (/ (/ i (expm1 i)) n)))
double code(double i, double n) {
return 100.0 / ((i / expm1(i)) / n);
}
public static double code(double i, double n) {
return 100.0 / ((i / Math.expm1(i)) / n);
}
def code(i, n): return 100.0 / ((i / math.expm1(i)) / n)
function code(i, n) return Float64(100.0 / Float64(Float64(i / expm1(i)) / n)) end
code[i_, n_] := N[(100.0 / N[(N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{100}{\frac{\frac{i}{\mathsf{expm1}\left(i\right)}}{n}}
\end{array}
Initial program 23.9%
Taylor expanded in n around inf 33.2%
*-commutative33.2%
associate-/l*33.2%
expm1-def80.6%
Simplified80.6%
*-commutative80.6%
clear-num80.8%
un-div-inv80.7%
Applied egg-rr80.7%
Final simplification80.7%
(FPCore (i n) :precision binary64 (if (<= n 3.4e-87) (/ 100.0 (+ (* (/ i n) -0.5) (/ 1.0 n))) (* 100.0 (+ n (* (- 0.5 (/ 0.5 n)) (* i n))))))
double code(double i, double n) {
double tmp;
if (n <= 3.4e-87) {
tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n));
} else {
tmp = 100.0 * (n + ((0.5 - (0.5 / n)) * (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 <= 3.4d-87) then
tmp = 100.0d0 / (((i / n) * (-0.5d0)) + (1.0d0 / n))
else
tmp = 100.0d0 * (n + ((0.5d0 - (0.5d0 / n)) * (i * n)))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= 3.4e-87) {
tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n));
} else {
tmp = 100.0 * (n + ((0.5 - (0.5 / n)) * (i * n)));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= 3.4e-87: tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n)) else: tmp = 100.0 * (n + ((0.5 - (0.5 / n)) * (i * n))) return tmp
function code(i, n) tmp = 0.0 if (n <= 3.4e-87) tmp = Float64(100.0 / Float64(Float64(Float64(i / n) * -0.5) + Float64(1.0 / n))); else tmp = Float64(100.0 * Float64(n + Float64(Float64(0.5 - Float64(0.5 / n)) * Float64(i * n)))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= 3.4e-87) tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n)); else tmp = 100.0 * (n + ((0.5 - (0.5 / n)) * (i * n))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, 3.4e-87], N[(100.0 / N[(N[(N[(i / n), $MachinePrecision] * -0.5), $MachinePrecision] + N[(1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n + N[(N[(0.5 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] * N[(i * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 3.4 \cdot 10^{-87}:\\
\;\;\;\;\frac{100}{\frac{i}{n} \cdot -0.5 + \frac{1}{n}}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n + \left(0.5 - \frac{0.5}{n}\right) \cdot \left(i \cdot n\right)\right)\\
\end{array}
\end{array}
if n < 3.3999999999999999e-87Initial program 27.1%
Taylor expanded in n around inf 30.4%
*-commutative30.4%
associate-/l*30.4%
expm1-def75.1%
Simplified75.1%
*-commutative75.1%
clear-num75.4%
un-div-inv75.3%
Applied egg-rr75.3%
Taylor expanded in i around 0 63.2%
if 3.3999999999999999e-87 < n Initial program 18.0%
Taylor expanded in i around 0 68.9%
associate-*r*68.9%
associate-*r/68.9%
metadata-eval68.9%
Simplified68.9%
Final simplification65.2%
(FPCore (i n) :precision binary64 (if (<= n 3.4e-87) (/ 100.0 (+ (* (/ i n) -0.5) (/ 1.0 n))) (* (* n 100.0) (+ 1.0 (* i (- 0.5 (/ 0.5 n)))))))
double code(double i, double n) {
double tmp;
if (n <= 3.4e-87) {
tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n));
} else {
tmp = (n * 100.0) * (1.0 + (i * (0.5 - (0.5 / n))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= 3.4d-87) then
tmp = 100.0d0 / (((i / n) * (-0.5d0)) + (1.0d0 / n))
else
tmp = (n * 100.0d0) * (1.0d0 + (i * (0.5d0 - (0.5d0 / n))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= 3.4e-87) {
tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n));
} else {
tmp = (n * 100.0) * (1.0 + (i * (0.5 - (0.5 / n))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= 3.4e-87: tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n)) else: tmp = (n * 100.0) * (1.0 + (i * (0.5 - (0.5 / n)))) return tmp
function code(i, n) tmp = 0.0 if (n <= 3.4e-87) tmp = Float64(100.0 / Float64(Float64(Float64(i / n) * -0.5) + Float64(1.0 / n))); else tmp = Float64(Float64(n * 100.0) * Float64(1.0 + Float64(i * Float64(0.5 - Float64(0.5 / n))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= 3.4e-87) tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n)); else tmp = (n * 100.0) * (1.0 + (i * (0.5 - (0.5 / n)))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, 3.4e-87], N[(100.0 / N[(N[(N[(i / n), $MachinePrecision] * -0.5), $MachinePrecision] + N[(1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(n * 100.0), $MachinePrecision] * N[(1.0 + N[(i * N[(0.5 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 3.4 \cdot 10^{-87}:\\
\;\;\;\;\frac{100}{\frac{i}{n} \cdot -0.5 + \frac{1}{n}}\\
\mathbf{else}:\\
\;\;\;\;\left(n \cdot 100\right) \cdot \left(1 + i \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\\
\end{array}
\end{array}
if n < 3.3999999999999999e-87Initial program 27.1%
Taylor expanded in n around inf 30.4%
*-commutative30.4%
associate-/l*30.4%
expm1-def75.1%
Simplified75.1%
*-commutative75.1%
clear-num75.4%
un-div-inv75.3%
Applied egg-rr75.3%
Taylor expanded in i around 0 63.2%
if 3.3999999999999999e-87 < n Initial program 18.0%
*-commutative18.0%
associate-/r/18.4%
associate-*l*18.4%
sub-neg18.4%
metadata-eval18.4%
Simplified18.4%
Taylor expanded in i around 0 68.9%
associate-*r/68.9%
metadata-eval68.9%
Simplified68.9%
Final simplification65.2%
(FPCore (i n) :precision binary64 (if (<= n 1.55e-16) (/ 100.0 (+ (* (/ i n) -0.5) (/ 1.0 n))) (* (* n 100.0) (/ (+ i (* 0.5 (* i i))) i))))
double code(double i, double n) {
double tmp;
if (n <= 1.55e-16) {
tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n));
} else {
tmp = (n * 100.0) * ((i + (0.5 * (i * i))) / 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.55d-16) then
tmp = 100.0d0 / (((i / n) * (-0.5d0)) + (1.0d0 / n))
else
tmp = (n * 100.0d0) * ((i + (0.5d0 * (i * i))) / i)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= 1.55e-16) {
tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n));
} else {
tmp = (n * 100.0) * ((i + (0.5 * (i * i))) / i);
}
return tmp;
}
def code(i, n): tmp = 0 if n <= 1.55e-16: tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n)) else: tmp = (n * 100.0) * ((i + (0.5 * (i * i))) / i) return tmp
function code(i, n) tmp = 0.0 if (n <= 1.55e-16) tmp = Float64(100.0 / Float64(Float64(Float64(i / n) * -0.5) + Float64(1.0 / n))); else tmp = Float64(Float64(n * 100.0) * Float64(Float64(i + Float64(0.5 * Float64(i * i))) / i)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= 1.55e-16) tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n)); else tmp = (n * 100.0) * ((i + (0.5 * (i * i))) / i); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, 1.55e-16], N[(100.0 / N[(N[(N[(i / n), $MachinePrecision] * -0.5), $MachinePrecision] + N[(1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(n * 100.0), $MachinePrecision] * N[(N[(i + N[(0.5 * N[(i * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 1.55 \cdot 10^{-16}:\\
\;\;\;\;\frac{100}{\frac{i}{n} \cdot -0.5 + \frac{1}{n}}\\
\mathbf{else}:\\
\;\;\;\;\left(n \cdot 100\right) \cdot \frac{i + 0.5 \cdot \left(i \cdot i\right)}{i}\\
\end{array}
\end{array}
if n < 1.55e-16Initial program 25.6%
Taylor expanded in n around inf 28.1%
*-commutative28.1%
associate-/l*28.1%
expm1-def73.6%
Simplified73.6%
*-commutative73.6%
clear-num73.9%
un-div-inv73.8%
Applied egg-rr73.8%
Taylor expanded in i around 0 62.8%
if 1.55e-16 < n Initial program 19.8%
*-commutative19.8%
associate-/r/20.2%
associate-*l*20.3%
sub-neg20.3%
metadata-eval20.3%
Simplified20.3%
Taylor expanded in i around 0 21.3%
unpow221.3%
associate-*r/21.3%
metadata-eval21.3%
Simplified21.3%
Taylor expanded in n around inf 72.8%
unpow272.8%
Simplified72.8%
Final simplification65.8%
(FPCore (i n) :precision binary64 (if (<= n 1.8e+104) (/ 100.0 (+ (* (/ i n) -0.5) (/ 1.0 n))) (* n (+ 100.0 (* i 50.0)))))
double code(double i, double n) {
double tmp;
if (n <= 1.8e+104) {
tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n));
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= 1.8d+104) then
tmp = 100.0d0 / (((i / n) * (-0.5d0)) + (1.0d0 / n))
else
tmp = n * (100.0d0 + (i * 50.0d0))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= 1.8e+104) {
tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n));
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= 1.8e+104: tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n)) else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) tmp = 0.0 if (n <= 1.8e+104) tmp = Float64(100.0 / Float64(Float64(Float64(i / n) * -0.5) + Float64(1.0 / n))); else tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= 1.8e+104) tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n)); else tmp = n * (100.0 + (i * 50.0)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, 1.8e+104], N[(100.0 / N[(N[(N[(i / n), $MachinePrecision] * -0.5), $MachinePrecision] + N[(1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 1.8 \cdot 10^{+104}:\\
\;\;\;\;\frac{100}{\frac{i}{n} \cdot -0.5 + \frac{1}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < 1.8e104Initial program 25.1%
Taylor expanded in n around inf 28.3%
*-commutative28.3%
associate-/l*28.3%
expm1-def76.0%
Simplified76.0%
*-commutative76.0%
clear-num76.2%
un-div-inv76.1%
Applied egg-rr76.1%
Taylor expanded in i around 0 63.9%
if 1.8e104 < n Initial program 19.6%
Taylor expanded in n around inf 51.7%
*-commutative51.7%
associate-/l*51.7%
expm1-def98.0%
Simplified98.0%
Taylor expanded in i around 0 69.6%
associate-*r*69.6%
distribute-rgt-out69.6%
Simplified69.6%
Final simplification65.1%
(FPCore (i n) :precision binary64 (if (or (<= n -1e+82) (not (<= n 1.5e-16))) (* n (+ 100.0 (* i 50.0))) (* 100.0 (/ i (/ i n)))))
double code(double i, double n) {
double tmp;
if ((n <= -1e+82) || !(n <= 1.5e-16)) {
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 <= (-1d+82)) .or. (.not. (n <= 1.5d-16))) 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 <= -1e+82) || !(n <= 1.5e-16)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -1e+82) or not (n <= 1.5e-16): 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 <= -1e+82) || !(n <= 1.5e-16)) 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 <= -1e+82) || ~((n <= 1.5e-16))) 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, -1e+82], N[Not[LessEqual[n, 1.5e-16]], $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 \cdot 10^{+82} \lor \neg \left(n \leq 1.5 \cdot 10^{-16}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -9.9999999999999996e81 or 1.49999999999999997e-16 < n Initial program 20.0%
Taylor expanded in n around inf 44.2%
*-commutative44.2%
associate-/l*44.2%
expm1-def94.1%
Simplified94.1%
Taylor expanded in i around 0 64.0%
associate-*r*64.0%
distribute-rgt-out64.0%
Simplified64.0%
if -9.9999999999999996e81 < n < 1.49999999999999997e-16Initial program 28.4%
Taylor expanded in i around 0 65.1%
Final simplification64.5%
(FPCore (i n) :precision binary64 (if (<= i -2.05e-70) (* 100.0 (/ i (/ i n))) (if (<= i 1.2) (* 100.0 (+ n (* i -0.5))) (* n (* i 50.0)))))
double code(double i, double n) {
double tmp;
if (i <= -2.05e-70) {
tmp = 100.0 * (i / (i / n));
} else if (i <= 1.2) {
tmp = 100.0 * (n + (i * -0.5));
} else {
tmp = n * (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 <= (-2.05d-70)) then
tmp = 100.0d0 * (i / (i / n))
else if (i <= 1.2d0) then
tmp = 100.0d0 * (n + (i * (-0.5d0)))
else
tmp = n * (i * 50.0d0)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= -2.05e-70) {
tmp = 100.0 * (i / (i / n));
} else if (i <= 1.2) {
tmp = 100.0 * (n + (i * -0.5));
} else {
tmp = n * (i * 50.0);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -2.05e-70: tmp = 100.0 * (i / (i / n)) elif i <= 1.2: tmp = 100.0 * (n + (i * -0.5)) else: tmp = n * (i * 50.0) return tmp
function code(i, n) tmp = 0.0 if (i <= -2.05e-70) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (i <= 1.2) tmp = Float64(100.0 * Float64(n + Float64(i * -0.5))); else tmp = Float64(n * Float64(i * 50.0)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -2.05e-70) tmp = 100.0 * (i / (i / n)); elseif (i <= 1.2) tmp = 100.0 * (n + (i * -0.5)); else tmp = n * (i * 50.0); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -2.05e-70], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 1.2], N[(100.0 * N[(n + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(i * 50.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -2.05 \cdot 10^{-70}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;i \leq 1.2:\\
\;\;\;\;100 \cdot \left(n + i \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(i \cdot 50\right)\\
\end{array}
\end{array}
if i < -2.04999999999999989e-70Initial program 43.9%
Taylor expanded in i around 0 27.5%
if -2.04999999999999989e-70 < i < 1.19999999999999996Initial program 4.8%
Taylor expanded in i around 0 93.0%
associate-*r*92.7%
associate-*r/92.7%
metadata-eval92.7%
Simplified92.7%
Taylor expanded in n around 0 92.3%
*-commutative92.3%
Simplified92.3%
if 1.19999999999999996 < i Initial program 47.9%
*-commutative47.9%
associate-/r/48.1%
associate-*l*48.2%
sub-neg48.2%
metadata-eval48.2%
Simplified48.2%
Taylor expanded in n around inf 55.0%
expm1-def55.0%
Simplified55.0%
Taylor expanded in i around 0 24.7%
*-commutative24.7%
Simplified24.7%
Taylor expanded in i around inf 24.7%
*-commutative24.7%
*-commutative24.7%
associate-*l*24.7%
Simplified24.7%
Final simplification61.6%
(FPCore (i n) :precision binary64 (if (<= i 2.0) (* n 100.0) (* n (* i 50.0))))
double code(double i, double n) {
double tmp;
if (i <= 2.0) {
tmp = n * 100.0;
} else {
tmp = n * (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 <= 2.0d0) then
tmp = n * 100.0d0
else
tmp = n * (i * 50.0d0)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= 2.0) {
tmp = n * 100.0;
} else {
tmp = n * (i * 50.0);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 2.0: tmp = n * 100.0 else: tmp = n * (i * 50.0) return tmp
function code(i, n) tmp = 0.0 if (i <= 2.0) tmp = Float64(n * 100.0); else tmp = Float64(n * Float64(i * 50.0)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= 2.0) tmp = n * 100.0; else tmp = n * (i * 50.0); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, 2.0], N[(n * 100.0), $MachinePrecision], N[(n * N[(i * 50.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 2:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(i \cdot 50\right)\\
\end{array}
\end{array}
if i < 2Initial program 17.0%
Taylor expanded in i around 0 68.5%
*-commutative68.5%
Simplified68.5%
if 2 < i Initial program 47.9%
*-commutative47.9%
associate-/r/48.1%
associate-*l*48.2%
sub-neg48.2%
metadata-eval48.2%
Simplified48.2%
Taylor expanded in n around inf 55.0%
expm1-def55.0%
Simplified55.0%
Taylor expanded in i around 0 24.7%
*-commutative24.7%
Simplified24.7%
Taylor expanded in i around inf 24.7%
*-commutative24.7%
*-commutative24.7%
associate-*l*24.7%
Simplified24.7%
Final simplification58.8%
(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 23.9%
Taylor expanded in i around 0 59.0%
associate-*r*58.9%
associate-*r/58.9%
metadata-eval58.9%
Simplified58.9%
Taylor expanded in n around 0 3.0%
*-commutative3.0%
Simplified3.0%
Final simplification3.0%
(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 23.9%
Taylor expanded in i around 0 54.3%
*-commutative54.3%
Simplified54.3%
Final simplification54.3%
(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 2023278
(FPCore (i n)
:name "Compound Interest"
:precision binary64
:herbie-target
(* 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))))