
(FPCore (x y) :precision binary64 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0)))
double code(double x, double y) {
return (x * ((x / y) + 1.0)) / (x + 1.0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * ((x / y) + 1.0d0)) / (x + 1.0d0)
end function
public static double code(double x, double y) {
return (x * ((x / y) + 1.0)) / (x + 1.0);
}
def code(x, y): return (x * ((x / y) + 1.0)) / (x + 1.0)
function code(x, y) return Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0)) end
function tmp = code(x, y) tmp = (x * ((x / y) + 1.0)) / (x + 1.0); end
code[x_, y_] := N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0)))
double code(double x, double y) {
return (x * ((x / y) + 1.0)) / (x + 1.0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * ((x / y) + 1.0d0)) / (x + 1.0d0)
end function
public static double code(double x, double y) {
return (x * ((x / y) + 1.0)) / (x + 1.0);
}
def code(x, y): return (x * ((x / y) + 1.0)) / (x + 1.0)
function code(x, y) return Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0)) end
function tmp = code(x, y) tmp = (x * ((x / y) + 1.0)) / (x + 1.0); end
code[x_, y_] := N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}
\end{array}
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0))))
(if (<= t_0 (- INFINITY))
(/ x y)
(if (<= t_0 100000000000.0) t_0 (/ (/ x y) (+ 1.0 (/ 1.0 x)))))))
double code(double x, double y) {
double t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = x / y;
} else if (t_0 <= 100000000000.0) {
tmp = t_0;
} else {
tmp = (x / y) / (1.0 + (1.0 / x));
}
return tmp;
}
public static double code(double x, double y) {
double t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
double tmp;
if (t_0 <= -Double.POSITIVE_INFINITY) {
tmp = x / y;
} else if (t_0 <= 100000000000.0) {
tmp = t_0;
} else {
tmp = (x / y) / (1.0 + (1.0 / x));
}
return tmp;
}
def code(x, y): t_0 = (x * ((x / y) + 1.0)) / (x + 1.0) tmp = 0 if t_0 <= -math.inf: tmp = x / y elif t_0 <= 100000000000.0: tmp = t_0 else: tmp = (x / y) / (1.0 + (1.0 / x)) return tmp
function code(x, y) t_0 = Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0)) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(x / y); elseif (t_0 <= 100000000000.0) tmp = t_0; else tmp = Float64(Float64(x / y) / Float64(1.0 + Float64(1.0 / x))); end return tmp end
function tmp_2 = code(x, y) t_0 = (x * ((x / y) + 1.0)) / (x + 1.0); tmp = 0.0; if (t_0 <= -Inf) tmp = x / y; elseif (t_0 <= 100000000000.0) tmp = t_0; else tmp = (x / y) / (1.0 + (1.0 / x)); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(x / y), $MachinePrecision], If[LessEqual[t$95$0, 100000000000.0], t$95$0, N[(N[(x / y), $MachinePrecision] / N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;t\_0 \leq 100000000000:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{1 + \frac{1}{x}}\\
\end{array}
\end{array}
if (/.f64 (*.f64 x (+.f64 (/.f64 x y) 1)) (+.f64 x 1)) < -inf.0Initial program 43.2%
Taylor expanded in x around inf 100.0%
if -inf.0 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) 1)) (+.f64 x 1)) < 1e11Initial program 100.0%
if 1e11 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) 1)) (+.f64 x 1)) Initial program 74.4%
*-commutative74.4%
associate-/l*99.9%
metadata-eval99.9%
sub-neg99.9%
div-sub99.9%
*-inverses99.9%
Simplified99.9%
Taylor expanded in y around 0 99.9%
associate-/r*99.9%
Simplified99.9%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (+ x 1.0))))
(if (<= x -520000000000.0)
(+ 1.0 (/ (+ x -1.0) y))
(if (<= x 2.8e-42)
t_0
(if (<= x 17.5)
(/ x (+ y (/ y x)))
(if (<= x 3850.0) t_0 (+ (/ x y) (+ 1.0 (/ -1.0 y)))))))))
double code(double x, double y) {
double t_0 = x / (x + 1.0);
double tmp;
if (x <= -520000000000.0) {
tmp = 1.0 + ((x + -1.0) / y);
} else if (x <= 2.8e-42) {
tmp = t_0;
} else if (x <= 17.5) {
tmp = x / (y + (y / x));
} else if (x <= 3850.0) {
tmp = t_0;
} else {
tmp = (x / y) + (1.0 + (-1.0 / y));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = x / (x + 1.0d0)
if (x <= (-520000000000.0d0)) then
tmp = 1.0d0 + ((x + (-1.0d0)) / y)
else if (x <= 2.8d-42) then
tmp = t_0
else if (x <= 17.5d0) then
tmp = x / (y + (y / x))
else if (x <= 3850.0d0) then
tmp = t_0
else
tmp = (x / y) + (1.0d0 + ((-1.0d0) / y))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x / (x + 1.0);
double tmp;
if (x <= -520000000000.0) {
tmp = 1.0 + ((x + -1.0) / y);
} else if (x <= 2.8e-42) {
tmp = t_0;
} else if (x <= 17.5) {
tmp = x / (y + (y / x));
} else if (x <= 3850.0) {
tmp = t_0;
} else {
tmp = (x / y) + (1.0 + (-1.0 / y));
}
return tmp;
}
def code(x, y): t_0 = x / (x + 1.0) tmp = 0 if x <= -520000000000.0: tmp = 1.0 + ((x + -1.0) / y) elif x <= 2.8e-42: tmp = t_0 elif x <= 17.5: tmp = x / (y + (y / x)) elif x <= 3850.0: tmp = t_0 else: tmp = (x / y) + (1.0 + (-1.0 / y)) return tmp
function code(x, y) t_0 = Float64(x / Float64(x + 1.0)) tmp = 0.0 if (x <= -520000000000.0) tmp = Float64(1.0 + Float64(Float64(x + -1.0) / y)); elseif (x <= 2.8e-42) tmp = t_0; elseif (x <= 17.5) tmp = Float64(x / Float64(y + Float64(y / x))); elseif (x <= 3850.0) tmp = t_0; else tmp = Float64(Float64(x / y) + Float64(1.0 + Float64(-1.0 / y))); end return tmp end
function tmp_2 = code(x, y) t_0 = x / (x + 1.0); tmp = 0.0; if (x <= -520000000000.0) tmp = 1.0 + ((x + -1.0) / y); elseif (x <= 2.8e-42) tmp = t_0; elseif (x <= 17.5) tmp = x / (y + (y / x)); elseif (x <= 3850.0) tmp = t_0; else tmp = (x / y) + (1.0 + (-1.0 / y)); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -520000000000.0], N[(1.0 + N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.8e-42], t$95$0, If[LessEqual[x, 17.5], N[(x / N[(y + N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3850.0], t$95$0, N[(N[(x / y), $MachinePrecision] + N[(1.0 + N[(-1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{x + 1}\\
\mathbf{if}\;x \leq -520000000000:\\
\;\;\;\;1 + \frac{x + -1}{y}\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{-42}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 17.5:\\
\;\;\;\;\frac{x}{y + \frac{y}{x}}\\
\mathbf{elif}\;x \leq 3850:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} + \left(1 + \frac{-1}{y}\right)\\
\end{array}
\end{array}
if x < -5.2e11Initial program 76.4%
Taylor expanded in x around inf 100.0%
Taylor expanded in y around -inf 100.0%
mul-1-neg100.0%
unsub-neg100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
if -5.2e11 < x < 2.79999999999999998e-42 or 17.5 < x < 3850Initial program 99.9%
Taylor expanded in y around inf 79.9%
+-commutative79.9%
Simplified79.9%
if 2.79999999999999998e-42 < x < 17.5Initial program 99.7%
*-commutative99.7%
associate-/l*99.7%
metadata-eval99.7%
sub-neg99.7%
div-sub99.7%
*-inverses99.7%
Simplified99.7%
Taylor expanded in y around 0 71.9%
distribute-lft-in71.9%
*-rgt-identity71.9%
associate-*r/71.9%
*-rgt-identity71.9%
Simplified71.9%
if 3850 < x Initial program 69.5%
Taylor expanded in x around inf 97.5%
+-commutative97.5%
associate--l+97.5%
Applied egg-rr97.5%
Final simplification87.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (+ x 1.0))))
(if (<= x -520000000000.0)
(+ 1.0 (/ (+ x -1.0) y))
(if (<= x 8.6e-44)
t_0
(if (<= x 19.0)
(/ x (* y (+ 1.0 (/ 1.0 x))))
(if (<= x 22000.0) t_0 (+ (/ x y) (+ 1.0 (/ -1.0 y)))))))))
double code(double x, double y) {
double t_0 = x / (x + 1.0);
double tmp;
if (x <= -520000000000.0) {
tmp = 1.0 + ((x + -1.0) / y);
} else if (x <= 8.6e-44) {
tmp = t_0;
} else if (x <= 19.0) {
tmp = x / (y * (1.0 + (1.0 / x)));
} else if (x <= 22000.0) {
tmp = t_0;
} else {
tmp = (x / y) + (1.0 + (-1.0 / y));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = x / (x + 1.0d0)
if (x <= (-520000000000.0d0)) then
tmp = 1.0d0 + ((x + (-1.0d0)) / y)
else if (x <= 8.6d-44) then
tmp = t_0
else if (x <= 19.0d0) then
tmp = x / (y * (1.0d0 + (1.0d0 / x)))
else if (x <= 22000.0d0) then
tmp = t_0
else
tmp = (x / y) + (1.0d0 + ((-1.0d0) / y))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x / (x + 1.0);
double tmp;
if (x <= -520000000000.0) {
tmp = 1.0 + ((x + -1.0) / y);
} else if (x <= 8.6e-44) {
tmp = t_0;
} else if (x <= 19.0) {
tmp = x / (y * (1.0 + (1.0 / x)));
} else if (x <= 22000.0) {
tmp = t_0;
} else {
tmp = (x / y) + (1.0 + (-1.0 / y));
}
return tmp;
}
def code(x, y): t_0 = x / (x + 1.0) tmp = 0 if x <= -520000000000.0: tmp = 1.0 + ((x + -1.0) / y) elif x <= 8.6e-44: tmp = t_0 elif x <= 19.0: tmp = x / (y * (1.0 + (1.0 / x))) elif x <= 22000.0: tmp = t_0 else: tmp = (x / y) + (1.0 + (-1.0 / y)) return tmp
function code(x, y) t_0 = Float64(x / Float64(x + 1.0)) tmp = 0.0 if (x <= -520000000000.0) tmp = Float64(1.0 + Float64(Float64(x + -1.0) / y)); elseif (x <= 8.6e-44) tmp = t_0; elseif (x <= 19.0) tmp = Float64(x / Float64(y * Float64(1.0 + Float64(1.0 / x)))); elseif (x <= 22000.0) tmp = t_0; else tmp = Float64(Float64(x / y) + Float64(1.0 + Float64(-1.0 / y))); end return tmp end
function tmp_2 = code(x, y) t_0 = x / (x + 1.0); tmp = 0.0; if (x <= -520000000000.0) tmp = 1.0 + ((x + -1.0) / y); elseif (x <= 8.6e-44) tmp = t_0; elseif (x <= 19.0) tmp = x / (y * (1.0 + (1.0 / x))); elseif (x <= 22000.0) tmp = t_0; else tmp = (x / y) + (1.0 + (-1.0 / y)); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -520000000000.0], N[(1.0 + N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 8.6e-44], t$95$0, If[LessEqual[x, 19.0], N[(x / N[(y * N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 22000.0], t$95$0, N[(N[(x / y), $MachinePrecision] + N[(1.0 + N[(-1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{x + 1}\\
\mathbf{if}\;x \leq -520000000000:\\
\;\;\;\;1 + \frac{x + -1}{y}\\
\mathbf{elif}\;x \leq 8.6 \cdot 10^{-44}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 19:\\
\;\;\;\;\frac{x}{y \cdot \left(1 + \frac{1}{x}\right)}\\
\mathbf{elif}\;x \leq 22000:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} + \left(1 + \frac{-1}{y}\right)\\
\end{array}
\end{array}
if x < -5.2e11Initial program 76.4%
Taylor expanded in x around inf 100.0%
Taylor expanded in y around -inf 100.0%
mul-1-neg100.0%
unsub-neg100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
if -5.2e11 < x < 8.60000000000000027e-44 or 19 < x < 22000Initial program 99.9%
Taylor expanded in y around inf 79.9%
+-commutative79.9%
Simplified79.9%
if 8.60000000000000027e-44 < x < 19Initial program 99.7%
*-commutative99.7%
associate-/l*99.7%
metadata-eval99.7%
sub-neg99.7%
div-sub99.7%
*-inverses99.7%
Simplified99.7%
Taylor expanded in y around 0 71.9%
if 22000 < x Initial program 69.5%
Taylor expanded in x around inf 97.5%
+-commutative97.5%
associate--l+97.5%
Applied egg-rr97.5%
Final simplification87.9%
(FPCore (x y)
:precision binary64
(if (<= x -1.6e+42)
(/ x y)
(if (<= x -1.0)
1.0
(if (<= x 1.85e-41)
x
(if (<= x 17.0) (* x (/ x y)) (if (<= x 10000.0) 1.0 (/ x y)))))))
double code(double x, double y) {
double tmp;
if (x <= -1.6e+42) {
tmp = x / y;
} else if (x <= -1.0) {
tmp = 1.0;
} else if (x <= 1.85e-41) {
tmp = x;
} else if (x <= 17.0) {
tmp = x * (x / y);
} else if (x <= 10000.0) {
tmp = 1.0;
} else {
tmp = x / y;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.6d+42)) then
tmp = x / y
else if (x <= (-1.0d0)) then
tmp = 1.0d0
else if (x <= 1.85d-41) then
tmp = x
else if (x <= 17.0d0) then
tmp = x * (x / y)
else if (x <= 10000.0d0) then
tmp = 1.0d0
else
tmp = x / y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -1.6e+42) {
tmp = x / y;
} else if (x <= -1.0) {
tmp = 1.0;
} else if (x <= 1.85e-41) {
tmp = x;
} else if (x <= 17.0) {
tmp = x * (x / y);
} else if (x <= 10000.0) {
tmp = 1.0;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.6e+42: tmp = x / y elif x <= -1.0: tmp = 1.0 elif x <= 1.85e-41: tmp = x elif x <= 17.0: tmp = x * (x / y) elif x <= 10000.0: tmp = 1.0 else: tmp = x / y return tmp
function code(x, y) tmp = 0.0 if (x <= -1.6e+42) tmp = Float64(x / y); elseif (x <= -1.0) tmp = 1.0; elseif (x <= 1.85e-41) tmp = x; elseif (x <= 17.0) tmp = Float64(x * Float64(x / y)); elseif (x <= 10000.0) tmp = 1.0; else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1.6e+42) tmp = x / y; elseif (x <= -1.0) tmp = 1.0; elseif (x <= 1.85e-41) tmp = x; elseif (x <= 17.0) tmp = x * (x / y); elseif (x <= 10000.0) tmp = 1.0; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.6e+42], N[(x / y), $MachinePrecision], If[LessEqual[x, -1.0], 1.0, If[LessEqual[x, 1.85e-41], x, If[LessEqual[x, 17.0], N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 10000.0], 1.0, N[(x / y), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.6 \cdot 10^{+42}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq -1:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.85 \cdot 10^{-41}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 17:\\
\;\;\;\;x \cdot \frac{x}{y}\\
\mathbf{elif}\;x \leq 10000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -1.60000000000000001e42 or 1e4 < x Initial program 71.3%
Taylor expanded in x around inf 85.7%
if -1.60000000000000001e42 < x < -1 or 17 < x < 1e4Initial program 94.7%
Taylor expanded in y around inf 75.7%
+-commutative75.7%
Simplified75.7%
clear-num75.5%
inv-pow75.5%
+-commutative75.5%
Applied egg-rr75.5%
unpow-175.5%
+-commutative75.5%
Simplified75.5%
Taylor expanded in x around inf 54.3%
if -1 < x < 1.8500000000000001e-41Initial program 99.9%
Taylor expanded in x around 0 78.4%
if 1.8500000000000001e-41 < x < 17Initial program 99.7%
*-commutative99.7%
associate-/l*99.7%
metadata-eval99.7%
sub-neg99.7%
div-sub99.7%
*-inverses99.7%
Simplified99.7%
Taylor expanded in y around 0 71.9%
distribute-lft-in71.9%
*-rgt-identity71.9%
associate-*r/71.9%
*-rgt-identity71.9%
Simplified71.9%
Taylor expanded in x around 0 62.7%
associate-/r/62.7%
Applied egg-rr62.7%
Final simplification79.3%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (/ (+ x -1.0) y))) (t_1 (/ x (+ x 1.0))))
(if (<= x -520000000000.0)
t_0
(if (<= x 1.8e-41)
t_1
(if (<= x 6.2e-16) (* x (/ x y)) (if (<= x 22000.0) t_1 t_0))))))
double code(double x, double y) {
double t_0 = 1.0 + ((x + -1.0) / y);
double t_1 = x / (x + 1.0);
double tmp;
if (x <= -520000000000.0) {
tmp = t_0;
} else if (x <= 1.8e-41) {
tmp = t_1;
} else if (x <= 6.2e-16) {
tmp = x * (x / y);
} else if (x <= 22000.0) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 + ((x + (-1.0d0)) / y)
t_1 = x / (x + 1.0d0)
if (x <= (-520000000000.0d0)) then
tmp = t_0
else if (x <= 1.8d-41) then
tmp = t_1
else if (x <= 6.2d-16) then
tmp = x * (x / y)
else if (x <= 22000.0d0) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 + ((x + -1.0) / y);
double t_1 = x / (x + 1.0);
double tmp;
if (x <= -520000000000.0) {
tmp = t_0;
} else if (x <= 1.8e-41) {
tmp = t_1;
} else if (x <= 6.2e-16) {
tmp = x * (x / y);
} else if (x <= 22000.0) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + ((x + -1.0) / y) t_1 = x / (x + 1.0) tmp = 0 if x <= -520000000000.0: tmp = t_0 elif x <= 1.8e-41: tmp = t_1 elif x <= 6.2e-16: tmp = x * (x / y) elif x <= 22000.0: tmp = t_1 else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(Float64(x + -1.0) / y)) t_1 = Float64(x / Float64(x + 1.0)) tmp = 0.0 if (x <= -520000000000.0) tmp = t_0; elseif (x <= 1.8e-41) tmp = t_1; elseif (x <= 6.2e-16) tmp = Float64(x * Float64(x / y)); elseif (x <= 22000.0) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + ((x + -1.0) / y); t_1 = x / (x + 1.0); tmp = 0.0; if (x <= -520000000000.0) tmp = t_0; elseif (x <= 1.8e-41) tmp = t_1; elseif (x <= 6.2e-16) tmp = x * (x / y); elseif (x <= 22000.0) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -520000000000.0], t$95$0, If[LessEqual[x, 1.8e-41], t$95$1, If[LessEqual[x, 6.2e-16], N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 22000.0], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{x + -1}{y}\\
t_1 := \frac{x}{x + 1}\\
\mathbf{if}\;x \leq -520000000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{-41}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 6.2 \cdot 10^{-16}:\\
\;\;\;\;x \cdot \frac{x}{y}\\
\mathbf{elif}\;x \leq 22000:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -5.2e11 or 22000 < x Initial program 72.8%
Taylor expanded in x around inf 98.7%
Taylor expanded in y around -inf 98.7%
mul-1-neg98.7%
unsub-neg98.7%
neg-mul-198.7%
unsub-neg98.7%
Simplified98.7%
if -5.2e11 < x < 1.8e-41 or 6.2000000000000002e-16 < x < 22000Initial program 99.9%
Taylor expanded in y around inf 79.4%
+-commutative79.4%
Simplified79.4%
if 1.8e-41 < x < 6.2000000000000002e-16Initial program 99.8%
*-commutative99.8%
associate-/l*99.6%
metadata-eval99.6%
sub-neg99.6%
div-sub99.6%
*-inverses99.6%
Simplified99.6%
Taylor expanded in y around 0 78.1%
distribute-lft-in78.1%
*-rgt-identity78.1%
associate-*r/78.1%
*-rgt-identity78.1%
Simplified78.1%
Taylor expanded in x around 0 78.1%
associate-/r/78.1%
Applied egg-rr78.1%
Final simplification87.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (/ (+ x -1.0) y))) (t_1 (/ x (+ x 1.0))))
(if (<= x -520000000000.0)
t_0
(if (<= x 9.5e-44)
t_1
(if (<= x 15.0) (/ x (+ y (/ y x))) (if (<= x 6100.0) t_1 t_0))))))
double code(double x, double y) {
double t_0 = 1.0 + ((x + -1.0) / y);
double t_1 = x / (x + 1.0);
double tmp;
if (x <= -520000000000.0) {
tmp = t_0;
} else if (x <= 9.5e-44) {
tmp = t_1;
} else if (x <= 15.0) {
tmp = x / (y + (y / x));
} else if (x <= 6100.0) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 + ((x + (-1.0d0)) / y)
t_1 = x / (x + 1.0d0)
if (x <= (-520000000000.0d0)) then
tmp = t_0
else if (x <= 9.5d-44) then
tmp = t_1
else if (x <= 15.0d0) then
tmp = x / (y + (y / x))
else if (x <= 6100.0d0) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 + ((x + -1.0) / y);
double t_1 = x / (x + 1.0);
double tmp;
if (x <= -520000000000.0) {
tmp = t_0;
} else if (x <= 9.5e-44) {
tmp = t_1;
} else if (x <= 15.0) {
tmp = x / (y + (y / x));
} else if (x <= 6100.0) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + ((x + -1.0) / y) t_1 = x / (x + 1.0) tmp = 0 if x <= -520000000000.0: tmp = t_0 elif x <= 9.5e-44: tmp = t_1 elif x <= 15.0: tmp = x / (y + (y / x)) elif x <= 6100.0: tmp = t_1 else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(Float64(x + -1.0) / y)) t_1 = Float64(x / Float64(x + 1.0)) tmp = 0.0 if (x <= -520000000000.0) tmp = t_0; elseif (x <= 9.5e-44) tmp = t_1; elseif (x <= 15.0) tmp = Float64(x / Float64(y + Float64(y / x))); elseif (x <= 6100.0) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + ((x + -1.0) / y); t_1 = x / (x + 1.0); tmp = 0.0; if (x <= -520000000000.0) tmp = t_0; elseif (x <= 9.5e-44) tmp = t_1; elseif (x <= 15.0) tmp = x / (y + (y / x)); elseif (x <= 6100.0) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -520000000000.0], t$95$0, If[LessEqual[x, 9.5e-44], t$95$1, If[LessEqual[x, 15.0], N[(x / N[(y + N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 6100.0], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{x + -1}{y}\\
t_1 := \frac{x}{x + 1}\\
\mathbf{if}\;x \leq -520000000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{-44}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 15:\\
\;\;\;\;\frac{x}{y + \frac{y}{x}}\\
\mathbf{elif}\;x \leq 6100:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -5.2e11 or 6100 < x Initial program 72.8%
Taylor expanded in x around inf 98.7%
Taylor expanded in y around -inf 98.7%
mul-1-neg98.7%
unsub-neg98.7%
neg-mul-198.7%
unsub-neg98.7%
Simplified98.7%
if -5.2e11 < x < 9.49999999999999924e-44 or 15 < x < 6100Initial program 99.9%
Taylor expanded in y around inf 79.9%
+-commutative79.9%
Simplified79.9%
if 9.49999999999999924e-44 < x < 15Initial program 99.7%
*-commutative99.7%
associate-/l*99.7%
metadata-eval99.7%
sub-neg99.7%
div-sub99.7%
*-inverses99.7%
Simplified99.7%
Taylor expanded in y around 0 71.9%
distribute-lft-in71.9%
*-rgt-identity71.9%
associate-*r/71.9%
*-rgt-identity71.9%
Simplified71.9%
Final simplification87.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (+ x 1.0))))
(if (<= x -4.4e+44)
(/ x y)
(if (<= x 2e-41)
t_0
(if (<= x 5e-18) (* x (/ x y)) (if (<= x 26500000.0) t_0 (/ x y)))))))
double code(double x, double y) {
double t_0 = x / (x + 1.0);
double tmp;
if (x <= -4.4e+44) {
tmp = x / y;
} else if (x <= 2e-41) {
tmp = t_0;
} else if (x <= 5e-18) {
tmp = x * (x / y);
} else if (x <= 26500000.0) {
tmp = t_0;
} else {
tmp = x / y;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = x / (x + 1.0d0)
if (x <= (-4.4d+44)) then
tmp = x / y
else if (x <= 2d-41) then
tmp = t_0
else if (x <= 5d-18) then
tmp = x * (x / y)
else if (x <= 26500000.0d0) then
tmp = t_0
else
tmp = x / y
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x / (x + 1.0);
double tmp;
if (x <= -4.4e+44) {
tmp = x / y;
} else if (x <= 2e-41) {
tmp = t_0;
} else if (x <= 5e-18) {
tmp = x * (x / y);
} else if (x <= 26500000.0) {
tmp = t_0;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y): t_0 = x / (x + 1.0) tmp = 0 if x <= -4.4e+44: tmp = x / y elif x <= 2e-41: tmp = t_0 elif x <= 5e-18: tmp = x * (x / y) elif x <= 26500000.0: tmp = t_0 else: tmp = x / y return tmp
function code(x, y) t_0 = Float64(x / Float64(x + 1.0)) tmp = 0.0 if (x <= -4.4e+44) tmp = Float64(x / y); elseif (x <= 2e-41) tmp = t_0; elseif (x <= 5e-18) tmp = Float64(x * Float64(x / y)); elseif (x <= 26500000.0) tmp = t_0; else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y) t_0 = x / (x + 1.0); tmp = 0.0; if (x <= -4.4e+44) tmp = x / y; elseif (x <= 2e-41) tmp = t_0; elseif (x <= 5e-18) tmp = x * (x / y); elseif (x <= 26500000.0) tmp = t_0; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4.4e+44], N[(x / y), $MachinePrecision], If[LessEqual[x, 2e-41], t$95$0, If[LessEqual[x, 5e-18], N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 26500000.0], t$95$0, N[(x / y), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{x + 1}\\
\mathbf{if}\;x \leq -4.4 \cdot 10^{+44}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq 2 \cdot 10^{-41}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 5 \cdot 10^{-18}:\\
\;\;\;\;x \cdot \frac{x}{y}\\
\mathbf{elif}\;x \leq 26500000:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -4.39999999999999991e44 or 2.65e7 < x Initial program 70.5%
Taylor expanded in x around inf 87.6%
if -4.39999999999999991e44 < x < 2.00000000000000001e-41 or 5.00000000000000036e-18 < x < 2.65e7Initial program 99.4%
Taylor expanded in y around inf 77.8%
+-commutative77.8%
Simplified77.8%
if 2.00000000000000001e-41 < x < 5.00000000000000036e-18Initial program 99.8%
*-commutative99.8%
associate-/l*99.6%
metadata-eval99.6%
sub-neg99.6%
div-sub99.6%
*-inverses99.6%
Simplified99.6%
Taylor expanded in y around 0 78.1%
distribute-lft-in78.1%
*-rgt-identity78.1%
associate-*r/78.1%
*-rgt-identity78.1%
Simplified78.1%
Taylor expanded in x around 0 78.1%
associate-/r/78.1%
Applied egg-rr78.1%
Final simplification81.7%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (+ x 1.0))))
(if (<= x -4.3e+42)
(/ x y)
(if (<= x 7e-42)
t_0
(if (<= x 5e-13)
(* x (/ x y))
(if (<= x 12800000.0) t_0 (/ (+ x -1.0) y)))))))
double code(double x, double y) {
double t_0 = x / (x + 1.0);
double tmp;
if (x <= -4.3e+42) {
tmp = x / y;
} else if (x <= 7e-42) {
tmp = t_0;
} else if (x <= 5e-13) {
tmp = x * (x / y);
} else if (x <= 12800000.0) {
tmp = t_0;
} else {
tmp = (x + -1.0) / y;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = x / (x + 1.0d0)
if (x <= (-4.3d+42)) then
tmp = x / y
else if (x <= 7d-42) then
tmp = t_0
else if (x <= 5d-13) then
tmp = x * (x / y)
else if (x <= 12800000.0d0) then
tmp = t_0
else
tmp = (x + (-1.0d0)) / y
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x / (x + 1.0);
double tmp;
if (x <= -4.3e+42) {
tmp = x / y;
} else if (x <= 7e-42) {
tmp = t_0;
} else if (x <= 5e-13) {
tmp = x * (x / y);
} else if (x <= 12800000.0) {
tmp = t_0;
} else {
tmp = (x + -1.0) / y;
}
return tmp;
}
def code(x, y): t_0 = x / (x + 1.0) tmp = 0 if x <= -4.3e+42: tmp = x / y elif x <= 7e-42: tmp = t_0 elif x <= 5e-13: tmp = x * (x / y) elif x <= 12800000.0: tmp = t_0 else: tmp = (x + -1.0) / y return tmp
function code(x, y) t_0 = Float64(x / Float64(x + 1.0)) tmp = 0.0 if (x <= -4.3e+42) tmp = Float64(x / y); elseif (x <= 7e-42) tmp = t_0; elseif (x <= 5e-13) tmp = Float64(x * Float64(x / y)); elseif (x <= 12800000.0) tmp = t_0; else tmp = Float64(Float64(x + -1.0) / y); end return tmp end
function tmp_2 = code(x, y) t_0 = x / (x + 1.0); tmp = 0.0; if (x <= -4.3e+42) tmp = x / y; elseif (x <= 7e-42) tmp = t_0; elseif (x <= 5e-13) tmp = x * (x / y); elseif (x <= 12800000.0) tmp = t_0; else tmp = (x + -1.0) / y; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4.3e+42], N[(x / y), $MachinePrecision], If[LessEqual[x, 7e-42], t$95$0, If[LessEqual[x, 5e-13], N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 12800000.0], t$95$0, N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{x + 1}\\
\mathbf{if}\;x \leq -4.3 \cdot 10^{+42}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq 7 \cdot 10^{-42}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 5 \cdot 10^{-13}:\\
\;\;\;\;x \cdot \frac{x}{y}\\
\mathbf{elif}\;x \leq 12800000:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x + -1}{y}\\
\end{array}
\end{array}
if x < -4.2999999999999998e42Initial program 73.6%
Taylor expanded in x around inf 86.5%
if -4.2999999999999998e42 < x < 7.0000000000000004e-42 or 4.9999999999999999e-13 < x < 1.28e7Initial program 99.4%
Taylor expanded in y around inf 77.8%
+-commutative77.8%
Simplified77.8%
if 7.0000000000000004e-42 < x < 4.9999999999999999e-13Initial program 99.8%
*-commutative99.8%
associate-/l*99.6%
metadata-eval99.6%
sub-neg99.6%
div-sub99.6%
*-inverses99.6%
Simplified99.6%
Taylor expanded in y around 0 78.1%
distribute-lft-in78.1%
*-rgt-identity78.1%
associate-*r/78.1%
*-rgt-identity78.1%
Simplified78.1%
Taylor expanded in x around 0 78.1%
associate-/r/78.1%
Applied egg-rr78.1%
if 1.28e7 < x Initial program 67.8%
*-commutative67.8%
associate-/l*100.0%
metadata-eval100.0%
sub-neg100.0%
div-sub100.0%
*-inverses100.0%
Simplified100.0%
Taylor expanded in y around 0 89.2%
distribute-lft-in89.3%
*-rgt-identity89.3%
associate-*r/89.3%
*-rgt-identity89.3%
Simplified89.3%
Taylor expanded in x around inf 89.2%
Taylor expanded in y around 0 89.2%
Final simplification81.8%
(FPCore (x y) :precision binary64 (if (<= x -1.05e+47) (/ x y) (if (<= x -1.0) 1.0 (if (<= x 1520.0) x (/ x y)))))
double code(double x, double y) {
double tmp;
if (x <= -1.05e+47) {
tmp = x / y;
} else if (x <= -1.0) {
tmp = 1.0;
} else if (x <= 1520.0) {
tmp = x;
} else {
tmp = x / y;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.05d+47)) then
tmp = x / y
else if (x <= (-1.0d0)) then
tmp = 1.0d0
else if (x <= 1520.0d0) then
tmp = x
else
tmp = x / y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -1.05e+47) {
tmp = x / y;
} else if (x <= -1.0) {
tmp = 1.0;
} else if (x <= 1520.0) {
tmp = x;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.05e+47: tmp = x / y elif x <= -1.0: tmp = 1.0 elif x <= 1520.0: tmp = x else: tmp = x / y return tmp
function code(x, y) tmp = 0.0 if (x <= -1.05e+47) tmp = Float64(x / y); elseif (x <= -1.0) tmp = 1.0; elseif (x <= 1520.0) tmp = x; else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1.05e+47) tmp = x / y; elseif (x <= -1.0) tmp = 1.0; elseif (x <= 1520.0) tmp = x; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.05e+47], N[(x / y), $MachinePrecision], If[LessEqual[x, -1.0], 1.0, If[LessEqual[x, 1520.0], x, N[(x / y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.05 \cdot 10^{+47}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq -1:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1520:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -1.05e47 or 1520 < x Initial program 71.3%
Taylor expanded in x around inf 85.7%
if -1.05e47 < x < -1Initial program 93.5%
Taylor expanded in y around inf 70.1%
+-commutative70.1%
Simplified70.1%
clear-num70.1%
inv-pow70.1%
+-commutative70.1%
Applied egg-rr70.1%
unpow-170.1%
+-commutative70.1%
Simplified70.1%
Taylor expanded in x around inf 60.0%
if -1 < x < 1520Initial program 99.9%
Taylor expanded in x around 0 73.0%
Final simplification77.5%
(FPCore (x y) :precision binary64 (if (<= x -1.0) 1.0 (if (<= x 1.0) x 1.0)))
double code(double x, double y) {
double tmp;
if (x <= -1.0) {
tmp = 1.0;
} else if (x <= 1.0) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.0d0)) then
tmp = 1.0d0
else if (x <= 1.0d0) then
tmp = x
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -1.0) {
tmp = 1.0;
} else if (x <= 1.0) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.0: tmp = 1.0 elif x <= 1.0: tmp = x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (x <= -1.0) tmp = 1.0; elseif (x <= 1.0) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1.0) tmp = 1.0; elseif (x <= 1.0) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.0], 1.0, If[LessEqual[x, 1.0], x, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -1 or 1 < x Initial program 74.6%
Taylor expanded in y around inf 22.0%
+-commutative22.0%
Simplified22.0%
clear-num22.0%
inv-pow22.0%
+-commutative22.0%
Applied egg-rr22.0%
unpow-122.0%
+-commutative22.0%
Simplified22.0%
Taylor expanded in x around inf 18.8%
if -1 < x < 1Initial program 99.9%
Taylor expanded in x around 0 74.9%
Final simplification48.4%
(FPCore (x y) :precision binary64 (/ (+ (/ x y) 1.0) (- 1.0 (/ -1.0 x))))
double code(double x, double y) {
return ((x / y) + 1.0) / (1.0 - (-1.0 / x));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x / y) + 1.0d0) / (1.0d0 - ((-1.0d0) / x))
end function
public static double code(double x, double y) {
return ((x / y) + 1.0) / (1.0 - (-1.0 / x));
}
def code(x, y): return ((x / y) + 1.0) / (1.0 - (-1.0 / x))
function code(x, y) return Float64(Float64(Float64(x / y) + 1.0) / Float64(1.0 - Float64(-1.0 / x))) end
function tmp = code(x, y) tmp = ((x / y) + 1.0) / (1.0 - (-1.0 / x)); end
code[x_, y_] := N[(N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision] / N[(1.0 - N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{x}{y} + 1}{1 - \frac{-1}{x}}
\end{array}
Initial program 88.0%
*-commutative88.0%
associate-/l*99.8%
metadata-eval99.8%
sub-neg99.8%
div-sub99.8%
*-inverses99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y) :precision binary64 1.0)
double code(double x, double y) {
return 1.0;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0
end function
public static double code(double x, double y) {
return 1.0;
}
def code(x, y): return 1.0
function code(x, y) return 1.0 end
function tmp = code(x, y) tmp = 1.0; end
code[x_, y_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 88.0%
Taylor expanded in y around inf 50.7%
+-commutative50.7%
Simplified50.7%
clear-num50.6%
inv-pow50.6%
+-commutative50.6%
Applied egg-rr50.6%
unpow-150.6%
+-commutative50.6%
Simplified50.6%
Taylor expanded in x around inf 10.8%
Final simplification10.8%
(FPCore (x y) :precision binary64 (* (/ x 1.0) (/ (+ (/ x y) 1.0) (+ x 1.0))))
double code(double x, double y) {
return (x / 1.0) * (((x / y) + 1.0) / (x + 1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x / 1.0d0) * (((x / y) + 1.0d0) / (x + 1.0d0))
end function
public static double code(double x, double y) {
return (x / 1.0) * (((x / y) + 1.0) / (x + 1.0));
}
def code(x, y): return (x / 1.0) * (((x / y) + 1.0) / (x + 1.0))
function code(x, y) return Float64(Float64(x / 1.0) * Float64(Float64(Float64(x / y) + 1.0) / Float64(x + 1.0))) end
function tmp = code(x, y) tmp = (x / 1.0) * (((x / y) + 1.0) / (x + 1.0)); end
code[x_, y_] := N[(N[(x / 1.0), $MachinePrecision] * N[(N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{1} \cdot \frac{\frac{x}{y} + 1}{x + 1}
\end{array}
herbie shell --seed 2024034
(FPCore (x y)
:name "Codec.Picture.Types:toneMapping from JuicyPixels-3.2.6.1"
:precision binary64
:herbie-target
(* (/ x 1.0) (/ (+ (/ x y) 1.0) (+ x 1.0)))
(/ (* x (+ (/ x y) 1.0)) (+ x 1.0)))