
(FPCore (x y) :precision binary64 (/ (- x y) (+ x y)))
double code(double x, double y) {
return (x - y) / (x + y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x - y) / (x + y)
end function
public static double code(double x, double y) {
return (x - y) / (x + y);
}
def code(x, y): return (x - y) / (x + y)
function code(x, y) return Float64(Float64(x - y) / Float64(x + y)) end
function tmp = code(x, y) tmp = (x - y) / (x + y); end
code[x_, y_] := N[(N[(x - y), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{x + y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (- x y) (+ x y)))
double code(double x, double y) {
return (x - y) / (x + y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x - y) / (x + y)
end function
public static double code(double x, double y) {
return (x - y) / (x + y);
}
def code(x, y): return (x - y) / (x + y)
function code(x, y) return Float64(Float64(x - y) / Float64(x + y)) end
function tmp = code(x, y) tmp = (x - y) / (x + y); end
code[x_, y_] := N[(N[(x - y), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{x + y}
\end{array}
(FPCore (x y) :precision binary64 (- (/ x (+ x y)) (/ y (+ x y))))
double code(double x, double y) {
return (x / (x + y)) - (y / (x + y));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x / (x + y)) - (y / (x + y))
end function
public static double code(double x, double y) {
return (x / (x + y)) - (y / (x + y));
}
def code(x, y): return (x / (x + y)) - (y / (x + y))
function code(x, y) return Float64(Float64(x / Float64(x + y)) - Float64(y / Float64(x + y))) end
function tmp = code(x, y) tmp = (x / (x + y)) - (y / (x + y)); end
code[x_, y_] := N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] - N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{x + y} - \frac{y}{x + y}
\end{array}
Initial program 99.9%
div-subN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64100.0%
Applied egg-rr100.0%
(FPCore (x y) :precision binary64 (let* ((t_0 (+ 1.0 (/ (* y -2.0) x)))) (if (<= x -8.5e+38) t_0 (if (<= x 1.55e+32) (+ -1.0 (/ (* x 2.0) y)) t_0))))
double code(double x, double y) {
double t_0 = 1.0 + ((y * -2.0) / x);
double tmp;
if (x <= -8.5e+38) {
tmp = t_0;
} else if (x <= 1.55e+32) {
tmp = -1.0 + ((x * 2.0) / y);
} 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 = 1.0d0 + ((y * (-2.0d0)) / x)
if (x <= (-8.5d+38)) then
tmp = t_0
else if (x <= 1.55d+32) then
tmp = (-1.0d0) + ((x * 2.0d0) / y)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 + ((y * -2.0) / x);
double tmp;
if (x <= -8.5e+38) {
tmp = t_0;
} else if (x <= 1.55e+32) {
tmp = -1.0 + ((x * 2.0) / y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + ((y * -2.0) / x) tmp = 0 if x <= -8.5e+38: tmp = t_0 elif x <= 1.55e+32: tmp = -1.0 + ((x * 2.0) / y) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(Float64(y * -2.0) / x)) tmp = 0.0 if (x <= -8.5e+38) tmp = t_0; elseif (x <= 1.55e+32) tmp = Float64(-1.0 + Float64(Float64(x * 2.0) / y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + ((y * -2.0) / x); tmp = 0.0; if (x <= -8.5e+38) tmp = t_0; elseif (x <= 1.55e+32) tmp = -1.0 + ((x * 2.0) / y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(N[(y * -2.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -8.5e+38], t$95$0, If[LessEqual[x, 1.55e+32], N[(-1.0 + N[(N[(x * 2.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{y \cdot -2}{x}\\
\mathbf{if}\;x \leq -8.5 \cdot 10^{+38}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{+32}:\\
\;\;\;\;-1 + \frac{x \cdot 2}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -8.4999999999999997e38 or 1.54999999999999997e32 < x Initial program 100.0%
Taylor expanded in x around inf
associate--l+N/A
associate-*r/N/A
div-subN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
*-lft-identityN/A
distribute-rgt-out--N/A
metadata-evalN/A
*-lowering-*.f6485.5%
Simplified85.5%
if -8.4999999999999997e38 < x < 1.54999999999999997e32Initial program 99.9%
Taylor expanded in x around 0
sub-negN/A
metadata-evalN/A
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
associate-*l/N/A
metadata-evalN/A
distribute-rgt1-inN/A
metadata-evalN/A
cancel-sign-sub-invN/A
/-lowering-/.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
distribute-rgt1-inN/A
metadata-evalN/A
*-lowering-*.f6474.4%
Simplified74.4%
Final simplification79.3%
(FPCore (x y) :precision binary64 (let* ((t_0 (/ x (+ x y)))) (if (<= x -1.62e+38) t_0 (if (<= x 3.8e+32) (+ -1.0 (/ (* x 2.0) y)) t_0))))
double code(double x, double y) {
double t_0 = x / (x + y);
double tmp;
if (x <= -1.62e+38) {
tmp = t_0;
} else if (x <= 3.8e+32) {
tmp = -1.0 + ((x * 2.0) / y);
} 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 / (x + y)
if (x <= (-1.62d+38)) then
tmp = t_0
else if (x <= 3.8d+32) then
tmp = (-1.0d0) + ((x * 2.0d0) / y)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x / (x + y);
double tmp;
if (x <= -1.62e+38) {
tmp = t_0;
} else if (x <= 3.8e+32) {
tmp = -1.0 + ((x * 2.0) / y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = x / (x + y) tmp = 0 if x <= -1.62e+38: tmp = t_0 elif x <= 3.8e+32: tmp = -1.0 + ((x * 2.0) / y) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(x / Float64(x + y)) tmp = 0.0 if (x <= -1.62e+38) tmp = t_0; elseif (x <= 3.8e+32) tmp = Float64(-1.0 + Float64(Float64(x * 2.0) / y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = x / (x + y); tmp = 0.0; if (x <= -1.62e+38) tmp = t_0; elseif (x <= 3.8e+32) tmp = -1.0 + ((x * 2.0) / y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.62e+38], t$95$0, If[LessEqual[x, 3.8e+32], N[(-1.0 + N[(N[(x * 2.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{x + y}\\
\mathbf{if}\;x \leq -1.62 \cdot 10^{+38}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 3.8 \cdot 10^{+32}:\\
\;\;\;\;-1 + \frac{x \cdot 2}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1.62000000000000001e38 or 3.8000000000000003e32 < x Initial program 100.0%
Taylor expanded in x around inf
Simplified84.5%
if -1.62000000000000001e38 < x < 3.8000000000000003e32Initial program 99.9%
Taylor expanded in x around 0
sub-negN/A
metadata-evalN/A
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
associate-*l/N/A
metadata-evalN/A
distribute-rgt1-inN/A
metadata-evalN/A
cancel-sign-sub-invN/A
/-lowering-/.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
distribute-rgt1-inN/A
metadata-evalN/A
*-lowering-*.f6474.4%
Simplified74.4%
Final simplification78.9%
(FPCore (x y) :precision binary64 (let* ((t_0 (/ x (+ x y)))) (if (<= x -1.45e+38) t_0 (if (<= x 2.9e+30) (+ -1.0 (/ x y)) t_0))))
double code(double x, double y) {
double t_0 = x / (x + y);
double tmp;
if (x <= -1.45e+38) {
tmp = t_0;
} else if (x <= 2.9e+30) {
tmp = -1.0 + (x / y);
} 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 / (x + y)
if (x <= (-1.45d+38)) then
tmp = t_0
else if (x <= 2.9d+30) then
tmp = (-1.0d0) + (x / y)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x / (x + y);
double tmp;
if (x <= -1.45e+38) {
tmp = t_0;
} else if (x <= 2.9e+30) {
tmp = -1.0 + (x / y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = x / (x + y) tmp = 0 if x <= -1.45e+38: tmp = t_0 elif x <= 2.9e+30: tmp = -1.0 + (x / y) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(x / Float64(x + y)) tmp = 0.0 if (x <= -1.45e+38) tmp = t_0; elseif (x <= 2.9e+30) tmp = Float64(-1.0 + Float64(x / y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = x / (x + y); tmp = 0.0; if (x <= -1.45e+38) tmp = t_0; elseif (x <= 2.9e+30) tmp = -1.0 + (x / y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.45e+38], t$95$0, If[LessEqual[x, 2.9e+30], N[(-1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{x + y}\\
\mathbf{if}\;x \leq -1.45 \cdot 10^{+38}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 2.9 \cdot 10^{+30}:\\
\;\;\;\;-1 + \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1.45000000000000003e38 or 2.8999999999999998e30 < x Initial program 100.0%
Taylor expanded in x around inf
Simplified84.5%
if -1.45000000000000003e38 < x < 2.8999999999999998e30Initial program 99.9%
Taylor expanded in x around 0
Simplified73.6%
div-subN/A
*-inversesN/A
--lowering--.f64N/A
/-lowering-/.f6473.6%
Applied egg-rr73.6%
Final simplification78.4%
(FPCore (x y) :precision binary64 (let* ((t_0 (- 1.0 (/ y x)))) (if (<= x -2e+38) t_0 (if (<= x 8e+29) (+ -1.0 (/ x y)) t_0))))
double code(double x, double y) {
double t_0 = 1.0 - (y / x);
double tmp;
if (x <= -2e+38) {
tmp = t_0;
} else if (x <= 8e+29) {
tmp = -1.0 + (x / y);
} 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 = 1.0d0 - (y / x)
if (x <= (-2d+38)) then
tmp = t_0
else if (x <= 8d+29) then
tmp = (-1.0d0) + (x / y)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 - (y / x);
double tmp;
if (x <= -2e+38) {
tmp = t_0;
} else if (x <= 8e+29) {
tmp = -1.0 + (x / y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 - (y / x) tmp = 0 if x <= -2e+38: tmp = t_0 elif x <= 8e+29: tmp = -1.0 + (x / y) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 - Float64(y / x)) tmp = 0.0 if (x <= -2e+38) tmp = t_0; elseif (x <= 8e+29) tmp = Float64(-1.0 + Float64(x / y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 - (y / x); tmp = 0.0; if (x <= -2e+38) tmp = t_0; elseif (x <= 8e+29) tmp = -1.0 + (x / y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 - N[(y / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2e+38], t$95$0, If[LessEqual[x, 8e+29], N[(-1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \frac{y}{x}\\
\mathbf{if}\;x \leq -2 \cdot 10^{+38}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 8 \cdot 10^{+29}:\\
\;\;\;\;-1 + \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1.99999999999999995e38 or 7.99999999999999931e29 < x Initial program 100.0%
Taylor expanded in x around inf
Simplified84.5%
Taylor expanded in x around inf
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f6484.3%
Simplified84.3%
if -1.99999999999999995e38 < x < 7.99999999999999931e29Initial program 99.9%
Taylor expanded in x around 0
Simplified73.6%
div-subN/A
*-inversesN/A
--lowering--.f64N/A
/-lowering-/.f6473.6%
Applied egg-rr73.6%
Final simplification78.4%
(FPCore (x y) :precision binary64 (let* ((t_0 (- 1.0 (/ y x)))) (if (<= x -1.52e+38) t_0 (if (<= x 1e+30) -1.0 t_0))))
double code(double x, double y) {
double t_0 = 1.0 - (y / x);
double tmp;
if (x <= -1.52e+38) {
tmp = t_0;
} else if (x <= 1e+30) {
tmp = -1.0;
} 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 = 1.0d0 - (y / x)
if (x <= (-1.52d+38)) then
tmp = t_0
else if (x <= 1d+30) then
tmp = -1.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 - (y / x);
double tmp;
if (x <= -1.52e+38) {
tmp = t_0;
} else if (x <= 1e+30) {
tmp = -1.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 - (y / x) tmp = 0 if x <= -1.52e+38: tmp = t_0 elif x <= 1e+30: tmp = -1.0 else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 - Float64(y / x)) tmp = 0.0 if (x <= -1.52e+38) tmp = t_0; elseif (x <= 1e+30) tmp = -1.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 - (y / x); tmp = 0.0; if (x <= -1.52e+38) tmp = t_0; elseif (x <= 1e+30) tmp = -1.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 - N[(y / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.52e+38], t$95$0, If[LessEqual[x, 1e+30], -1.0, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \frac{y}{x}\\
\mathbf{if}\;x \leq -1.52 \cdot 10^{+38}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 10^{+30}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1.51999999999999996e38 or 1e30 < x Initial program 100.0%
Taylor expanded in x around inf
Simplified84.5%
Taylor expanded in x around inf
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f6484.3%
Simplified84.3%
if -1.51999999999999996e38 < x < 1e30Initial program 99.9%
Taylor expanded in x around 0
Simplified73.1%
(FPCore (x y) :precision binary64 (if (<= x -1.5e+38) 1.0 (if (<= x 2e+30) -1.0 1.0)))
double code(double x, double y) {
double tmp;
if (x <= -1.5e+38) {
tmp = 1.0;
} else if (x <= 2e+30) {
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 (x <= (-1.5d+38)) then
tmp = 1.0d0
else if (x <= 2d+30) 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 (x <= -1.5e+38) {
tmp = 1.0;
} else if (x <= 2e+30) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.5e+38: tmp = 1.0 elif x <= 2e+30: tmp = -1.0 else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (x <= -1.5e+38) tmp = 1.0; elseif (x <= 2e+30) tmp = -1.0; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1.5e+38) tmp = 1.0; elseif (x <= 2e+30) tmp = -1.0; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.5e+38], 1.0, If[LessEqual[x, 2e+30], -1.0, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.5 \cdot 10^{+38}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 2 \cdot 10^{+30}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -1.5000000000000001e38 or 2e30 < x Initial program 100.0%
Taylor expanded in x around inf
Simplified84.0%
if -1.5000000000000001e38 < x < 2e30Initial program 99.9%
Taylor expanded in x around 0
Simplified73.1%
(FPCore (x y) :precision binary64 (/ (- x y) (+ x y)))
double code(double x, double y) {
return (x - y) / (x + y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x - y) / (x + y)
end function
public static double code(double x, double y) {
return (x - y) / (x + y);
}
def code(x, y): return (x - y) / (x + y)
function code(x, y) return Float64(Float64(x - y) / Float64(x + y)) end
function tmp = code(x, y) tmp = (x - y) / (x + y); end
code[x_, y_] := N[(N[(x - y), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{x + y}
\end{array}
Initial program 99.9%
(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 99.9%
Taylor expanded in x around 0
Simplified47.7%
(FPCore (x y) :precision binary64 (- (/ x (+ x y)) (/ y (+ x y))))
double code(double x, double y) {
return (x / (x + y)) - (y / (x + y));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x / (x + y)) - (y / (x + y))
end function
public static double code(double x, double y) {
return (x / (x + y)) - (y / (x + y));
}
def code(x, y): return (x / (x + y)) - (y / (x + y))
function code(x, y) return Float64(Float64(x / Float64(x + y)) - Float64(y / Float64(x + y))) end
function tmp = code(x, y) tmp = (x / (x + y)) - (y / (x + y)); end
code[x_, y_] := N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] - N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{x + y} - \frac{y}{x + y}
\end{array}
herbie shell --seed 2024158
(FPCore (x y)
:name "Data.Colour.RGB:hslsv from colour-2.3.3, D"
:precision binary64
:alt
(! :herbie-platform default (- (/ x (+ x y)) (/ y (+ x y))))
(/ (- x y) (+ x y)))