
(FPCore (x y) :precision binary64 (/ (- x y) (- 2.0 (+ x y))))
double code(double x, double y) {
return (x - y) / (2.0 - (x + y));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x - y) / (2.0d0 - (x + y))
end function
public static double code(double x, double y) {
return (x - y) / (2.0 - (x + y));
}
def code(x, y): return (x - y) / (2.0 - (x + y))
function code(x, y) return Float64(Float64(x - y) / Float64(2.0 - Float64(x + y))) end
function tmp = code(x, y) tmp = (x - y) / (2.0 - (x + y)); end
code[x_, y_] := N[(N[(x - y), $MachinePrecision] / N[(2.0 - N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{2 - \left(x + y\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (- x y) (- 2.0 (+ x y))))
double code(double x, double y) {
return (x - y) / (2.0 - (x + y));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x - y) / (2.0d0 - (x + y))
end function
public static double code(double x, double y) {
return (x - y) / (2.0 - (x + y));
}
def code(x, y): return (x - y) / (2.0 - (x + y))
function code(x, y) return Float64(Float64(x - y) / Float64(2.0 - Float64(x + y))) end
function tmp = code(x, y) tmp = (x - y) / (2.0 - (x + y)); end
code[x_, y_] := N[(N[(x - y), $MachinePrecision] / N[(2.0 - N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{2 - \left(x + y\right)}
\end{array}
(FPCore (x y) :precision binary64 (/ (- x y) (- 2.0 (+ x y))))
double code(double x, double y) {
return (x - y) / (2.0 - (x + y));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x - y) / (2.0d0 - (x + y))
end function
public static double code(double x, double y) {
return (x - y) / (2.0 - (x + y));
}
def code(x, y): return (x - y) / (2.0 - (x + y))
function code(x, y) return Float64(Float64(x - y) / Float64(2.0 - Float64(x + y))) end
function tmp = code(x, y) tmp = (x - y) / (2.0 - (x + y)); end
code[x_, y_] := N[(N[(x - y), $MachinePrecision] / N[(2.0 - N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{2 - \left(x + y\right)}
\end{array}
Initial program 100.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (- x y) (- 2.0 y))))
(if (<= y -3e+106)
(/ (- y x) y)
(if (<= y -9.6e+83)
(/ x (- (- y) x))
(if (<= y -9e-12) t_0 (if (<= y 7.8e+26) (/ (- x y) (- 2.0 x)) t_0))))))
double code(double x, double y) {
double t_0 = (x - y) / (2.0 - y);
double tmp;
if (y <= -3e+106) {
tmp = (y - x) / y;
} else if (y <= -9.6e+83) {
tmp = x / (-y - x);
} else if (y <= -9e-12) {
tmp = t_0;
} else if (y <= 7.8e+26) {
tmp = (x - y) / (2.0 - x);
} 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) :: tmp
t_0 = (x - y) / (2.0d0 - y)
if (y <= (-3d+106)) then
tmp = (y - x) / y
else if (y <= (-9.6d+83)) then
tmp = x / (-y - x)
else if (y <= (-9d-12)) then
tmp = t_0
else if (y <= 7.8d+26) then
tmp = (x - y) / (2.0d0 - x)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (x - y) / (2.0 - y);
double tmp;
if (y <= -3e+106) {
tmp = (y - x) / y;
} else if (y <= -9.6e+83) {
tmp = x / (-y - x);
} else if (y <= -9e-12) {
tmp = t_0;
} else if (y <= 7.8e+26) {
tmp = (x - y) / (2.0 - x);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = (x - y) / (2.0 - y) tmp = 0 if y <= -3e+106: tmp = (y - x) / y elif y <= -9.6e+83: tmp = x / (-y - x) elif y <= -9e-12: tmp = t_0 elif y <= 7.8e+26: tmp = (x - y) / (2.0 - x) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(Float64(x - y) / Float64(2.0 - y)) tmp = 0.0 if (y <= -3e+106) tmp = Float64(Float64(y - x) / y); elseif (y <= -9.6e+83) tmp = Float64(x / Float64(Float64(-y) - x)); elseif (y <= -9e-12) tmp = t_0; elseif (y <= 7.8e+26) tmp = Float64(Float64(x - y) / Float64(2.0 - x)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = (x - y) / (2.0 - y); tmp = 0.0; if (y <= -3e+106) tmp = (y - x) / y; elseif (y <= -9.6e+83) tmp = x / (-y - x); elseif (y <= -9e-12) tmp = t_0; elseif (y <= 7.8e+26) tmp = (x - y) / (2.0 - x); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(x - y), $MachinePrecision] / N[(2.0 - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3e+106], N[(N[(y - x), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[y, -9.6e+83], N[(x / N[((-y) - x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -9e-12], t$95$0, If[LessEqual[y, 7.8e+26], N[(N[(x - y), $MachinePrecision] / N[(2.0 - x), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x - y}{2 - y}\\
\mathbf{if}\;y \leq -3 \cdot 10^{+106}:\\
\;\;\;\;\frac{y - x}{y}\\
\mathbf{elif}\;y \leq -9.6 \cdot 10^{+83}:\\
\;\;\;\;\frac{x}{\left(-y\right) - x}\\
\mathbf{elif}\;y \leq -9 \cdot 10^{-12}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 7.8 \cdot 10^{+26}:\\
\;\;\;\;\frac{x - y}{2 - x}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -3.0000000000000001e106Initial program 100.0%
Simplified0
Taylor expanded in x around 0 0
Simplified0
Taylor expanded in y around inf 0
Simplified0
Applied egg-rr0
if -3.0000000000000001e106 < y < -9.59999999999999965e83Initial program 100.0%
Simplified0
Taylor expanded in x around inf 0
Simplified0
Taylor expanded in y around inf 0
Simplified0
if -9.59999999999999965e83 < y < -8.99999999999999962e-12 or 7.8e26 < y Initial program 99.9%
Simplified0
Taylor expanded in x around 0 0
Simplified0
if -8.99999999999999962e-12 < y < 7.8e26Initial program 100.0%
Simplified0
Taylor expanded in y around 0 0
Simplified0
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (- y x) y)))
(if (<= y -3.05e+106)
t_0
(if (<= y -1.05e+84)
(/ x (- (- y) x))
(if (<= y -9e-12)
(/ y (+ y -2.0))
(if (<= y 1.35e+35) (/ (- x y) (- 2.0 x)) t_0))))))
double code(double x, double y) {
double t_0 = (y - x) / y;
double tmp;
if (y <= -3.05e+106) {
tmp = t_0;
} else if (y <= -1.05e+84) {
tmp = x / (-y - x);
} else if (y <= -9e-12) {
tmp = y / (y + -2.0);
} else if (y <= 1.35e+35) {
tmp = (x - y) / (2.0 - x);
} 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) :: tmp
t_0 = (y - x) / y
if (y <= (-3.05d+106)) then
tmp = t_0
else if (y <= (-1.05d+84)) then
tmp = x / (-y - x)
else if (y <= (-9d-12)) then
tmp = y / (y + (-2.0d0))
else if (y <= 1.35d+35) then
tmp = (x - y) / (2.0d0 - x)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (y - x) / y;
double tmp;
if (y <= -3.05e+106) {
tmp = t_0;
} else if (y <= -1.05e+84) {
tmp = x / (-y - x);
} else if (y <= -9e-12) {
tmp = y / (y + -2.0);
} else if (y <= 1.35e+35) {
tmp = (x - y) / (2.0 - x);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = (y - x) / y tmp = 0 if y <= -3.05e+106: tmp = t_0 elif y <= -1.05e+84: tmp = x / (-y - x) elif y <= -9e-12: tmp = y / (y + -2.0) elif y <= 1.35e+35: tmp = (x - y) / (2.0 - x) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(Float64(y - x) / y) tmp = 0.0 if (y <= -3.05e+106) tmp = t_0; elseif (y <= -1.05e+84) tmp = Float64(x / Float64(Float64(-y) - x)); elseif (y <= -9e-12) tmp = Float64(y / Float64(y + -2.0)); elseif (y <= 1.35e+35) tmp = Float64(Float64(x - y) / Float64(2.0 - x)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = (y - x) / y; tmp = 0.0; if (y <= -3.05e+106) tmp = t_0; elseif (y <= -1.05e+84) tmp = x / (-y - x); elseif (y <= -9e-12) tmp = y / (y + -2.0); elseif (y <= 1.35e+35) tmp = (x - y) / (2.0 - x); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(y - x), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[y, -3.05e+106], t$95$0, If[LessEqual[y, -1.05e+84], N[(x / N[((-y) - x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -9e-12], N[(y / N[(y + -2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.35e+35], N[(N[(x - y), $MachinePrecision] / N[(2.0 - x), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y - x}{y}\\
\mathbf{if}\;y \leq -3.05 \cdot 10^{+106}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -1.05 \cdot 10^{+84}:\\
\;\;\;\;\frac{x}{\left(-y\right) - x}\\
\mathbf{elif}\;y \leq -9 \cdot 10^{-12}:\\
\;\;\;\;\frac{y}{y + -2}\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+35}:\\
\;\;\;\;\frac{x - y}{2 - x}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -3.05e106 or 1.35000000000000001e35 < y Initial program 100.0%
Simplified0
Taylor expanded in x around 0 0
Simplified0
Taylor expanded in y around inf 0
Simplified0
Applied egg-rr0
if -3.05e106 < y < -1.05000000000000009e84Initial program 100.0%
Simplified0
Taylor expanded in x around inf 0
Simplified0
Taylor expanded in y around inf 0
Simplified0
if -1.05000000000000009e84 < y < -8.99999999999999962e-12Initial program 99.7%
Simplified0
Taylor expanded in x around 0 0
Simplified0
if -8.99999999999999962e-12 < y < 1.35000000000000001e35Initial program 100.0%
Simplified0
Taylor expanded in y around 0 0
Simplified0
(FPCore (x y)
:precision binary64
(if (<= y -3.8e+108)
1.0
(if (<= y -5.8e+83)
(+ -1.0 (/ y x))
(if (<= y -2.0)
1.0
(if (<= y -3e-131) (* y -0.5) (if (<= y 4.2e+29) -1.0 1.0))))))
double code(double x, double y) {
double tmp;
if (y <= -3.8e+108) {
tmp = 1.0;
} else if (y <= -5.8e+83) {
tmp = -1.0 + (y / x);
} else if (y <= -2.0) {
tmp = 1.0;
} else if (y <= -3e-131) {
tmp = y * -0.5;
} else if (y <= 4.2e+29) {
tmp = -1.0;
} 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 (y <= (-3.8d+108)) then
tmp = 1.0d0
else if (y <= (-5.8d+83)) then
tmp = (-1.0d0) + (y / x)
else if (y <= (-2.0d0)) then
tmp = 1.0d0
else if (y <= (-3d-131)) then
tmp = y * (-0.5d0)
else if (y <= 4.2d+29) then
tmp = -1.0d0
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -3.8e+108) {
tmp = 1.0;
} else if (y <= -5.8e+83) {
tmp = -1.0 + (y / x);
} else if (y <= -2.0) {
tmp = 1.0;
} else if (y <= -3e-131) {
tmp = y * -0.5;
} else if (y <= 4.2e+29) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -3.8e+108: tmp = 1.0 elif y <= -5.8e+83: tmp = -1.0 + (y / x) elif y <= -2.0: tmp = 1.0 elif y <= -3e-131: tmp = y * -0.5 elif y <= 4.2e+29: tmp = -1.0 else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -3.8e+108) tmp = 1.0; elseif (y <= -5.8e+83) tmp = Float64(-1.0 + Float64(y / x)); elseif (y <= -2.0) tmp = 1.0; elseif (y <= -3e-131) tmp = Float64(y * -0.5); elseif (y <= 4.2e+29) tmp = -1.0; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -3.8e+108) tmp = 1.0; elseif (y <= -5.8e+83) tmp = -1.0 + (y / x); elseif (y <= -2.0) tmp = 1.0; elseif (y <= -3e-131) tmp = y * -0.5; elseif (y <= 4.2e+29) tmp = -1.0; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -3.8e+108], 1.0, If[LessEqual[y, -5.8e+83], N[(-1.0 + N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -2.0], 1.0, If[LessEqual[y, -3e-131], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 4.2e+29], -1.0, 1.0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.8 \cdot 10^{+108}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -5.8 \cdot 10^{+83}:\\
\;\;\;\;-1 + \frac{y}{x}\\
\mathbf{elif}\;y \leq -2:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -3 \cdot 10^{-131}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{+29}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -3.80000000000000008e108 or -5.79999999999999999e83 < y < -2 or 4.2000000000000003e29 < y Initial program 99.9%
Simplified0
Taylor expanded in y around inf 0
Simplified0
if -3.80000000000000008e108 < y < -5.79999999999999999e83Initial program 100.0%
Simplified0
Taylor expanded in x around inf 0
Simplified0
Taylor expanded in y around inf 0
Simplified0
Taylor expanded in x around inf 0
Simplified0
if -2 < y < -2.99999999999999996e-131Initial program 99.9%
Simplified0
Taylor expanded in x around 0 0
Simplified0
Taylor expanded in y around 0 0
Simplified0
Taylor expanded in x around 0 0
Simplified0
if -2.99999999999999996e-131 < y < 4.2000000000000003e29Initial program 100.0%
Simplified0
Taylor expanded in x around inf 0
Simplified0
(FPCore (x y)
:precision binary64
(if (<= y -1e+107)
1.0
(if (<= y -3e+83)
-1.0
(if (<= y -2.0)
1.0
(if (<= y -6.8e-133) (* y -0.5) (if (<= y 2e+27) -1.0 1.0))))))
double code(double x, double y) {
double tmp;
if (y <= -1e+107) {
tmp = 1.0;
} else if (y <= -3e+83) {
tmp = -1.0;
} else if (y <= -2.0) {
tmp = 1.0;
} else if (y <= -6.8e-133) {
tmp = y * -0.5;
} else if (y <= 2e+27) {
tmp = -1.0;
} 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 (y <= (-1d+107)) then
tmp = 1.0d0
else if (y <= (-3d+83)) then
tmp = -1.0d0
else if (y <= (-2.0d0)) then
tmp = 1.0d0
else if (y <= (-6.8d-133)) then
tmp = y * (-0.5d0)
else if (y <= 2d+27) then
tmp = -1.0d0
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1e+107) {
tmp = 1.0;
} else if (y <= -3e+83) {
tmp = -1.0;
} else if (y <= -2.0) {
tmp = 1.0;
} else if (y <= -6.8e-133) {
tmp = y * -0.5;
} else if (y <= 2e+27) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1e+107: tmp = 1.0 elif y <= -3e+83: tmp = -1.0 elif y <= -2.0: tmp = 1.0 elif y <= -6.8e-133: tmp = y * -0.5 elif y <= 2e+27: tmp = -1.0 else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -1e+107) tmp = 1.0; elseif (y <= -3e+83) tmp = -1.0; elseif (y <= -2.0) tmp = 1.0; elseif (y <= -6.8e-133) tmp = Float64(y * -0.5); elseif (y <= 2e+27) tmp = -1.0; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1e+107) tmp = 1.0; elseif (y <= -3e+83) tmp = -1.0; elseif (y <= -2.0) tmp = 1.0; elseif (y <= -6.8e-133) tmp = y * -0.5; elseif (y <= 2e+27) tmp = -1.0; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1e+107], 1.0, If[LessEqual[y, -3e+83], -1.0, If[LessEqual[y, -2.0], 1.0, If[LessEqual[y, -6.8e-133], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 2e+27], -1.0, 1.0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \cdot 10^{+107}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -3 \cdot 10^{+83}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq -2:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -6.8 \cdot 10^{-133}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+27}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -9.9999999999999997e106 or -3e83 < y < -2 or 2e27 < y Initial program 99.9%
Simplified0
Taylor expanded in y around inf 0
Simplified0
if -9.9999999999999997e106 < y < -3e83 or -6.80000000000000012e-133 < y < 2e27Initial program 100.0%
Simplified0
Taylor expanded in x around inf 0
Simplified0
if -2 < y < -6.80000000000000012e-133Initial program 99.9%
Simplified0
Taylor expanded in x around 0 0
Simplified0
Taylor expanded in y around 0 0
Simplified0
Taylor expanded in x around 0 0
Simplified0
(FPCore (x y)
:precision binary64
(if (<= y -7.2e+111)
1.0
(if (<= y -6.6e+81)
(+ -1.0 (/ y x))
(if (<= y -9e-12) 1.0 (if (<= y 2.1e+37) (/ x (- 2.0 x)) 1.0)))))
double code(double x, double y) {
double tmp;
if (y <= -7.2e+111) {
tmp = 1.0;
} else if (y <= -6.6e+81) {
tmp = -1.0 + (y / x);
} else if (y <= -9e-12) {
tmp = 1.0;
} else if (y <= 2.1e+37) {
tmp = x / (2.0 - 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 (y <= (-7.2d+111)) then
tmp = 1.0d0
else if (y <= (-6.6d+81)) then
tmp = (-1.0d0) + (y / x)
else if (y <= (-9d-12)) then
tmp = 1.0d0
else if (y <= 2.1d+37) then
tmp = x / (2.0d0 - x)
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -7.2e+111) {
tmp = 1.0;
} else if (y <= -6.6e+81) {
tmp = -1.0 + (y / x);
} else if (y <= -9e-12) {
tmp = 1.0;
} else if (y <= 2.1e+37) {
tmp = x / (2.0 - x);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -7.2e+111: tmp = 1.0 elif y <= -6.6e+81: tmp = -1.0 + (y / x) elif y <= -9e-12: tmp = 1.0 elif y <= 2.1e+37: tmp = x / (2.0 - x) else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -7.2e+111) tmp = 1.0; elseif (y <= -6.6e+81) tmp = Float64(-1.0 + Float64(y / x)); elseif (y <= -9e-12) tmp = 1.0; elseif (y <= 2.1e+37) tmp = Float64(x / Float64(2.0 - x)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -7.2e+111) tmp = 1.0; elseif (y <= -6.6e+81) tmp = -1.0 + (y / x); elseif (y <= -9e-12) tmp = 1.0; elseif (y <= 2.1e+37) tmp = x / (2.0 - x); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -7.2e+111], 1.0, If[LessEqual[y, -6.6e+81], N[(-1.0 + N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -9e-12], 1.0, If[LessEqual[y, 2.1e+37], N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision], 1.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.2 \cdot 10^{+111}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -6.6 \cdot 10^{+81}:\\
\;\;\;\;-1 + \frac{y}{x}\\
\mathbf{elif}\;y \leq -9 \cdot 10^{-12}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 2.1 \cdot 10^{+37}:\\
\;\;\;\;\frac{x}{2 - x}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -7.2000000000000004e111 or -6.6e81 < y < -8.99999999999999962e-12 or 2.1000000000000001e37 < y Initial program 99.9%
Simplified0
Taylor expanded in y around inf 0
Simplified0
if -7.2000000000000004e111 < y < -6.6e81Initial program 100.0%
Simplified0
Taylor expanded in x around inf 0
Simplified0
Taylor expanded in y around inf 0
Simplified0
Taylor expanded in x around inf 0
Simplified0
if -8.99999999999999962e-12 < y < 2.1000000000000001e37Initial program 100.0%
Simplified0
Taylor expanded in y around 0 0
Simplified0
(FPCore (x y)
:precision binary64
(if (<= y -3e+106)
1.0
(if (<= y -5.8e+83)
-1.0
(if (<= y -9e-12) 1.0 (if (<= y 1e+37) -1.0 1.0)))))
double code(double x, double y) {
double tmp;
if (y <= -3e+106) {
tmp = 1.0;
} else if (y <= -5.8e+83) {
tmp = -1.0;
} else if (y <= -9e-12) {
tmp = 1.0;
} else if (y <= 1e+37) {
tmp = -1.0;
} 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 (y <= (-3d+106)) then
tmp = 1.0d0
else if (y <= (-5.8d+83)) then
tmp = -1.0d0
else if (y <= (-9d-12)) then
tmp = 1.0d0
else if (y <= 1d+37) then
tmp = -1.0d0
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -3e+106) {
tmp = 1.0;
} else if (y <= -5.8e+83) {
tmp = -1.0;
} else if (y <= -9e-12) {
tmp = 1.0;
} else if (y <= 1e+37) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -3e+106: tmp = 1.0 elif y <= -5.8e+83: tmp = -1.0 elif y <= -9e-12: tmp = 1.0 elif y <= 1e+37: tmp = -1.0 else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -3e+106) tmp = 1.0; elseif (y <= -5.8e+83) tmp = -1.0; elseif (y <= -9e-12) tmp = 1.0; elseif (y <= 1e+37) tmp = -1.0; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -3e+106) tmp = 1.0; elseif (y <= -5.8e+83) tmp = -1.0; elseif (y <= -9e-12) tmp = 1.0; elseif (y <= 1e+37) tmp = -1.0; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -3e+106], 1.0, If[LessEqual[y, -5.8e+83], -1.0, If[LessEqual[y, -9e-12], 1.0, If[LessEqual[y, 1e+37], -1.0, 1.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3 \cdot 10^{+106}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -5.8 \cdot 10^{+83}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq -9 \cdot 10^{-12}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 10^{+37}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -3.0000000000000001e106 or -5.79999999999999999e83 < y < -8.99999999999999962e-12 or 9.99999999999999954e36 < y Initial program 99.9%
Simplified0
Taylor expanded in y around inf 0
Simplified0
if -3.0000000000000001e106 < y < -5.79999999999999999e83 or -8.99999999999999962e-12 < y < 9.99999999999999954e36Initial program 100.0%
Simplified0
Taylor expanded in x around inf 0
Simplified0
(FPCore (x y) :precision binary64 (if (<= x -1.52e+29) (/ x (- (- y) x)) (if (<= x 700.0) (/ y (+ y -2.0)) (/ x (- (- 2.0 y) x)))))
double code(double x, double y) {
double tmp;
if (x <= -1.52e+29) {
tmp = x / (-y - x);
} else if (x <= 700.0) {
tmp = y / (y + -2.0);
} else {
tmp = x / ((2.0 - y) - x);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.52d+29)) then
tmp = x / (-y - x)
else if (x <= 700.0d0) then
tmp = y / (y + (-2.0d0))
else
tmp = x / ((2.0d0 - y) - x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -1.52e+29) {
tmp = x / (-y - x);
} else if (x <= 700.0) {
tmp = y / (y + -2.0);
} else {
tmp = x / ((2.0 - y) - x);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.52e+29: tmp = x / (-y - x) elif x <= 700.0: tmp = y / (y + -2.0) else: tmp = x / ((2.0 - y) - x) return tmp
function code(x, y) tmp = 0.0 if (x <= -1.52e+29) tmp = Float64(x / Float64(Float64(-y) - x)); elseif (x <= 700.0) tmp = Float64(y / Float64(y + -2.0)); else tmp = Float64(x / Float64(Float64(2.0 - y) - x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1.52e+29) tmp = x / (-y - x); elseif (x <= 700.0) tmp = y / (y + -2.0); else tmp = x / ((2.0 - y) - x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.52e+29], N[(x / N[((-y) - x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 700.0], N[(y / N[(y + -2.0), $MachinePrecision]), $MachinePrecision], N[(x / N[(N[(2.0 - y), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.52 \cdot 10^{+29}:\\
\;\;\;\;\frac{x}{\left(-y\right) - x}\\
\mathbf{elif}\;x \leq 700:\\
\;\;\;\;\frac{y}{y + -2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\left(2 - y\right) - x}\\
\end{array}
\end{array}
if x < -1.52e29Initial program 99.9%
Simplified0
Taylor expanded in x around inf 0
Simplified0
Taylor expanded in y around inf 0
Simplified0
if -1.52e29 < x < 700Initial program 100.0%
Simplified0
Taylor expanded in x around 0 0
Simplified0
if 700 < x Initial program 100.0%
Simplified0
Taylor expanded in x around inf 0
Simplified0
(FPCore (x y) :precision binary64 (if (<= x -1.7e+31) (/ x (- (- y) x)) (if (<= x 880.0) (/ y (+ y -2.0)) (/ x (- 2.0 x)))))
double code(double x, double y) {
double tmp;
if (x <= -1.7e+31) {
tmp = x / (-y - x);
} else if (x <= 880.0) {
tmp = y / (y + -2.0);
} else {
tmp = x / (2.0 - x);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.7d+31)) then
tmp = x / (-y - x)
else if (x <= 880.0d0) then
tmp = y / (y + (-2.0d0))
else
tmp = x / (2.0d0 - x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -1.7e+31) {
tmp = x / (-y - x);
} else if (x <= 880.0) {
tmp = y / (y + -2.0);
} else {
tmp = x / (2.0 - x);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.7e+31: tmp = x / (-y - x) elif x <= 880.0: tmp = y / (y + -2.0) else: tmp = x / (2.0 - x) return tmp
function code(x, y) tmp = 0.0 if (x <= -1.7e+31) tmp = Float64(x / Float64(Float64(-y) - x)); elseif (x <= 880.0) tmp = Float64(y / Float64(y + -2.0)); else tmp = Float64(x / Float64(2.0 - x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1.7e+31) tmp = x / (-y - x); elseif (x <= 880.0) tmp = y / (y + -2.0); else tmp = x / (2.0 - x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.7e+31], N[(x / N[((-y) - x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 880.0], N[(y / N[(y + -2.0), $MachinePrecision]), $MachinePrecision], N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.7 \cdot 10^{+31}:\\
\;\;\;\;\frac{x}{\left(-y\right) - x}\\
\mathbf{elif}\;x \leq 880:\\
\;\;\;\;\frac{y}{y + -2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{2 - x}\\
\end{array}
\end{array}
if x < -1.6999999999999999e31Initial program 99.9%
Simplified0
Taylor expanded in x around inf 0
Simplified0
Taylor expanded in y around inf 0
Simplified0
if -1.6999999999999999e31 < x < 880Initial program 100.0%
Simplified0
Taylor expanded in x around 0 0
Simplified0
if 880 < x Initial program 100.0%
Simplified0
Taylor expanded in y around 0 0
Simplified0
(FPCore (x y) :precision binary64 (if (<= x -1.75e+31) (+ -1.0 (/ y x)) (if (<= x 820.0) (/ y (+ y -2.0)) (/ x (- 2.0 x)))))
double code(double x, double y) {
double tmp;
if (x <= -1.75e+31) {
tmp = -1.0 + (y / x);
} else if (x <= 820.0) {
tmp = y / (y + -2.0);
} else {
tmp = x / (2.0 - x);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.75d+31)) then
tmp = (-1.0d0) + (y / x)
else if (x <= 820.0d0) then
tmp = y / (y + (-2.0d0))
else
tmp = x / (2.0d0 - x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -1.75e+31) {
tmp = -1.0 + (y / x);
} else if (x <= 820.0) {
tmp = y / (y + -2.0);
} else {
tmp = x / (2.0 - x);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.75e+31: tmp = -1.0 + (y / x) elif x <= 820.0: tmp = y / (y + -2.0) else: tmp = x / (2.0 - x) return tmp
function code(x, y) tmp = 0.0 if (x <= -1.75e+31) tmp = Float64(-1.0 + Float64(y / x)); elseif (x <= 820.0) tmp = Float64(y / Float64(y + -2.0)); else tmp = Float64(x / Float64(2.0 - x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1.75e+31) tmp = -1.0 + (y / x); elseif (x <= 820.0) tmp = y / (y + -2.0); else tmp = x / (2.0 - x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.75e+31], N[(-1.0 + N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 820.0], N[(y / N[(y + -2.0), $MachinePrecision]), $MachinePrecision], N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.75 \cdot 10^{+31}:\\
\;\;\;\;-1 + \frac{y}{x}\\
\mathbf{elif}\;x \leq 820:\\
\;\;\;\;\frac{y}{y + -2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{2 - x}\\
\end{array}
\end{array}
if x < -1.75e31Initial program 99.9%
Simplified0
Taylor expanded in x around inf 0
Simplified0
Taylor expanded in y around inf 0
Simplified0
Taylor expanded in x around inf 0
Simplified0
if -1.75e31 < x < 820Initial program 100.0%
Simplified0
Taylor expanded in x around 0 0
Simplified0
if 820 < x Initial program 100.0%
Simplified0
Taylor expanded in y around 0 0
Simplified0
(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 100.0%
Simplified0
Taylor expanded in x around inf 0
Simplified0
(FPCore (x y) :precision binary64 (let* ((t_0 (- 2.0 (+ x y)))) (- (/ x t_0) (/ y t_0))))
double code(double x, double y) {
double t_0 = 2.0 - (x + y);
return (x / t_0) - (y / t_0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
t_0 = 2.0d0 - (x + y)
code = (x / t_0) - (y / t_0)
end function
public static double code(double x, double y) {
double t_0 = 2.0 - (x + y);
return (x / t_0) - (y / t_0);
}
def code(x, y): t_0 = 2.0 - (x + y) return (x / t_0) - (y / t_0)
function code(x, y) t_0 = Float64(2.0 - Float64(x + y)) return Float64(Float64(x / t_0) - Float64(y / t_0)) end
function tmp = code(x, y) t_0 = 2.0 - (x + y); tmp = (x / t_0) - (y / t_0); end
code[x_, y_] := Block[{t$95$0 = N[(2.0 - N[(x + y), $MachinePrecision]), $MachinePrecision]}, N[(N[(x / t$95$0), $MachinePrecision] - N[(y / t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 2 - \left(x + y\right)\\
\frac{x}{t\_0} - \frac{y}{t\_0}
\end{array}
\end{array}
herbie shell --seed 2024110
(FPCore (x y)
:name "Data.Colour.RGB:hslsv from colour-2.3.3, C"
:precision binary64
:alt
(- (/ x (- 2.0 (+ x y))) (/ y (- 2.0 (+ x y))))
(/ (- x y) (- 2.0 (+ x y))))