
(FPCore (i n) :precision binary64 (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))
double code(double i, double n) {
return 100.0 * ((pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 100.0d0 * ((((1.0d0 + (i / n)) ** n) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
return 100.0 * ((Math.pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
def code(i, n): return 100.0 * ((math.pow((1.0 + (i / n)), n) - 1.0) / (i / n))
function code(i, n) return Float64(100.0 * Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) - 1.0) / Float64(i / n))) end
function tmp = code(i, n) tmp = 100.0 * ((((1.0 + (i / n)) ^ n) - 1.0) / (i / n)); end
code[i_, n_] := N[(100.0 * N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (i n) :precision binary64 (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))
double code(double i, double n) {
return 100.0 * ((pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 100.0d0 * ((((1.0d0 + (i / n)) ** n) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
return 100.0 * ((Math.pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
def code(i, n): return 100.0 * ((math.pow((1.0 + (i / n)), n) - 1.0) / (i / n))
function code(i, n) return Float64(100.0 * Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) - 1.0) / Float64(i / n))) end
function tmp = code(i, n) tmp = 100.0 * ((((1.0 + (i / n)) ^ n) - 1.0) / (i / n)); end
code[i_, n_] := N[(100.0 * N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}
\end{array}
(FPCore (i n) :precision binary64 (if (<= (/ (+ (pow (+ 1.0 (/ i n)) n) -1.0) (/ i n)) INFINITY) (/ (* n 100.0) (/ i (expm1 (* n (log1p (/ i n)))))) (/ (* n 100.0) (+ 1.0 (* i (+ (/ 0.5 n) -0.5))))))
double code(double i, double n) {
double tmp;
if (((pow((1.0 + (i / n)), n) + -1.0) / (i / n)) <= ((double) INFINITY)) {
tmp = (n * 100.0) / (i / expm1((n * log1p((i / n)))));
} else {
tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5)));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if (((Math.pow((1.0 + (i / n)), n) + -1.0) / (i / n)) <= Double.POSITIVE_INFINITY) {
tmp = (n * 100.0) / (i / Math.expm1((n * Math.log1p((i / n)))));
} else {
tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5)));
}
return tmp;
}
def code(i, n): tmp = 0 if ((math.pow((1.0 + (i / n)), n) + -1.0) / (i / n)) <= math.inf: tmp = (n * 100.0) / (i / math.expm1((n * math.log1p((i / n))))) else: tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5))) return tmp
function code(i, n) tmp = 0.0 if (Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0) / Float64(i / n)) <= Inf) tmp = Float64(Float64(n * 100.0) / Float64(i / expm1(Float64(n * log1p(Float64(i / n)))))); else tmp = Float64(Float64(n * 100.0) / Float64(1.0 + Float64(i * Float64(Float64(0.5 / n) + -0.5)))); end return tmp end
code[i_, n_] := If[LessEqual[N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(n * 100.0), $MachinePrecision] / N[(i / N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(n * 100.0), $MachinePrecision] / N[(1.0 + N[(i * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}} \leq \infty:\\
\;\;\;\;\frac{n \cdot 100}{\frac{i}{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{n \cdot 100}{1 + i \cdot \left(\frac{0.5}{n} + -0.5\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 30.2%
associate-*r/30.2%
sub-neg30.2%
distribute-rgt-in30.2%
metadata-eval30.2%
metadata-eval30.2%
Simplified30.2%
metadata-eval30.2%
metadata-eval30.2%
distribute-rgt-in30.2%
sub-neg30.2%
associate-*r/30.2%
*-commutative30.2%
associate-/r/30.2%
associate-*l*30.2%
add-exp-log30.2%
expm1-define30.2%
log-pow36.4%
log1p-define96.1%
Applied egg-rr96.1%
*-commutative96.1%
expm1-undefine42.6%
*-commutative42.6%
log1p-undefine26.9%
+-commutative26.9%
pow-to-exp30.2%
clear-num30.2%
un-div-inv30.2%
pow-to-exp26.9%
+-commutative26.9%
log1p-undefine42.6%
*-commutative42.6%
expm1-undefine96.1%
Applied egg-rr96.1%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) Initial program 0.0%
associate-*r/0.0%
sub-neg0.0%
distribute-rgt-in0.0%
metadata-eval0.0%
metadata-eval0.0%
Simplified0.0%
metadata-eval0.0%
metadata-eval0.0%
distribute-rgt-in0.0%
sub-neg0.0%
associate-*r/0.0%
*-commutative0.0%
associate-/r/1.8%
associate-*l*1.8%
add-exp-log1.8%
expm1-define1.8%
log-pow1.8%
log1p-define1.8%
Applied egg-rr1.8%
*-commutative1.8%
expm1-undefine1.8%
*-commutative1.8%
log1p-undefine1.8%
+-commutative1.8%
pow-to-exp1.8%
clear-num1.8%
un-div-inv1.8%
pow-to-exp1.8%
+-commutative1.8%
log1p-undefine1.8%
*-commutative1.8%
expm1-undefine1.8%
Applied egg-rr1.8%
Taylor expanded in i around 0 99.9%
sub-neg99.9%
associate-*r/99.9%
metadata-eval99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification96.8%
(FPCore (i n) :precision binary64 (if (<= (/ (+ (pow (+ 1.0 (/ i n)) n) -1.0) (/ i n)) INFINITY) (* n (* 100.0 (/ (expm1 (* n (log1p (/ i n)))) i))) (/ (* n 100.0) (+ 1.0 (* i (+ (/ 0.5 n) -0.5))))))
double code(double i, double n) {
double tmp;
if (((pow((1.0 + (i / n)), n) + -1.0) / (i / n)) <= ((double) INFINITY)) {
tmp = n * (100.0 * (expm1((n * log1p((i / n)))) / i));
} else {
tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5)));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if (((Math.pow((1.0 + (i / n)), n) + -1.0) / (i / n)) <= Double.POSITIVE_INFINITY) {
tmp = n * (100.0 * (Math.expm1((n * Math.log1p((i / n)))) / i));
} else {
tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5)));
}
return tmp;
}
def code(i, n): tmp = 0 if ((math.pow((1.0 + (i / n)), n) + -1.0) / (i / n)) <= math.inf: tmp = n * (100.0 * (math.expm1((n * math.log1p((i / n)))) / i)) else: tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5))) return tmp
function code(i, n) tmp = 0.0 if (Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0) / Float64(i / n)) <= Inf) tmp = Float64(n * Float64(100.0 * Float64(expm1(Float64(n * log1p(Float64(i / n)))) / i))); else tmp = Float64(Float64(n * 100.0) / Float64(1.0 + Float64(i * Float64(Float64(0.5 / n) + -0.5)))); end return tmp end
code[i_, n_] := If[LessEqual[N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], Infinity], N[(n * N[(100.0 * N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(n * 100.0), $MachinePrecision] / N[(1.0 + N[(i * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}} \leq \infty:\\
\;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{n \cdot 100}{1 + i \cdot \left(\frac{0.5}{n} + -0.5\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 30.2%
associate-*r/30.2%
sub-neg30.2%
distribute-rgt-in30.2%
metadata-eval30.2%
metadata-eval30.2%
Simplified30.2%
metadata-eval30.2%
metadata-eval30.2%
distribute-rgt-in30.2%
sub-neg30.2%
associate-*r/30.2%
associate-/r/30.2%
associate-*r*30.2%
add-exp-log30.2%
expm1-define30.2%
log-pow36.4%
log1p-define96.1%
Applied egg-rr96.1%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) Initial program 0.0%
associate-*r/0.0%
sub-neg0.0%
distribute-rgt-in0.0%
metadata-eval0.0%
metadata-eval0.0%
Simplified0.0%
metadata-eval0.0%
metadata-eval0.0%
distribute-rgt-in0.0%
sub-neg0.0%
associate-*r/0.0%
*-commutative0.0%
associate-/r/1.8%
associate-*l*1.8%
add-exp-log1.8%
expm1-define1.8%
log-pow1.8%
log1p-define1.8%
Applied egg-rr1.8%
*-commutative1.8%
expm1-undefine1.8%
*-commutative1.8%
log1p-undefine1.8%
+-commutative1.8%
pow-to-exp1.8%
clear-num1.8%
un-div-inv1.8%
pow-to-exp1.8%
+-commutative1.8%
log1p-undefine1.8%
*-commutative1.8%
expm1-undefine1.8%
Applied egg-rr1.8%
Taylor expanded in i around 0 99.9%
sub-neg99.9%
associate-*r/99.9%
metadata-eval99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification96.7%
(FPCore (i n) :precision binary64 (if (<= (/ (+ (pow (+ 1.0 (/ i n)) n) -1.0) (/ i n)) INFINITY) (* n (/ (* 100.0 (expm1 (* n (log1p (/ i n))))) i)) (/ (* n 100.0) (+ 1.0 (* i (+ (/ 0.5 n) -0.5))))))
double code(double i, double n) {
double tmp;
if (((pow((1.0 + (i / n)), n) + -1.0) / (i / n)) <= ((double) INFINITY)) {
tmp = n * ((100.0 * expm1((n * log1p((i / n))))) / i);
} else {
tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5)));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if (((Math.pow((1.0 + (i / n)), n) + -1.0) / (i / n)) <= Double.POSITIVE_INFINITY) {
tmp = n * ((100.0 * Math.expm1((n * Math.log1p((i / n))))) / i);
} else {
tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5)));
}
return tmp;
}
def code(i, n): tmp = 0 if ((math.pow((1.0 + (i / n)), n) + -1.0) / (i / n)) <= math.inf: tmp = n * ((100.0 * math.expm1((n * math.log1p((i / n))))) / i) else: tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5))) return tmp
function code(i, n) tmp = 0.0 if (Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0) / Float64(i / n)) <= Inf) tmp = Float64(n * Float64(Float64(100.0 * expm1(Float64(n * log1p(Float64(i / n))))) / i)); else tmp = Float64(Float64(n * 100.0) / Float64(1.0 + Float64(i * Float64(Float64(0.5 / n) + -0.5)))); end return tmp end
code[i_, n_] := If[LessEqual[N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], Infinity], N[(n * N[(N[(100.0 * N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(N[(n * 100.0), $MachinePrecision] / N[(1.0 + N[(i * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}} \leq \infty:\\
\;\;\;\;n \cdot \frac{100 \cdot \mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{i}\\
\mathbf{else}:\\
\;\;\;\;\frac{n \cdot 100}{1 + i \cdot \left(\frac{0.5}{n} + -0.5\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 30.2%
associate-/r/30.2%
associate-*r*30.2%
*-commutative30.2%
associate-*r/30.2%
sub-neg30.2%
distribute-lft-in30.2%
metadata-eval30.2%
metadata-eval30.2%
metadata-eval30.2%
fma-define30.2%
metadata-eval30.2%
Simplified30.2%
fma-undefine30.2%
metadata-eval30.2%
metadata-eval30.2%
distribute-lft-in30.2%
sub-neg30.2%
*-commutative30.2%
add-exp-log30.2%
expm1-define30.2%
log-pow36.4%
log1p-define96.1%
Applied egg-rr96.1%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) Initial program 0.0%
associate-*r/0.0%
sub-neg0.0%
distribute-rgt-in0.0%
metadata-eval0.0%
metadata-eval0.0%
Simplified0.0%
metadata-eval0.0%
metadata-eval0.0%
distribute-rgt-in0.0%
sub-neg0.0%
associate-*r/0.0%
*-commutative0.0%
associate-/r/1.8%
associate-*l*1.8%
add-exp-log1.8%
expm1-define1.8%
log-pow1.8%
log1p-define1.8%
Applied egg-rr1.8%
*-commutative1.8%
expm1-undefine1.8%
*-commutative1.8%
log1p-undefine1.8%
+-commutative1.8%
pow-to-exp1.8%
clear-num1.8%
un-div-inv1.8%
pow-to-exp1.8%
+-commutative1.8%
log1p-undefine1.8%
*-commutative1.8%
expm1-undefine1.8%
Applied egg-rr1.8%
Taylor expanded in i around 0 99.9%
sub-neg99.9%
associate-*r/99.9%
metadata-eval99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification96.7%
(FPCore (i n) :precision binary64 (if (<= (/ (+ (pow (+ 1.0 (/ i n)) n) -1.0) (/ i n)) INFINITY) (* n (/ (expm1 (* n (log1p (/ i n)))) (* i 0.01))) (/ (* n 100.0) (+ 1.0 (* i (+ (/ 0.5 n) -0.5))))))
double code(double i, double n) {
double tmp;
if (((pow((1.0 + (i / n)), n) + -1.0) / (i / n)) <= ((double) INFINITY)) {
tmp = n * (expm1((n * log1p((i / n)))) / (i * 0.01));
} else {
tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5)));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if (((Math.pow((1.0 + (i / n)), n) + -1.0) / (i / n)) <= Double.POSITIVE_INFINITY) {
tmp = n * (Math.expm1((n * Math.log1p((i / n)))) / (i * 0.01));
} else {
tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5)));
}
return tmp;
}
def code(i, n): tmp = 0 if ((math.pow((1.0 + (i / n)), n) + -1.0) / (i / n)) <= math.inf: tmp = n * (math.expm1((n * math.log1p((i / n)))) / (i * 0.01)) else: tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5))) return tmp
function code(i, n) tmp = 0.0 if (Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0) / Float64(i / n)) <= Inf) tmp = Float64(n * Float64(expm1(Float64(n * log1p(Float64(i / n)))) / Float64(i * 0.01))); else tmp = Float64(Float64(n * 100.0) / Float64(1.0 + Float64(i * Float64(Float64(0.5 / n) + -0.5)))); end return tmp end
code[i_, n_] := If[LessEqual[N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], Infinity], N[(n * N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] / N[(i * 0.01), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(n * 100.0), $MachinePrecision] / N[(1.0 + N[(i * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}} \leq \infty:\\
\;\;\;\;n \cdot \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{i \cdot 0.01}\\
\mathbf{else}:\\
\;\;\;\;\frac{n \cdot 100}{1 + i \cdot \left(\frac{0.5}{n} + -0.5\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 30.2%
clear-num29.9%
un-div-inv29.9%
associate-/l/29.9%
add-exp-log29.9%
expm1-define29.9%
log-pow32.7%
log1p-define84.8%
Applied egg-rr84.8%
associate-/r/85.4%
*-commutative85.4%
Simplified85.4%
*-commutative85.4%
clear-num85.3%
un-div-inv85.3%
div-inv85.4%
metadata-eval85.4%
Applied egg-rr85.4%
associate-/l*96.0%
Simplified96.0%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) Initial program 0.0%
associate-*r/0.0%
sub-neg0.0%
distribute-rgt-in0.0%
metadata-eval0.0%
metadata-eval0.0%
Simplified0.0%
metadata-eval0.0%
metadata-eval0.0%
distribute-rgt-in0.0%
sub-neg0.0%
associate-*r/0.0%
*-commutative0.0%
associate-/r/1.8%
associate-*l*1.8%
add-exp-log1.8%
expm1-define1.8%
log-pow1.8%
log1p-define1.8%
Applied egg-rr1.8%
*-commutative1.8%
expm1-undefine1.8%
*-commutative1.8%
log1p-undefine1.8%
+-commutative1.8%
pow-to-exp1.8%
clear-num1.8%
un-div-inv1.8%
pow-to-exp1.8%
+-commutative1.8%
log1p-undefine1.8%
*-commutative1.8%
expm1-undefine1.8%
Applied egg-rr1.8%
Taylor expanded in i around 0 99.9%
sub-neg99.9%
associate-*r/99.9%
metadata-eval99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification96.7%
(FPCore (i n) :precision binary64 (if (or (<= n -7.2e+52) (not (<= n 0.0004))) (* n (* 100.0 (/ (expm1 i) i))) (/ (* n 100.0) (+ 1.0 (* i (+ (/ 0.5 n) -0.5))))))
double code(double i, double n) {
double tmp;
if ((n <= -7.2e+52) || !(n <= 0.0004)) {
tmp = n * (100.0 * (expm1(i) / i));
} else {
tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5)));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((n <= -7.2e+52) || !(n <= 0.0004)) {
tmp = n * (100.0 * (Math.expm1(i) / i));
} else {
tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5)));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -7.2e+52) or not (n <= 0.0004): tmp = n * (100.0 * (math.expm1(i) / i)) else: tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5))) return tmp
function code(i, n) tmp = 0.0 if ((n <= -7.2e+52) || !(n <= 0.0004)) tmp = Float64(n * Float64(100.0 * Float64(expm1(i) / i))); else tmp = Float64(Float64(n * 100.0) / Float64(1.0 + Float64(i * Float64(Float64(0.5 / n) + -0.5)))); end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -7.2e+52], N[Not[LessEqual[n, 0.0004]], $MachinePrecision]], N[(n * N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(n * 100.0), $MachinePrecision] / N[(1.0 + N[(i * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -7.2 \cdot 10^{+52} \lor \neg \left(n \leq 0.0004\right):\\
\;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{n \cdot 100}{1 + i \cdot \left(\frac{0.5}{n} + -0.5\right)}\\
\end{array}
\end{array}
if n < -7.2e52 or 4.00000000000000019e-4 < n Initial program 24.4%
associate-/r/24.8%
associate-*r*24.8%
*-commutative24.8%
associate-*r/24.8%
sub-neg24.8%
distribute-lft-in24.8%
metadata-eval24.8%
metadata-eval24.8%
metadata-eval24.8%
fma-define24.8%
metadata-eval24.8%
Simplified24.8%
Taylor expanded in n around inf 45.9%
sub-neg45.9%
metadata-eval45.9%
metadata-eval45.9%
distribute-lft-in46.0%
metadata-eval46.0%
sub-neg46.0%
associate-*r/46.0%
*-commutative46.0%
expm1-define97.0%
Simplified97.0%
if -7.2e52 < n < 4.00000000000000019e-4Initial program 26.2%
associate-*r/26.2%
sub-neg26.2%
distribute-rgt-in26.2%
metadata-eval26.2%
metadata-eval26.2%
Simplified26.2%
metadata-eval26.2%
metadata-eval26.2%
distribute-rgt-in26.2%
sub-neg26.2%
associate-*r/26.2%
*-commutative26.2%
associate-/r/26.4%
associate-*l*26.4%
add-exp-log26.4%
expm1-define26.4%
log-pow41.0%
log1p-define86.3%
Applied egg-rr86.3%
*-commutative86.3%
expm1-undefine24.1%
*-commutative24.1%
log1p-undefine23.8%
+-commutative23.8%
pow-to-exp26.4%
clear-num26.4%
un-div-inv26.4%
pow-to-exp23.8%
+-commutative23.8%
log1p-undefine24.1%
*-commutative24.1%
expm1-undefine86.4%
Applied egg-rr86.4%
Taylor expanded in i around 0 82.0%
sub-neg82.0%
associate-*r/82.0%
metadata-eval82.0%
metadata-eval82.0%
Simplified82.0%
Final simplification90.1%
(FPCore (i n)
:precision binary64
(if (<= n -2e+229)
(+ (* n 100.0) (* i (+ (* 16.666666666666668 (* i n)) (* n 50.0))))
(if (<= n 0.0004)
(/ (* n 100.0) (+ 1.0 (* i (+ (/ 0.5 n) -0.5))))
(+
(* n 100.0)
(*
i
(+
(* n 50.0)
(* i (+ (* (* i n) 4.166666666666667) (* n 16.666666666666668)))))))))
double code(double i, double n) {
double tmp;
if (n <= -2e+229) {
tmp = (n * 100.0) + (i * ((16.666666666666668 * (i * n)) + (n * 50.0)));
} else if (n <= 0.0004) {
tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5)));
} else {
tmp = (n * 100.0) + (i * ((n * 50.0) + (i * (((i * n) * 4.166666666666667) + (n * 16.666666666666668)))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-2d+229)) then
tmp = (n * 100.0d0) + (i * ((16.666666666666668d0 * (i * n)) + (n * 50.0d0)))
else if (n <= 0.0004d0) then
tmp = (n * 100.0d0) / (1.0d0 + (i * ((0.5d0 / n) + (-0.5d0))))
else
tmp = (n * 100.0d0) + (i * ((n * 50.0d0) + (i * (((i * n) * 4.166666666666667d0) + (n * 16.666666666666668d0)))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -2e+229) {
tmp = (n * 100.0) + (i * ((16.666666666666668 * (i * n)) + (n * 50.0)));
} else if (n <= 0.0004) {
tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5)));
} else {
tmp = (n * 100.0) + (i * ((n * 50.0) + (i * (((i * n) * 4.166666666666667) + (n * 16.666666666666668)))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -2e+229: tmp = (n * 100.0) + (i * ((16.666666666666668 * (i * n)) + (n * 50.0))) elif n <= 0.0004: tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5))) else: tmp = (n * 100.0) + (i * ((n * 50.0) + (i * (((i * n) * 4.166666666666667) + (n * 16.666666666666668))))) return tmp
function code(i, n) tmp = 0.0 if (n <= -2e+229) tmp = Float64(Float64(n * 100.0) + Float64(i * Float64(Float64(16.666666666666668 * Float64(i * n)) + Float64(n * 50.0)))); elseif (n <= 0.0004) tmp = Float64(Float64(n * 100.0) / Float64(1.0 + Float64(i * Float64(Float64(0.5 / n) + -0.5)))); else tmp = Float64(Float64(n * 100.0) + Float64(i * Float64(Float64(n * 50.0) + Float64(i * Float64(Float64(Float64(i * n) * 4.166666666666667) + Float64(n * 16.666666666666668)))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -2e+229) tmp = (n * 100.0) + (i * ((16.666666666666668 * (i * n)) + (n * 50.0))); elseif (n <= 0.0004) tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5))); else tmp = (n * 100.0) + (i * ((n * 50.0) + (i * (((i * n) * 4.166666666666667) + (n * 16.666666666666668))))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -2e+229], N[(N[(n * 100.0), $MachinePrecision] + N[(i * N[(N[(16.666666666666668 * N[(i * n), $MachinePrecision]), $MachinePrecision] + N[(n * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 0.0004], N[(N[(n * 100.0), $MachinePrecision] / N[(1.0 + N[(i * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(n * 100.0), $MachinePrecision] + N[(i * N[(N[(n * 50.0), $MachinePrecision] + N[(i * N[(N[(N[(i * n), $MachinePrecision] * 4.166666666666667), $MachinePrecision] + N[(n * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2 \cdot 10^{+229}:\\
\;\;\;\;n \cdot 100 + i \cdot \left(16.666666666666668 \cdot \left(i \cdot n\right) + n \cdot 50\right)\\
\mathbf{elif}\;n \leq 0.0004:\\
\;\;\;\;\frac{n \cdot 100}{1 + i \cdot \left(\frac{0.5}{n} + -0.5\right)}\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100 + i \cdot \left(n \cdot 50 + i \cdot \left(\left(i \cdot n\right) \cdot 4.166666666666667 + n \cdot 16.666666666666668\right)\right)\\
\end{array}
\end{array}
if n < -2e229Initial program 21.5%
clear-num21.5%
un-div-inv21.5%
associate-/l/22.3%
add-exp-log22.3%
expm1-define22.3%
log-pow22.3%
log1p-define53.2%
Applied egg-rr53.2%
associate-/r/53.3%
*-commutative53.3%
Simplified53.3%
Taylor expanded in n around inf 99.4%
Taylor expanded in i around 0 79.3%
if -2e229 < n < 4.00000000000000019e-4Initial program 26.2%
associate-*r/26.2%
sub-neg26.2%
distribute-rgt-in26.2%
metadata-eval26.2%
metadata-eval26.2%
Simplified26.2%
metadata-eval26.2%
metadata-eval26.2%
distribute-rgt-in26.2%
sub-neg26.2%
associate-*r/26.2%
*-commutative26.2%
associate-/r/26.4%
associate-*l*26.5%
add-exp-log26.5%
expm1-define26.5%
log-pow36.8%
log1p-define85.3%
Applied egg-rr85.3%
*-commutative85.3%
expm1-undefine28.4%
*-commutative28.4%
log1p-undefine23.9%
+-commutative23.9%
pow-to-exp26.5%
clear-num26.5%
un-div-inv26.4%
pow-to-exp23.9%
+-commutative23.9%
log1p-undefine28.5%
*-commutative28.5%
expm1-undefine85.3%
Applied egg-rr85.3%
Taylor expanded in i around 0 77.7%
sub-neg77.7%
associate-*r/77.7%
metadata-eval77.7%
metadata-eval77.7%
Simplified77.7%
if 4.00000000000000019e-4 < n Initial program 24.1%
clear-num24.1%
un-div-inv24.1%
associate-/l/24.5%
add-exp-log24.5%
expm1-define24.5%
log-pow20.7%
log1p-define77.8%
Applied egg-rr77.8%
associate-/r/77.8%
*-commutative77.8%
Simplified77.8%
Taylor expanded in n around inf 95.9%
Taylor expanded in i around 0 84.7%
Final simplification80.0%
(FPCore (i n)
:precision binary64
(if (<= n -2.5e+230)
(+ (* n 100.0) (* i (+ (* 16.666666666666668 (* i n)) (* n 50.0))))
(if (<= n 0.0004)
(/ (* n 100.0) (+ 1.0 (* i (+ (/ 0.5 n) -0.5))))
(*
100.0
(*
n
(+
1.0
(*
i
(+
0.5
(* i (+ 0.16666666666666666 (* i 0.041666666666666664)))))))))))
double code(double i, double n) {
double tmp;
if (n <= -2.5e+230) {
tmp = (n * 100.0) + (i * ((16.666666666666668 * (i * n)) + (n * 50.0)));
} else if (n <= 0.0004) {
tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5)));
} else {
tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * (0.16666666666666666 + (i * 0.041666666666666664)))))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-2.5d+230)) then
tmp = (n * 100.0d0) + (i * ((16.666666666666668d0 * (i * n)) + (n * 50.0d0)))
else if (n <= 0.0004d0) then
tmp = (n * 100.0d0) / (1.0d0 + (i * ((0.5d0 / n) + (-0.5d0))))
else
tmp = 100.0d0 * (n * (1.0d0 + (i * (0.5d0 + (i * (0.16666666666666666d0 + (i * 0.041666666666666664d0)))))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -2.5e+230) {
tmp = (n * 100.0) + (i * ((16.666666666666668 * (i * n)) + (n * 50.0)));
} else if (n <= 0.0004) {
tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5)));
} else {
tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * (0.16666666666666666 + (i * 0.041666666666666664)))))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -2.5e+230: tmp = (n * 100.0) + (i * ((16.666666666666668 * (i * n)) + (n * 50.0))) elif n <= 0.0004: tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5))) else: tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * (0.16666666666666666 + (i * 0.041666666666666664))))))) return tmp
function code(i, n) tmp = 0.0 if (n <= -2.5e+230) tmp = Float64(Float64(n * 100.0) + Float64(i * Float64(Float64(16.666666666666668 * Float64(i * n)) + Float64(n * 50.0)))); elseif (n <= 0.0004) tmp = Float64(Float64(n * 100.0) / Float64(1.0 + Float64(i * Float64(Float64(0.5 / n) + -0.5)))); else tmp = Float64(100.0 * Float64(n * Float64(1.0 + Float64(i * Float64(0.5 + Float64(i * Float64(0.16666666666666666 + Float64(i * 0.041666666666666664)))))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -2.5e+230) tmp = (n * 100.0) + (i * ((16.666666666666668 * (i * n)) + (n * 50.0))); elseif (n <= 0.0004) tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5))); else tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * (0.16666666666666666 + (i * 0.041666666666666664))))))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -2.5e+230], N[(N[(n * 100.0), $MachinePrecision] + N[(i * N[(N[(16.666666666666668 * N[(i * n), $MachinePrecision]), $MachinePrecision] + N[(n * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 0.0004], N[(N[(n * 100.0), $MachinePrecision] / N[(1.0 + N[(i * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n * N[(1.0 + N[(i * N[(0.5 + N[(i * N[(0.16666666666666666 + N[(i * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.5 \cdot 10^{+230}:\\
\;\;\;\;n \cdot 100 + i \cdot \left(16.666666666666668 \cdot \left(i \cdot n\right) + n \cdot 50\right)\\
\mathbf{elif}\;n \leq 0.0004:\\
\;\;\;\;\frac{n \cdot 100}{1 + i \cdot \left(\frac{0.5}{n} + -0.5\right)}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n \cdot \left(1 + i \cdot \left(0.5 + i \cdot \left(0.16666666666666666 + i \cdot 0.041666666666666664\right)\right)\right)\right)\\
\end{array}
\end{array}
if n < -2.5000000000000001e230Initial program 21.5%
clear-num21.5%
un-div-inv21.5%
associate-/l/22.3%
add-exp-log22.3%
expm1-define22.3%
log-pow22.3%
log1p-define53.2%
Applied egg-rr53.2%
associate-/r/53.3%
*-commutative53.3%
Simplified53.3%
Taylor expanded in n around inf 99.4%
Taylor expanded in i around 0 79.3%
if -2.5000000000000001e230 < n < 4.00000000000000019e-4Initial program 26.2%
associate-*r/26.2%
sub-neg26.2%
distribute-rgt-in26.2%
metadata-eval26.2%
metadata-eval26.2%
Simplified26.2%
metadata-eval26.2%
metadata-eval26.2%
distribute-rgt-in26.2%
sub-neg26.2%
associate-*r/26.2%
*-commutative26.2%
associate-/r/26.4%
associate-*l*26.5%
add-exp-log26.5%
expm1-define26.5%
log-pow36.8%
log1p-define85.3%
Applied egg-rr85.3%
*-commutative85.3%
expm1-undefine28.4%
*-commutative28.4%
log1p-undefine23.9%
+-commutative23.9%
pow-to-exp26.5%
clear-num26.5%
un-div-inv26.4%
pow-to-exp23.9%
+-commutative23.9%
log1p-undefine28.5%
*-commutative28.5%
expm1-undefine85.3%
Applied egg-rr85.3%
Taylor expanded in i around 0 77.7%
sub-neg77.7%
associate-*r/77.7%
metadata-eval77.7%
metadata-eval77.7%
Simplified77.7%
if 4.00000000000000019e-4 < n Initial program 24.1%
clear-num24.1%
un-div-inv24.1%
associate-/l/24.5%
add-exp-log24.5%
expm1-define24.5%
log-pow20.7%
log1p-define77.8%
Applied egg-rr77.8%
associate-/r/77.8%
*-commutative77.8%
Simplified77.8%
Taylor expanded in n around inf 95.9%
Taylor expanded in i around 0 84.4%
*-commutative84.4%
Simplified84.4%
Taylor expanded in n around 0 84.7%
Final simplification80.0%
(FPCore (i n)
:precision binary64
(if (<= n -1.9e+229)
(+ (* n 100.0) (* i (+ (* 16.666666666666668 (* i n)) (* n 50.0))))
(if (<= n 0.0004)
(/ (* n 100.0) (+ 1.0 (* i (+ (/ 0.5 n) -0.5))))
(* (/ 100.0 i) (* n (* i (+ 1.0 (* i 0.5))))))))
double code(double i, double n) {
double tmp;
if (n <= -1.9e+229) {
tmp = (n * 100.0) + (i * ((16.666666666666668 * (i * n)) + (n * 50.0)));
} else if (n <= 0.0004) {
tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5)));
} else {
tmp = (100.0 / i) * (n * (i * (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.9d+229)) then
tmp = (n * 100.0d0) + (i * ((16.666666666666668d0 * (i * n)) + (n * 50.0d0)))
else if (n <= 0.0004d0) then
tmp = (n * 100.0d0) / (1.0d0 + (i * ((0.5d0 / n) + (-0.5d0))))
else
tmp = (100.0d0 / i) * (n * (i * (1.0d0 + (i * 0.5d0))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -1.9e+229) {
tmp = (n * 100.0) + (i * ((16.666666666666668 * (i * n)) + (n * 50.0)));
} else if (n <= 0.0004) {
tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5)));
} else {
tmp = (100.0 / i) * (n * (i * (1.0 + (i * 0.5))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -1.9e+229: tmp = (n * 100.0) + (i * ((16.666666666666668 * (i * n)) + (n * 50.0))) elif n <= 0.0004: tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5))) else: tmp = (100.0 / i) * (n * (i * (1.0 + (i * 0.5)))) return tmp
function code(i, n) tmp = 0.0 if (n <= -1.9e+229) tmp = Float64(Float64(n * 100.0) + Float64(i * Float64(Float64(16.666666666666668 * Float64(i * n)) + Float64(n * 50.0)))); elseif (n <= 0.0004) tmp = Float64(Float64(n * 100.0) / Float64(1.0 + Float64(i * Float64(Float64(0.5 / n) + -0.5)))); else tmp = Float64(Float64(100.0 / i) * Float64(n * Float64(i * Float64(1.0 + Float64(i * 0.5))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -1.9e+229) tmp = (n * 100.0) + (i * ((16.666666666666668 * (i * n)) + (n * 50.0))); elseif (n <= 0.0004) tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5))); else tmp = (100.0 / i) * (n * (i * (1.0 + (i * 0.5)))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -1.9e+229], N[(N[(n * 100.0), $MachinePrecision] + N[(i * N[(N[(16.666666666666668 * N[(i * n), $MachinePrecision]), $MachinePrecision] + N[(n * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 0.0004], N[(N[(n * 100.0), $MachinePrecision] / N[(1.0 + N[(i * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(100.0 / i), $MachinePrecision] * N[(n * N[(i * N[(1.0 + N[(i * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.9 \cdot 10^{+229}:\\
\;\;\;\;n \cdot 100 + i \cdot \left(16.666666666666668 \cdot \left(i \cdot n\right) + n \cdot 50\right)\\
\mathbf{elif}\;n \leq 0.0004:\\
\;\;\;\;\frac{n \cdot 100}{1 + i \cdot \left(\frac{0.5}{n} + -0.5\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{100}{i} \cdot \left(n \cdot \left(i \cdot \left(1 + i \cdot 0.5\right)\right)\right)\\
\end{array}
\end{array}
if n < -1.90000000000000009e229Initial program 21.5%
clear-num21.5%
un-div-inv21.5%
associate-/l/22.3%
add-exp-log22.3%
expm1-define22.3%
log-pow22.3%
log1p-define53.2%
Applied egg-rr53.2%
associate-/r/53.3%
*-commutative53.3%
Simplified53.3%
Taylor expanded in n around inf 99.4%
Taylor expanded in i around 0 79.3%
if -1.90000000000000009e229 < n < 4.00000000000000019e-4Initial program 26.2%
associate-*r/26.2%
sub-neg26.2%
distribute-rgt-in26.2%
metadata-eval26.2%
metadata-eval26.2%
Simplified26.2%
metadata-eval26.2%
metadata-eval26.2%
distribute-rgt-in26.2%
sub-neg26.2%
associate-*r/26.2%
*-commutative26.2%
associate-/r/26.4%
associate-*l*26.5%
add-exp-log26.5%
expm1-define26.5%
log-pow36.8%
log1p-define85.3%
Applied egg-rr85.3%
*-commutative85.3%
expm1-undefine28.4%
*-commutative28.4%
log1p-undefine23.9%
+-commutative23.9%
pow-to-exp26.5%
clear-num26.5%
un-div-inv26.4%
pow-to-exp23.9%
+-commutative23.9%
log1p-undefine28.5%
*-commutative28.5%
expm1-undefine85.3%
Applied egg-rr85.3%
Taylor expanded in i around 0 77.7%
sub-neg77.7%
associate-*r/77.7%
metadata-eval77.7%
metadata-eval77.7%
Simplified77.7%
if 4.00000000000000019e-4 < n Initial program 24.1%
clear-num24.1%
un-div-inv24.1%
associate-/l/24.5%
add-exp-log24.5%
expm1-define24.5%
log-pow20.7%
log1p-define77.8%
Applied egg-rr77.8%
associate-/r/77.8%
*-commutative77.8%
Simplified77.8%
Taylor expanded in n around inf 95.9%
Taylor expanded in i around 0 84.0%
*-commutative84.0%
Simplified84.0%
Final simplification79.7%
(FPCore (i n)
:precision binary64
(if (<= n -3.05e+231)
(* n (+ 100.0 (* i 50.0)))
(if (<= n 0.0004)
(/ (* n 100.0) (+ 1.0 (* i (+ (/ 0.5 n) -0.5))))
(* (/ 100.0 i) (* n (* i (+ 1.0 (* i 0.5))))))))
double code(double i, double n) {
double tmp;
if (n <= -3.05e+231) {
tmp = n * (100.0 + (i * 50.0));
} else if (n <= 0.0004) {
tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5)));
} else {
tmp = (100.0 / i) * (n * (i * (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 <= (-3.05d+231)) then
tmp = n * (100.0d0 + (i * 50.0d0))
else if (n <= 0.0004d0) then
tmp = (n * 100.0d0) / (1.0d0 + (i * ((0.5d0 / n) + (-0.5d0))))
else
tmp = (100.0d0 / i) * (n * (i * (1.0d0 + (i * 0.5d0))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -3.05e+231) {
tmp = n * (100.0 + (i * 50.0));
} else if (n <= 0.0004) {
tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5)));
} else {
tmp = (100.0 / i) * (n * (i * (1.0 + (i * 0.5))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -3.05e+231: tmp = n * (100.0 + (i * 50.0)) elif n <= 0.0004: tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5))) else: tmp = (100.0 / i) * (n * (i * (1.0 + (i * 0.5)))) return tmp
function code(i, n) tmp = 0.0 if (n <= -3.05e+231) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); elseif (n <= 0.0004) tmp = Float64(Float64(n * 100.0) / Float64(1.0 + Float64(i * Float64(Float64(0.5 / n) + -0.5)))); else tmp = Float64(Float64(100.0 / i) * Float64(n * Float64(i * Float64(1.0 + Float64(i * 0.5))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -3.05e+231) tmp = n * (100.0 + (i * 50.0)); elseif (n <= 0.0004) tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5))); else tmp = (100.0 / i) * (n * (i * (1.0 + (i * 0.5)))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -3.05e+231], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 0.0004], N[(N[(n * 100.0), $MachinePrecision] / N[(1.0 + N[(i * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(100.0 / i), $MachinePrecision] * N[(n * N[(i * N[(1.0 + N[(i * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -3.05 \cdot 10^{+231}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{elif}\;n \leq 0.0004:\\
\;\;\;\;\frac{n \cdot 100}{1 + i \cdot \left(\frac{0.5}{n} + -0.5\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{100}{i} \cdot \left(n \cdot \left(i \cdot \left(1 + i \cdot 0.5\right)\right)\right)\\
\end{array}
\end{array}
if n < -3.04999999999999986e231Initial program 21.5%
associate-/r/22.3%
associate-*r*22.4%
*-commutative22.4%
associate-*r/22.3%
sub-neg22.3%
distribute-lft-in22.3%
metadata-eval22.3%
metadata-eval22.3%
metadata-eval22.3%
fma-define22.3%
metadata-eval22.3%
Simplified22.3%
Taylor expanded in i around 0 77.2%
*-commutative77.2%
associate-*r/77.2%
metadata-eval77.2%
Simplified77.2%
Taylor expanded in n around inf 77.2%
*-commutative77.2%
Simplified77.2%
if -3.04999999999999986e231 < n < 4.00000000000000019e-4Initial program 26.2%
associate-*r/26.2%
sub-neg26.2%
distribute-rgt-in26.2%
metadata-eval26.2%
metadata-eval26.2%
Simplified26.2%
metadata-eval26.2%
metadata-eval26.2%
distribute-rgt-in26.2%
sub-neg26.2%
associate-*r/26.2%
*-commutative26.2%
associate-/r/26.4%
associate-*l*26.5%
add-exp-log26.5%
expm1-define26.5%
log-pow36.8%
log1p-define85.3%
Applied egg-rr85.3%
*-commutative85.3%
expm1-undefine28.4%
*-commutative28.4%
log1p-undefine23.9%
+-commutative23.9%
pow-to-exp26.5%
clear-num26.5%
un-div-inv26.4%
pow-to-exp23.9%
+-commutative23.9%
log1p-undefine28.5%
*-commutative28.5%
expm1-undefine85.3%
Applied egg-rr85.3%
Taylor expanded in i around 0 77.7%
sub-neg77.7%
associate-*r/77.7%
metadata-eval77.7%
metadata-eval77.7%
Simplified77.7%
if 4.00000000000000019e-4 < n Initial program 24.1%
clear-num24.1%
un-div-inv24.1%
associate-/l/24.5%
add-exp-log24.5%
expm1-define24.5%
log-pow20.7%
log1p-define77.8%
Applied egg-rr77.8%
associate-/r/77.8%
*-commutative77.8%
Simplified77.8%
Taylor expanded in n around inf 95.9%
Taylor expanded in i around 0 84.0%
*-commutative84.0%
Simplified84.0%
(FPCore (i n)
:precision binary64
(if (<= n -6.4e-164)
(* n (+ 100.0 (* i 50.0)))
(if (<= n 1.05e-123)
(/ 0.0 (/ i n))
(* (/ 100.0 i) (* n (* i (+ 1.0 (* i 0.5))))))))
double code(double i, double n) {
double tmp;
if (n <= -6.4e-164) {
tmp = n * (100.0 + (i * 50.0));
} else if (n <= 1.05e-123) {
tmp = 0.0 / (i / n);
} else {
tmp = (100.0 / i) * (n * (i * (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 <= (-6.4d-164)) then
tmp = n * (100.0d0 + (i * 50.0d0))
else if (n <= 1.05d-123) then
tmp = 0.0d0 / (i / n)
else
tmp = (100.0d0 / i) * (n * (i * (1.0d0 + (i * 0.5d0))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -6.4e-164) {
tmp = n * (100.0 + (i * 50.0));
} else if (n <= 1.05e-123) {
tmp = 0.0 / (i / n);
} else {
tmp = (100.0 / i) * (n * (i * (1.0 + (i * 0.5))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -6.4e-164: tmp = n * (100.0 + (i * 50.0)) elif n <= 1.05e-123: tmp = 0.0 / (i / n) else: tmp = (100.0 / i) * (n * (i * (1.0 + (i * 0.5)))) return tmp
function code(i, n) tmp = 0.0 if (n <= -6.4e-164) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); elseif (n <= 1.05e-123) tmp = Float64(0.0 / Float64(i / n)); else tmp = Float64(Float64(100.0 / i) * Float64(n * Float64(i * Float64(1.0 + Float64(i * 0.5))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -6.4e-164) tmp = n * (100.0 + (i * 50.0)); elseif (n <= 1.05e-123) tmp = 0.0 / (i / n); else tmp = (100.0 / i) * (n * (i * (1.0 + (i * 0.5)))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -6.4e-164], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.05e-123], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(N[(100.0 / i), $MachinePrecision] * N[(n * N[(i * N[(1.0 + N[(i * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -6.4 \cdot 10^{-164}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{elif}\;n \leq 1.05 \cdot 10^{-123}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;\frac{100}{i} \cdot \left(n \cdot \left(i \cdot \left(1 + i \cdot 0.5\right)\right)\right)\\
\end{array}
\end{array}
if n < -6.4000000000000001e-164Initial program 22.5%
associate-/r/22.8%
associate-*r*22.8%
*-commutative22.8%
associate-*r/22.8%
sub-neg22.8%
distribute-lft-in22.8%
metadata-eval22.8%
metadata-eval22.8%
metadata-eval22.8%
fma-define22.8%
metadata-eval22.8%
Simplified22.8%
Taylor expanded in i around 0 69.6%
*-commutative69.6%
associate-*r/69.6%
metadata-eval69.6%
Simplified69.6%
Taylor expanded in n around inf 69.7%
*-commutative69.7%
Simplified69.7%
if -6.4000000000000001e-164 < n < 1.05e-123Initial program 40.1%
associate-*r/40.1%
sub-neg40.1%
distribute-rgt-in40.1%
metadata-eval40.1%
metadata-eval40.1%
Simplified40.1%
Taylor expanded in i around 0 65.1%
if 1.05e-123 < n Initial program 20.3%
clear-num20.3%
un-div-inv20.3%
associate-/l/20.6%
add-exp-log20.6%
expm1-define20.6%
log-pow25.1%
log1p-define81.7%
Applied egg-rr81.7%
associate-/r/81.6%
*-commutative81.6%
Simplified81.6%
Taylor expanded in n around inf 87.2%
Taylor expanded in i around 0 78.2%
*-commutative78.2%
Simplified78.2%
Final simplification72.2%
(FPCore (i n) :precision binary64 (if (<= n -5.6e-175) (* n (+ 100.0 (* i 50.0))) (if (<= n 2.9e-135) (/ 0.0 (/ i n)) (+ (* n 100.0) (* (* i n) 50.0)))))
double code(double i, double n) {
double tmp;
if (n <= -5.6e-175) {
tmp = n * (100.0 + (i * 50.0));
} else if (n <= 2.9e-135) {
tmp = 0.0 / (i / n);
} else {
tmp = (n * 100.0) + ((i * n) * 50.0);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-5.6d-175)) then
tmp = n * (100.0d0 + (i * 50.0d0))
else if (n <= 2.9d-135) then
tmp = 0.0d0 / (i / n)
else
tmp = (n * 100.0d0) + ((i * n) * 50.0d0)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -5.6e-175) {
tmp = n * (100.0 + (i * 50.0));
} else if (n <= 2.9e-135) {
tmp = 0.0 / (i / n);
} else {
tmp = (n * 100.0) + ((i * n) * 50.0);
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -5.6e-175: tmp = n * (100.0 + (i * 50.0)) elif n <= 2.9e-135: tmp = 0.0 / (i / n) else: tmp = (n * 100.0) + ((i * n) * 50.0) return tmp
function code(i, n) tmp = 0.0 if (n <= -5.6e-175) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); elseif (n <= 2.9e-135) tmp = Float64(0.0 / Float64(i / n)); else tmp = Float64(Float64(n * 100.0) + Float64(Float64(i * n) * 50.0)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -5.6e-175) tmp = n * (100.0 + (i * 50.0)); elseif (n <= 2.9e-135) tmp = 0.0 / (i / n); else tmp = (n * 100.0) + ((i * n) * 50.0); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -5.6e-175], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.9e-135], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(N[(n * 100.0), $MachinePrecision] + N[(N[(i * n), $MachinePrecision] * 50.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -5.6 \cdot 10^{-175}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{elif}\;n \leq 2.9 \cdot 10^{-135}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100 + \left(i \cdot n\right) \cdot 50\\
\end{array}
\end{array}
if n < -5.6e-175Initial program 22.5%
associate-/r/22.8%
associate-*r*22.8%
*-commutative22.8%
associate-*r/22.8%
sub-neg22.8%
distribute-lft-in22.8%
metadata-eval22.8%
metadata-eval22.8%
metadata-eval22.8%
fma-define22.8%
metadata-eval22.8%
Simplified22.8%
Taylor expanded in i around 0 69.6%
*-commutative69.6%
associate-*r/69.6%
metadata-eval69.6%
Simplified69.6%
Taylor expanded in n around inf 69.7%
*-commutative69.7%
Simplified69.7%
if -5.6e-175 < n < 2.9000000000000002e-135Initial program 43.9%
associate-*r/43.9%
sub-neg43.9%
distribute-rgt-in43.9%
metadata-eval43.9%
metadata-eval43.9%
Simplified43.9%
Taylor expanded in i around 0 69.5%
if 2.9000000000000002e-135 < n Initial program 19.6%
clear-num19.6%
un-div-inv19.6%
associate-/l/19.9%
add-exp-log19.9%
expm1-define19.9%
log-pow25.9%
log1p-define80.7%
Applied egg-rr80.7%
associate-/r/80.7%
*-commutative80.7%
Simplified80.7%
Taylor expanded in n around inf 84.2%
Taylor expanded in i around 0 72.9%
Final simplification71.0%
(FPCore (i n)
:precision binary64
(if (<= n -1.1e+116)
(* n (+ 100.0 (* i 50.0)))
(if (<= n 0.0004)
(* 100.0 (/ i (/ i n)))
(+ (* n 100.0) (* (* i n) 50.0)))))
double code(double i, double n) {
double tmp;
if (n <= -1.1e+116) {
tmp = n * (100.0 + (i * 50.0));
} else if (n <= 0.0004) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = (n * 100.0) + ((i * n) * 50.0);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-1.1d+116)) then
tmp = n * (100.0d0 + (i * 50.0d0))
else if (n <= 0.0004d0) then
tmp = 100.0d0 * (i / (i / n))
else
tmp = (n * 100.0d0) + ((i * n) * 50.0d0)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -1.1e+116) {
tmp = n * (100.0 + (i * 50.0));
} else if (n <= 0.0004) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = (n * 100.0) + ((i * n) * 50.0);
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -1.1e+116: tmp = n * (100.0 + (i * 50.0)) elif n <= 0.0004: tmp = 100.0 * (i / (i / n)) else: tmp = (n * 100.0) + ((i * n) * 50.0) return tmp
function code(i, n) tmp = 0.0 if (n <= -1.1e+116) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); elseif (n <= 0.0004) tmp = Float64(100.0 * Float64(i / Float64(i / n))); else tmp = Float64(Float64(n * 100.0) + Float64(Float64(i * n) * 50.0)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -1.1e+116) tmp = n * (100.0 + (i * 50.0)); elseif (n <= 0.0004) tmp = 100.0 * (i / (i / n)); else tmp = (n * 100.0) + ((i * n) * 50.0); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -1.1e+116], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 0.0004], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(n * 100.0), $MachinePrecision] + N[(N[(i * n), $MachinePrecision] * 50.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.1 \cdot 10^{+116}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{elif}\;n \leq 0.0004:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100 + \left(i \cdot n\right) \cdot 50\\
\end{array}
\end{array}
if n < -1.1e116Initial program 16.9%
associate-/r/17.5%
associate-*r*17.5%
*-commutative17.5%
associate-*r/17.4%
sub-neg17.4%
distribute-lft-in17.4%
metadata-eval17.4%
metadata-eval17.4%
metadata-eval17.4%
fma-define17.4%
metadata-eval17.4%
Simplified17.4%
Taylor expanded in i around 0 70.7%
*-commutative70.7%
associate-*r/70.7%
metadata-eval70.7%
Simplified70.7%
Taylor expanded in n around inf 70.7%
*-commutative70.7%
Simplified70.7%
if -1.1e116 < n < 4.00000000000000019e-4Initial program 28.6%
Taylor expanded in i around 0 65.5%
if 4.00000000000000019e-4 < n Initial program 24.1%
clear-num24.1%
un-div-inv24.1%
associate-/l/24.5%
add-exp-log24.5%
expm1-define24.5%
log-pow20.7%
log1p-define77.8%
Applied egg-rr77.8%
associate-/r/77.8%
*-commutative77.8%
Simplified77.8%
Taylor expanded in n around inf 95.9%
Taylor expanded in i around 0 77.3%
Final simplification70.0%
(FPCore (i n) :precision binary64 (if (or (<= n -1.1e+116) (not (<= n 0.0004))) (* n (+ 100.0 (* i 50.0))) (* 100.0 (/ i (/ i n)))))
double code(double i, double n) {
double tmp;
if ((n <= -1.1e+116) || !(n <= 0.0004)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-1.1d+116)) .or. (.not. (n <= 0.0004d0))) then
tmp = n * (100.0d0 + (i * 50.0d0))
else
tmp = 100.0d0 * (i / (i / n))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -1.1e+116) || !(n <= 0.0004)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -1.1e+116) or not (n <= 0.0004): tmp = n * (100.0 + (i * 50.0)) else: tmp = 100.0 * (i / (i / n)) return tmp
function code(i, n) tmp = 0.0 if ((n <= -1.1e+116) || !(n <= 0.0004)) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); else tmp = Float64(100.0 * Float64(i / Float64(i / n))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -1.1e+116) || ~((n <= 0.0004))) tmp = n * (100.0 + (i * 50.0)); else tmp = 100.0 * (i / (i / n)); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -1.1e+116], N[Not[LessEqual[n, 0.0004]], $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.1 \cdot 10^{+116} \lor \neg \left(n \leq 0.0004\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -1.1e116 or 4.00000000000000019e-4 < n Initial program 21.6%
associate-/r/22.0%
associate-*r*22.0%
*-commutative22.0%
associate-*r/22.0%
sub-neg22.0%
distribute-lft-in22.0%
metadata-eval22.0%
metadata-eval22.0%
metadata-eval22.0%
fma-define22.0%
metadata-eval22.0%
Simplified22.0%
Taylor expanded in i around 0 74.9%
*-commutative74.9%
associate-*r/74.9%
metadata-eval74.9%
Simplified74.9%
Taylor expanded in n around inf 74.9%
*-commutative74.9%
Simplified74.9%
if -1.1e116 < n < 4.00000000000000019e-4Initial program 28.6%
Taylor expanded in i around 0 65.5%
Final simplification70.0%
(FPCore (i n) :precision binary64 (if (<= i -5e+49) (* 100.0 (/ i (/ i n))) (if (<= i 2.0) (* n 100.0) (* (* i n) 50.0))))
double code(double i, double n) {
double tmp;
if (i <= -5e+49) {
tmp = 100.0 * (i / (i / n));
} else if (i <= 2.0) {
tmp = n * 100.0;
} else {
tmp = (i * n) * 50.0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= (-5d+49)) then
tmp = 100.0d0 * (i / (i / n))
else if (i <= 2.0d0) then
tmp = n * 100.0d0
else
tmp = (i * n) * 50.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= -5e+49) {
tmp = 100.0 * (i / (i / n));
} else if (i <= 2.0) {
tmp = n * 100.0;
} else {
tmp = (i * n) * 50.0;
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -5e+49: tmp = 100.0 * (i / (i / n)) elif i <= 2.0: tmp = n * 100.0 else: tmp = (i * n) * 50.0 return tmp
function code(i, n) tmp = 0.0 if (i <= -5e+49) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (i <= 2.0) tmp = Float64(n * 100.0); else tmp = Float64(Float64(i * n) * 50.0); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -5e+49) tmp = 100.0 * (i / (i / n)); elseif (i <= 2.0) tmp = n * 100.0; else tmp = (i * n) * 50.0; end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -5e+49], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 2.0], N[(n * 100.0), $MachinePrecision], N[(N[(i * n), $MachinePrecision] * 50.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -5 \cdot 10^{+49}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;i \leq 2:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;\left(i \cdot n\right) \cdot 50\\
\end{array}
\end{array}
if i < -5.0000000000000004e49Initial program 71.3%
Taylor expanded in i around 0 22.9%
if -5.0000000000000004e49 < i < 2Initial program 5.8%
Taylor expanded in i around 0 86.8%
*-commutative86.8%
Simplified86.8%
if 2 < i Initial program 41.6%
associate-/r/41.9%
associate-*r*42.0%
*-commutative42.0%
associate-*r/42.0%
sub-neg42.0%
distribute-lft-in41.9%
metadata-eval41.9%
metadata-eval41.9%
metadata-eval41.9%
fma-define42.0%
metadata-eval42.0%
Simplified42.0%
Taylor expanded in i around 0 37.8%
*-commutative37.8%
associate-*r/37.8%
metadata-eval37.8%
Simplified37.8%
Taylor expanded in i around inf 37.8%
associate-*r/37.8%
metadata-eval37.8%
Simplified37.8%
Taylor expanded in n around inf 38.7%
*-commutative38.7%
Simplified38.7%
Final simplification64.5%
(FPCore (i n) :precision binary64 (if (<= i 2.0) (* n 100.0) (* (* i n) 50.0)))
double code(double i, double n) {
double tmp;
if (i <= 2.0) {
tmp = n * 100.0;
} else {
tmp = (i * n) * 50.0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= 2.0d0) then
tmp = n * 100.0d0
else
tmp = (i * n) * 50.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= 2.0) {
tmp = n * 100.0;
} else {
tmp = (i * n) * 50.0;
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 2.0: tmp = n * 100.0 else: tmp = (i * n) * 50.0 return tmp
function code(i, n) tmp = 0.0 if (i <= 2.0) tmp = Float64(n * 100.0); else tmp = Float64(Float64(i * n) * 50.0); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= 2.0) tmp = n * 100.0; else tmp = (i * n) * 50.0; end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, 2.0], N[(n * 100.0), $MachinePrecision], N[(N[(i * n), $MachinePrecision] * 50.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 2:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;\left(i \cdot n\right) \cdot 50\\
\end{array}
\end{array}
if i < 2Initial program 19.8%
Taylor expanded in i around 0 69.3%
*-commutative69.3%
Simplified69.3%
if 2 < i Initial program 41.6%
associate-/r/41.9%
associate-*r*42.0%
*-commutative42.0%
associate-*r/42.0%
sub-neg42.0%
distribute-lft-in41.9%
metadata-eval41.9%
metadata-eval41.9%
metadata-eval41.9%
fma-define42.0%
metadata-eval42.0%
Simplified42.0%
Taylor expanded in i around 0 37.8%
*-commutative37.8%
associate-*r/37.8%
metadata-eval37.8%
Simplified37.8%
Taylor expanded in i around inf 37.8%
associate-*r/37.8%
metadata-eval37.8%
Simplified37.8%
Taylor expanded in n around inf 38.7%
*-commutative38.7%
Simplified38.7%
Final simplification61.6%
(FPCore (i n) :precision binary64 (* n 100.0))
double code(double i, double n) {
return n * 100.0;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = n * 100.0d0
end function
public static double code(double i, double n) {
return n * 100.0;
}
def code(i, n): return n * 100.0
function code(i, n) return Float64(n * 100.0) end
function tmp = code(i, n) tmp = n * 100.0; end
code[i_, n_] := N[(n * 100.0), $MachinePrecision]
\begin{array}{l}
\\
n \cdot 100
\end{array}
Initial program 25.2%
Taylor expanded in i around 0 53.4%
*-commutative53.4%
Simplified53.4%
(FPCore (i n) :precision binary64 (* i -50.0))
double code(double i, double n) {
return i * -50.0;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = i * (-50.0d0)
end function
public static double code(double i, double n) {
return i * -50.0;
}
def code(i, n): return i * -50.0
function code(i, n) return Float64(i * -50.0) end
function tmp = code(i, n) tmp = i * -50.0; end
code[i_, n_] := N[(i * -50.0), $MachinePrecision]
\begin{array}{l}
\\
i \cdot -50
\end{array}
Initial program 25.2%
associate-/r/25.5%
associate-*r*25.5%
*-commutative25.5%
associate-*r/25.5%
sub-neg25.5%
distribute-lft-in25.5%
metadata-eval25.5%
metadata-eval25.5%
metadata-eval25.5%
fma-define25.5%
metadata-eval25.5%
Simplified25.5%
Taylor expanded in i around 0 61.8%
*-commutative61.8%
associate-*r/61.8%
metadata-eval61.8%
Simplified61.8%
Taylor expanded in n around 0 2.8%
*-commutative2.8%
Simplified2.8%
(FPCore (i n)
:precision binary64
(let* ((t_0 (+ 1.0 (/ i n))))
(*
100.0
(/
(-
(exp
(*
n
(if (== t_0 1.0)
(/ i n)
(/ (* (/ i n) (log t_0)) (- (+ (/ i n) 1.0) 1.0)))))
1.0)
(/ i n)))))
double code(double i, double n) {
double t_0 = 1.0 + (i / n);
double tmp;
if (t_0 == 1.0) {
tmp = i / n;
} else {
tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0) - 1.0);
}
return 100.0 * ((exp((n * tmp)) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + (i / n)
if (t_0 == 1.0d0) then
tmp = i / n
else
tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0d0) - 1.0d0)
end if
code = 100.0d0 * ((exp((n * tmp)) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
double t_0 = 1.0 + (i / n);
double tmp;
if (t_0 == 1.0) {
tmp = i / n;
} else {
tmp = ((i / n) * Math.log(t_0)) / (((i / n) + 1.0) - 1.0);
}
return 100.0 * ((Math.exp((n * tmp)) - 1.0) / (i / n));
}
def code(i, n): t_0 = 1.0 + (i / n) tmp = 0 if t_0 == 1.0: tmp = i / n else: tmp = ((i / n) * math.log(t_0)) / (((i / n) + 1.0) - 1.0) return 100.0 * ((math.exp((n * tmp)) - 1.0) / (i / n))
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) tmp = 0.0 if (t_0 == 1.0) tmp = Float64(i / n); else tmp = Float64(Float64(Float64(i / n) * log(t_0)) / Float64(Float64(Float64(i / n) + 1.0) - 1.0)); end return Float64(100.0 * Float64(Float64(exp(Float64(n * tmp)) - 1.0) / Float64(i / n))) end
function tmp_2 = code(i, n) t_0 = 1.0 + (i / n); tmp = 0.0; if (t_0 == 1.0) tmp = i / n; else tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0) - 1.0); end tmp_2 = 100.0 * ((exp((n * tmp)) - 1.0) / (i / n)); end
code[i_, n_] := Block[{t$95$0 = N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision]}, N[(100.0 * N[(N[(N[Exp[N[(n * If[Equal[t$95$0, 1.0], N[(i / n), $MachinePrecision], N[(N[(N[(i / n), $MachinePrecision] * N[Log[t$95$0], $MachinePrecision]), $MachinePrecision] / N[(N[(N[(i / n), $MachinePrecision] + 1.0), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{i}{n}\\
100 \cdot \frac{e^{n \cdot \begin{array}{l}
\mathbf{if}\;t\_0 = 1:\\
\;\;\;\;\frac{i}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{i}{n} \cdot \log t\_0}{\left(\frac{i}{n} + 1\right) - 1}\\
\end{array}} - 1}{\frac{i}{n}}
\end{array}
\end{array}
herbie shell --seed 2024117
(FPCore (i n)
:name "Compound Interest"
:precision binary64
:alt
(! :herbie-platform default (let ((lnbase (if (== (+ 1 (/ i n)) 1) (/ i n) (/ (* (/ i n) (log (+ 1 (/ i n)))) (- (+ (/ i n) 1) 1))))) (* 100 (/ (- (exp (* n lnbase)) 1) (/ i n)))))
(* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))