
(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 9 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
(if (<= y -1.56e+16)
1.0
(if (<= y 1.8e-284)
-1.0
(if (<= y 5e-252)
(* x 0.5)
(if (<= y 1.5e-71)
-1.0
(if (<= y 1.15e-45) (* y -0.5) (if (<= y 5700000000.0) -1.0 1.0)))))))
double code(double x, double y) {
double tmp;
if (y <= -1.56e+16) {
tmp = 1.0;
} else if (y <= 1.8e-284) {
tmp = -1.0;
} else if (y <= 5e-252) {
tmp = x * 0.5;
} else if (y <= 1.5e-71) {
tmp = -1.0;
} else if (y <= 1.15e-45) {
tmp = y * -0.5;
} else if (y <= 5700000000.0) {
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 <= (-1.56d+16)) then
tmp = 1.0d0
else if (y <= 1.8d-284) then
tmp = -1.0d0
else if (y <= 5d-252) then
tmp = x * 0.5d0
else if (y <= 1.5d-71) then
tmp = -1.0d0
else if (y <= 1.15d-45) then
tmp = y * (-0.5d0)
else if (y <= 5700000000.0d0) 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 <= -1.56e+16) {
tmp = 1.0;
} else if (y <= 1.8e-284) {
tmp = -1.0;
} else if (y <= 5e-252) {
tmp = x * 0.5;
} else if (y <= 1.5e-71) {
tmp = -1.0;
} else if (y <= 1.15e-45) {
tmp = y * -0.5;
} else if (y <= 5700000000.0) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.56e+16: tmp = 1.0 elif y <= 1.8e-284: tmp = -1.0 elif y <= 5e-252: tmp = x * 0.5 elif y <= 1.5e-71: tmp = -1.0 elif y <= 1.15e-45: tmp = y * -0.5 elif y <= 5700000000.0: tmp = -1.0 else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -1.56e+16) tmp = 1.0; elseif (y <= 1.8e-284) tmp = -1.0; elseif (y <= 5e-252) tmp = Float64(x * 0.5); elseif (y <= 1.5e-71) tmp = -1.0; elseif (y <= 1.15e-45) tmp = Float64(y * -0.5); elseif (y <= 5700000000.0) tmp = -1.0; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.56e+16) tmp = 1.0; elseif (y <= 1.8e-284) tmp = -1.0; elseif (y <= 5e-252) tmp = x * 0.5; elseif (y <= 1.5e-71) tmp = -1.0; elseif (y <= 1.15e-45) tmp = y * -0.5; elseif (y <= 5700000000.0) tmp = -1.0; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.56e+16], 1.0, If[LessEqual[y, 1.8e-284], -1.0, If[LessEqual[y, 5e-252], N[(x * 0.5), $MachinePrecision], If[LessEqual[y, 1.5e-71], -1.0, If[LessEqual[y, 1.15e-45], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 5700000000.0], -1.0, 1.0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.56 \cdot 10^{+16}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{-284}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq 5 \cdot 10^{-252}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;y \leq 1.5 \cdot 10^{-71}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq 1.15 \cdot 10^{-45}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 5700000000:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1.56e16 or 5.7e9 < y Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 81.6%
if -1.56e16 < y < 1.8000000000000001e-284 or 5.00000000000000008e-252 < y < 1.5000000000000001e-71 or 1.14999999999999996e-45 < y < 5.7e9Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 57.7%
if 1.8000000000000001e-284 < y < 5.00000000000000008e-252Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 88.5%
mul-1-neg88.5%
distribute-neg-frac288.5%
neg-sub088.5%
associate-+l-88.5%
neg-sub088.5%
+-commutative88.5%
unsub-neg88.5%
Simplified88.5%
Taylor expanded in x around 0 73.5%
*-commutative73.5%
Simplified73.5%
if 1.5000000000000001e-71 < y < 1.14999999999999996e-45Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 86.9%
Taylor expanded in y around 0 86.9%
*-commutative86.9%
Simplified86.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (- 2.0 x))))
(if (<= y -20000000000000.0)
(+ 1.0 (* (/ x y) -2.0))
(if (<= y 4.05e-66)
t_0
(if (<= y 3.3e-49)
(/ y (- y 2.0))
(if (<= y 320000000.0) t_0 (+ 1.0 (/ (+ 2.0 (* x -2.0)) y))))))))
double code(double x, double y) {
double t_0 = x / (2.0 - x);
double tmp;
if (y <= -20000000000000.0) {
tmp = 1.0 + ((x / y) * -2.0);
} else if (y <= 4.05e-66) {
tmp = t_0;
} else if (y <= 3.3e-49) {
tmp = y / (y - 2.0);
} else if (y <= 320000000.0) {
tmp = t_0;
} else {
tmp = 1.0 + ((2.0 + (x * -2.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 / (2.0d0 - x)
if (y <= (-20000000000000.0d0)) then
tmp = 1.0d0 + ((x / y) * (-2.0d0))
else if (y <= 4.05d-66) then
tmp = t_0
else if (y <= 3.3d-49) then
tmp = y / (y - 2.0d0)
else if (y <= 320000000.0d0) then
tmp = t_0
else
tmp = 1.0d0 + ((2.0d0 + (x * (-2.0d0))) / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x / (2.0 - x);
double tmp;
if (y <= -20000000000000.0) {
tmp = 1.0 + ((x / y) * -2.0);
} else if (y <= 4.05e-66) {
tmp = t_0;
} else if (y <= 3.3e-49) {
tmp = y / (y - 2.0);
} else if (y <= 320000000.0) {
tmp = t_0;
} else {
tmp = 1.0 + ((2.0 + (x * -2.0)) / y);
}
return tmp;
}
def code(x, y): t_0 = x / (2.0 - x) tmp = 0 if y <= -20000000000000.0: tmp = 1.0 + ((x / y) * -2.0) elif y <= 4.05e-66: tmp = t_0 elif y <= 3.3e-49: tmp = y / (y - 2.0) elif y <= 320000000.0: tmp = t_0 else: tmp = 1.0 + ((2.0 + (x * -2.0)) / y) return tmp
function code(x, y) t_0 = Float64(x / Float64(2.0 - x)) tmp = 0.0 if (y <= -20000000000000.0) tmp = Float64(1.0 + Float64(Float64(x / y) * -2.0)); elseif (y <= 4.05e-66) tmp = t_0; elseif (y <= 3.3e-49) tmp = Float64(y / Float64(y - 2.0)); elseif (y <= 320000000.0) tmp = t_0; else tmp = Float64(1.0 + Float64(Float64(2.0 + Float64(x * -2.0)) / y)); end return tmp end
function tmp_2 = code(x, y) t_0 = x / (2.0 - x); tmp = 0.0; if (y <= -20000000000000.0) tmp = 1.0 + ((x / y) * -2.0); elseif (y <= 4.05e-66) tmp = t_0; elseif (y <= 3.3e-49) tmp = y / (y - 2.0); elseif (y <= 320000000.0) tmp = t_0; else tmp = 1.0 + ((2.0 + (x * -2.0)) / y); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -20000000000000.0], N[(1.0 + N[(N[(x / y), $MachinePrecision] * -2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.05e-66], t$95$0, If[LessEqual[y, 3.3e-49], N[(y / N[(y - 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 320000000.0], t$95$0, N[(1.0 + N[(N[(2.0 + N[(x * -2.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{2 - x}\\
\mathbf{if}\;y \leq -20000000000000:\\
\;\;\;\;1 + \frac{x}{y} \cdot -2\\
\mathbf{elif}\;y \leq 4.05 \cdot 10^{-66}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 3.3 \cdot 10^{-49}:\\
\;\;\;\;\frac{y}{y - 2}\\
\mathbf{elif}\;y \leq 320000000:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{2 + x \cdot -2}{y}\\
\end{array}
\end{array}
if y < -2e13Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 88.0%
associate--l+88.0%
+-commutative88.0%
mul-1-neg88.0%
unsub-neg88.0%
associate-*r/88.0%
metadata-eval88.0%
div-sub88.0%
unsub-neg88.0%
mul-1-neg88.0%
div-sub88.0%
mul-1-neg88.0%
associate--l+88.0%
sub-neg88.0%
mul-1-neg88.0%
mul-1-neg88.0%
distribute-rgt-out88.0%
metadata-eval88.0%
Simplified88.0%
Taylor expanded in x around inf 88.0%
*-commutative88.0%
Simplified88.0%
if -2e13 < y < 4.0500000000000002e-66 or 3.3e-49 < y < 3.2e8Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 77.1%
mul-1-neg77.1%
distribute-neg-frac277.1%
neg-sub077.1%
associate-+l-77.1%
neg-sub077.1%
+-commutative77.1%
unsub-neg77.1%
Simplified77.1%
if 4.0500000000000002e-66 < y < 3.3e-49Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
if 3.2e8 < y Initial program 99.9%
remove-double-neg99.9%
+-commutative99.9%
distribute-neg-frac299.9%
distribute-frac-neg99.9%
sub-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
neg-sub099.9%
associate--r-99.9%
metadata-eval99.9%
metadata-eval99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf 78.6%
associate--l+78.6%
+-commutative78.6%
mul-1-neg78.6%
unsub-neg78.6%
associate-*r/78.6%
metadata-eval78.6%
div-sub78.6%
unsub-neg78.6%
mul-1-neg78.6%
div-sub78.6%
mul-1-neg78.6%
associate--l+78.6%
sub-neg78.6%
mul-1-neg78.6%
mul-1-neg78.6%
distribute-rgt-out78.6%
metadata-eval78.6%
Simplified78.6%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (* (/ x y) -2.0))) (t_1 (/ x (- 2.0 x))))
(if (<= y -6.8e+17)
t_0
(if (<= y 6.2e-67)
t_1
(if (<= y 1.7e-50)
(/ y (- y 2.0))
(if (<= y 114000000000.0) t_1 t_0))))))
double code(double x, double y) {
double t_0 = 1.0 + ((x / y) * -2.0);
double t_1 = x / (2.0 - x);
double tmp;
if (y <= -6.8e+17) {
tmp = t_0;
} else if (y <= 6.2e-67) {
tmp = t_1;
} else if (y <= 1.7e-50) {
tmp = y / (y - 2.0);
} else if (y <= 114000000000.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 / y) * (-2.0d0))
t_1 = x / (2.0d0 - x)
if (y <= (-6.8d+17)) then
tmp = t_0
else if (y <= 6.2d-67) then
tmp = t_1
else if (y <= 1.7d-50) then
tmp = y / (y - 2.0d0)
else if (y <= 114000000000.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 / y) * -2.0);
double t_1 = x / (2.0 - x);
double tmp;
if (y <= -6.8e+17) {
tmp = t_0;
} else if (y <= 6.2e-67) {
tmp = t_1;
} else if (y <= 1.7e-50) {
tmp = y / (y - 2.0);
} else if (y <= 114000000000.0) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + ((x / y) * -2.0) t_1 = x / (2.0 - x) tmp = 0 if y <= -6.8e+17: tmp = t_0 elif y <= 6.2e-67: tmp = t_1 elif y <= 1.7e-50: tmp = y / (y - 2.0) elif y <= 114000000000.0: tmp = t_1 else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(Float64(x / y) * -2.0)) t_1 = Float64(x / Float64(2.0 - x)) tmp = 0.0 if (y <= -6.8e+17) tmp = t_0; elseif (y <= 6.2e-67) tmp = t_1; elseif (y <= 1.7e-50) tmp = Float64(y / Float64(y - 2.0)); elseif (y <= 114000000000.0) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + ((x / y) * -2.0); t_1 = x / (2.0 - x); tmp = 0.0; if (y <= -6.8e+17) tmp = t_0; elseif (y <= 6.2e-67) tmp = t_1; elseif (y <= 1.7e-50) tmp = y / (y - 2.0); elseif (y <= 114000000000.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 / y), $MachinePrecision] * -2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -6.8e+17], t$95$0, If[LessEqual[y, 6.2e-67], t$95$1, If[LessEqual[y, 1.7e-50], N[(y / N[(y - 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 114000000000.0], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{x}{y} \cdot -2\\
t_1 := \frac{x}{2 - x}\\
\mathbf{if}\;y \leq -6.8 \cdot 10^{+17}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 6.2 \cdot 10^{-67}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.7 \cdot 10^{-50}:\\
\;\;\;\;\frac{y}{y - 2}\\
\mathbf{elif}\;y \leq 114000000000:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -6.8e17 or 1.14e11 < y Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 83.3%
associate--l+83.3%
+-commutative83.3%
mul-1-neg83.3%
unsub-neg83.3%
associate-*r/83.3%
metadata-eval83.3%
div-sub83.3%
unsub-neg83.3%
mul-1-neg83.3%
div-sub83.3%
mul-1-neg83.3%
associate--l+83.3%
sub-neg83.3%
mul-1-neg83.3%
mul-1-neg83.3%
distribute-rgt-out83.3%
metadata-eval83.3%
Simplified83.3%
Taylor expanded in x around inf 83.1%
*-commutative83.1%
Simplified83.1%
if -6.8e17 < y < 6.2000000000000005e-67 or 1.70000000000000007e-50 < y < 1.14e11Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 77.1%
mul-1-neg77.1%
distribute-neg-frac277.1%
neg-sub077.1%
associate-+l-77.1%
neg-sub077.1%
+-commutative77.1%
unsub-neg77.1%
Simplified77.1%
if 6.2000000000000005e-67 < y < 1.70000000000000007e-50Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (- 2.0 x))))
(if (<= y -1.32e+14)
1.0
(if (<= y 1.9e-67)
t_0
(if (<= y 1.45e-44) (* y -0.5) (if (<= y 9500000000.0) t_0 1.0))))))
double code(double x, double y) {
double t_0 = x / (2.0 - x);
double tmp;
if (y <= -1.32e+14) {
tmp = 1.0;
} else if (y <= 1.9e-67) {
tmp = t_0;
} else if (y <= 1.45e-44) {
tmp = y * -0.5;
} else if (y <= 9500000000.0) {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = x / (2.0d0 - x)
if (y <= (-1.32d+14)) then
tmp = 1.0d0
else if (y <= 1.9d-67) then
tmp = t_0
else if (y <= 1.45d-44) then
tmp = y * (-0.5d0)
else if (y <= 9500000000.0d0) then
tmp = t_0
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x / (2.0 - x);
double tmp;
if (y <= -1.32e+14) {
tmp = 1.0;
} else if (y <= 1.9e-67) {
tmp = t_0;
} else if (y <= 1.45e-44) {
tmp = y * -0.5;
} else if (y <= 9500000000.0) {
tmp = t_0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): t_0 = x / (2.0 - x) tmp = 0 if y <= -1.32e+14: tmp = 1.0 elif y <= 1.9e-67: tmp = t_0 elif y <= 1.45e-44: tmp = y * -0.5 elif y <= 9500000000.0: tmp = t_0 else: tmp = 1.0 return tmp
function code(x, y) t_0 = Float64(x / Float64(2.0 - x)) tmp = 0.0 if (y <= -1.32e+14) tmp = 1.0; elseif (y <= 1.9e-67) tmp = t_0; elseif (y <= 1.45e-44) tmp = Float64(y * -0.5); elseif (y <= 9500000000.0) tmp = t_0; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) t_0 = x / (2.0 - x); tmp = 0.0; if (y <= -1.32e+14) tmp = 1.0; elseif (y <= 1.9e-67) tmp = t_0; elseif (y <= 1.45e-44) tmp = y * -0.5; elseif (y <= 9500000000.0) tmp = t_0; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.32e+14], 1.0, If[LessEqual[y, 1.9e-67], t$95$0, If[LessEqual[y, 1.45e-44], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 9500000000.0], t$95$0, 1.0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{2 - x}\\
\mathbf{if}\;y \leq -1.32 \cdot 10^{+14}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{-67}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.45 \cdot 10^{-44}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 9500000000:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1.32e14 or 9.5e9 < y Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 81.6%
if -1.32e14 < y < 1.89999999999999994e-67 or 1.4500000000000001e-44 < y < 9.5e9Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 77.1%
mul-1-neg77.1%
distribute-neg-frac277.1%
neg-sub077.1%
associate-+l-77.1%
neg-sub077.1%
+-commutative77.1%
unsub-neg77.1%
Simplified77.1%
if 1.89999999999999994e-67 < y < 1.4500000000000001e-44Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
Taylor expanded in y around 0 100.0%
*-commutative100.0%
Simplified100.0%
(FPCore (x y)
:precision binary64
(if (<= y -1.65e+14)
1.0
(if (<= y 1.02e-277)
-1.0
(if (<= y 3.5e-252) (* x 0.5) (if (<= y 200000000000.0) -1.0 1.0)))))
double code(double x, double y) {
double tmp;
if (y <= -1.65e+14) {
tmp = 1.0;
} else if (y <= 1.02e-277) {
tmp = -1.0;
} else if (y <= 3.5e-252) {
tmp = x * 0.5;
} else if (y <= 200000000000.0) {
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 <= (-1.65d+14)) then
tmp = 1.0d0
else if (y <= 1.02d-277) then
tmp = -1.0d0
else if (y <= 3.5d-252) then
tmp = x * 0.5d0
else if (y <= 200000000000.0d0) 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 <= -1.65e+14) {
tmp = 1.0;
} else if (y <= 1.02e-277) {
tmp = -1.0;
} else if (y <= 3.5e-252) {
tmp = x * 0.5;
} else if (y <= 200000000000.0) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.65e+14: tmp = 1.0 elif y <= 1.02e-277: tmp = -1.0 elif y <= 3.5e-252: tmp = x * 0.5 elif y <= 200000000000.0: tmp = -1.0 else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -1.65e+14) tmp = 1.0; elseif (y <= 1.02e-277) tmp = -1.0; elseif (y <= 3.5e-252) tmp = Float64(x * 0.5); elseif (y <= 200000000000.0) tmp = -1.0; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.65e+14) tmp = 1.0; elseif (y <= 1.02e-277) tmp = -1.0; elseif (y <= 3.5e-252) tmp = x * 0.5; elseif (y <= 200000000000.0) tmp = -1.0; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.65e+14], 1.0, If[LessEqual[y, 1.02e-277], -1.0, If[LessEqual[y, 3.5e-252], N[(x * 0.5), $MachinePrecision], If[LessEqual[y, 200000000000.0], -1.0, 1.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.65 \cdot 10^{+14}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1.02 \cdot 10^{-277}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq 3.5 \cdot 10^{-252}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;y \leq 200000000000:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1.65e14 or 2e11 < y Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 81.6%
if -1.65e14 < y < 1.02000000000000002e-277 or 3.49999999999999986e-252 < y < 2e11Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 54.9%
if 1.02000000000000002e-277 < y < 3.49999999999999986e-252Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 88.5%
mul-1-neg88.5%
distribute-neg-frac288.5%
neg-sub088.5%
associate-+l-88.5%
neg-sub088.5%
+-commutative88.5%
unsub-neg88.5%
Simplified88.5%
Taylor expanded in x around 0 73.5%
*-commutative73.5%
Simplified73.5%
(FPCore (x y) :precision binary64 (if (<= x -1.1e+33) -1.0 (if (<= x 9e+14) (/ y (- y 2.0)) (/ x (- 2.0 x)))))
double code(double x, double y) {
double tmp;
if (x <= -1.1e+33) {
tmp = -1.0;
} else if (x <= 9e+14) {
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.1d+33)) then
tmp = -1.0d0
else if (x <= 9d+14) 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.1e+33) {
tmp = -1.0;
} else if (x <= 9e+14) {
tmp = y / (y - 2.0);
} else {
tmp = x / (2.0 - x);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.1e+33: tmp = -1.0 elif x <= 9e+14: tmp = y / (y - 2.0) else: tmp = x / (2.0 - x) return tmp
function code(x, y) tmp = 0.0 if (x <= -1.1e+33) tmp = -1.0; elseif (x <= 9e+14) 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.1e+33) tmp = -1.0; elseif (x <= 9e+14) tmp = y / (y - 2.0); else tmp = x / (2.0 - x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.1e+33], -1.0, If[LessEqual[x, 9e+14], 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.1 \cdot 10^{+33}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \leq 9 \cdot 10^{+14}:\\
\;\;\;\;\frac{y}{y - 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{2 - x}\\
\end{array}
\end{array}
if x < -1.09999999999999997e33Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 85.2%
if -1.09999999999999997e33 < x < 9e14Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 77.0%
if 9e14 < x Initial program 99.9%
remove-double-neg99.9%
+-commutative99.9%
distribute-neg-frac299.9%
distribute-frac-neg99.9%
sub-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
neg-sub099.9%
associate--r-99.9%
metadata-eval99.9%
metadata-eval99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 68.8%
mul-1-neg68.8%
distribute-neg-frac268.8%
neg-sub068.8%
associate-+l-68.8%
neg-sub068.8%
+-commutative68.8%
unsub-neg68.8%
Simplified68.8%
(FPCore (x y) :precision binary64 (if (<= y -1.4e+19) 1.0 (if (<= y 9500000000.0) -1.0 1.0)))
double code(double x, double y) {
double tmp;
if (y <= -1.4e+19) {
tmp = 1.0;
} else if (y <= 9500000000.0) {
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 <= (-1.4d+19)) then
tmp = 1.0d0
else if (y <= 9500000000.0d0) 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 <= -1.4e+19) {
tmp = 1.0;
} else if (y <= 9500000000.0) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.4e+19: tmp = 1.0 elif y <= 9500000000.0: tmp = -1.0 else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -1.4e+19) tmp = 1.0; elseif (y <= 9500000000.0) tmp = -1.0; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.4e+19) tmp = 1.0; elseif (y <= 9500000000.0) tmp = -1.0; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.4e+19], 1.0, If[LessEqual[y, 9500000000.0], -1.0, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.4 \cdot 10^{+19}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 9500000000:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1.4e19 or 9.5e9 < y Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 81.6%
if -1.4e19 < y < 9.5e9Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 52.7%
(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%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 36.3%
(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 2024103
(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))))