
(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 8 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 (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}
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (/ 2.0 y))) (t_1 (/ x (- 2.0 x))))
(if (<= y -90000000000000.0)
t_0
(if (<= y -1e-67)
t_1
(if (<= y -1.05e-82)
(* y -0.5)
(if (<= y 6.5e-125)
t_1
(if (<= y 2.9)
(* y -0.5)
(if (<= y 6.1e+62) t_0 (if (<= y 5.8e+86) t_1 1.0)))))))))
double code(double x, double y) {
double t_0 = 1.0 + (2.0 / y);
double t_1 = x / (2.0 - x);
double tmp;
if (y <= -90000000000000.0) {
tmp = t_0;
} else if (y <= -1e-67) {
tmp = t_1;
} else if (y <= -1.05e-82) {
tmp = y * -0.5;
} else if (y <= 6.5e-125) {
tmp = t_1;
} else if (y <= 2.9) {
tmp = y * -0.5;
} else if (y <= 6.1e+62) {
tmp = t_0;
} else if (y <= 5.8e+86) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_0 = 1.0d0 + (2.0d0 / y)
t_1 = x / (2.0d0 - x)
if (y <= (-90000000000000.0d0)) then
tmp = t_0
else if (y <= (-1d-67)) then
tmp = t_1
else if (y <= (-1.05d-82)) then
tmp = y * (-0.5d0)
else if (y <= 6.5d-125) then
tmp = t_1
else if (y <= 2.9d0) then
tmp = y * (-0.5d0)
else if (y <= 6.1d+62) then
tmp = t_0
else if (y <= 5.8d+86) then
tmp = t_1
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 + (2.0 / y);
double t_1 = x / (2.0 - x);
double tmp;
if (y <= -90000000000000.0) {
tmp = t_0;
} else if (y <= -1e-67) {
tmp = t_1;
} else if (y <= -1.05e-82) {
tmp = y * -0.5;
} else if (y <= 6.5e-125) {
tmp = t_1;
} else if (y <= 2.9) {
tmp = y * -0.5;
} else if (y <= 6.1e+62) {
tmp = t_0;
} else if (y <= 5.8e+86) {
tmp = t_1;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + (2.0 / y) t_1 = x / (2.0 - x) tmp = 0 if y <= -90000000000000.0: tmp = t_0 elif y <= -1e-67: tmp = t_1 elif y <= -1.05e-82: tmp = y * -0.5 elif y <= 6.5e-125: tmp = t_1 elif y <= 2.9: tmp = y * -0.5 elif y <= 6.1e+62: tmp = t_0 elif y <= 5.8e+86: tmp = t_1 else: tmp = 1.0 return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(2.0 / y)) t_1 = Float64(x / Float64(2.0 - x)) tmp = 0.0 if (y <= -90000000000000.0) tmp = t_0; elseif (y <= -1e-67) tmp = t_1; elseif (y <= -1.05e-82) tmp = Float64(y * -0.5); elseif (y <= 6.5e-125) tmp = t_1; elseif (y <= 2.9) tmp = Float64(y * -0.5); elseif (y <= 6.1e+62) tmp = t_0; elseif (y <= 5.8e+86) tmp = t_1; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + (2.0 / y); t_1 = x / (2.0 - x); tmp = 0.0; if (y <= -90000000000000.0) tmp = t_0; elseif (y <= -1e-67) tmp = t_1; elseif (y <= -1.05e-82) tmp = y * -0.5; elseif (y <= 6.5e-125) tmp = t_1; elseif (y <= 2.9) tmp = y * -0.5; elseif (y <= 6.1e+62) tmp = t_0; elseif (y <= 5.8e+86) tmp = t_1; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(2.0 / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -90000000000000.0], t$95$0, If[LessEqual[y, -1e-67], t$95$1, If[LessEqual[y, -1.05e-82], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 6.5e-125], t$95$1, If[LessEqual[y, 2.9], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 6.1e+62], t$95$0, If[LessEqual[y, 5.8e+86], t$95$1, 1.0]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{2}{y}\\
t_1 := \frac{x}{2 - x}\\
\mathbf{if}\;y \leq -90000000000000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -1 \cdot 10^{-67}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -1.05 \cdot 10^{-82}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 6.5 \cdot 10^{-125}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 2.9:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 6.1 \cdot 10^{+62}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 5.8 \cdot 10^{+86}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
(FPCore (x y)
:precision binary64
(if (<= x -1.42e+29)
-1.0
(if (<= x -1.45e-274)
1.0
(if (<= x 4.1e-290)
(* y -0.5)
(if (<= x 5.2e-256)
1.0
(if (<= x 1.62e-208) (* y -0.5) (if (<= x 4.15e+40) 1.0 -1.0)))))))
double code(double x, double y) {
double tmp;
if (x <= -1.42e+29) {
tmp = -1.0;
} else if (x <= -1.45e-274) {
tmp = 1.0;
} else if (x <= 4.1e-290) {
tmp = y * -0.5;
} else if (x <= 5.2e-256) {
tmp = 1.0;
} else if (x <= 1.62e-208) {
tmp = y * -0.5;
} else if (x <= 4.15e+40) {
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.42d+29)) then
tmp = -1.0d0
else if (x <= (-1.45d-274)) then
tmp = 1.0d0
else if (x <= 4.1d-290) then
tmp = y * (-0.5d0)
else if (x <= 5.2d-256) then
tmp = 1.0d0
else if (x <= 1.62d-208) then
tmp = y * (-0.5d0)
else if (x <= 4.15d+40) 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.42e+29) {
tmp = -1.0;
} else if (x <= -1.45e-274) {
tmp = 1.0;
} else if (x <= 4.1e-290) {
tmp = y * -0.5;
} else if (x <= 5.2e-256) {
tmp = 1.0;
} else if (x <= 1.62e-208) {
tmp = y * -0.5;
} else if (x <= 4.15e+40) {
tmp = 1.0;
} else {
tmp = -1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.42e+29: tmp = -1.0 elif x <= -1.45e-274: tmp = 1.0 elif x <= 4.1e-290: tmp = y * -0.5 elif x <= 5.2e-256: tmp = 1.0 elif x <= 1.62e-208: tmp = y * -0.5 elif x <= 4.15e+40: tmp = 1.0 else: tmp = -1.0 return tmp
function code(x, y) tmp = 0.0 if (x <= -1.42e+29) tmp = -1.0; elseif (x <= -1.45e-274) tmp = 1.0; elseif (x <= 4.1e-290) tmp = Float64(y * -0.5); elseif (x <= 5.2e-256) tmp = 1.0; elseif (x <= 1.62e-208) tmp = Float64(y * -0.5); elseif (x <= 4.15e+40) tmp = 1.0; else tmp = -1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1.42e+29) tmp = -1.0; elseif (x <= -1.45e-274) tmp = 1.0; elseif (x <= 4.1e-290) tmp = y * -0.5; elseif (x <= 5.2e-256) tmp = 1.0; elseif (x <= 1.62e-208) tmp = y * -0.5; elseif (x <= 4.15e+40) tmp = 1.0; else tmp = -1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.42e+29], -1.0, If[LessEqual[x, -1.45e-274], 1.0, If[LessEqual[x, 4.1e-290], N[(y * -0.5), $MachinePrecision], If[LessEqual[x, 5.2e-256], 1.0, If[LessEqual[x, 1.62e-208], N[(y * -0.5), $MachinePrecision], If[LessEqual[x, 4.15e+40], 1.0, -1.0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.42 \cdot 10^{+29}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \leq -1.45 \cdot 10^{-274}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 4.1 \cdot 10^{-290}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{-256}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.62 \cdot 10^{-208}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;x \leq 4.15 \cdot 10^{+40}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (/ 2.0 y))))
(if (<= x -1.46e+29)
-1.0
(if (<= x -2.8e-243)
t_0
(if (<= x 1.05e-287)
(* y -0.5)
(if (<= x 3.8e-255)
t_0
(if (<= x 6e-211) (* y -0.5) (if (<= x 5e+40) 1.0 -1.0))))))))
double code(double x, double y) {
double t_0 = 1.0 + (2.0 / y);
double tmp;
if (x <= -1.46e+29) {
tmp = -1.0;
} else if (x <= -2.8e-243) {
tmp = t_0;
} else if (x <= 1.05e-287) {
tmp = y * -0.5;
} else if (x <= 3.8e-255) {
tmp = t_0;
} else if (x <= 6e-211) {
tmp = y * -0.5;
} else if (x <= 5e+40) {
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) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + (2.0d0 / y)
if (x <= (-1.46d+29)) then
tmp = -1.0d0
else if (x <= (-2.8d-243)) then
tmp = t_0
else if (x <= 1.05d-287) then
tmp = y * (-0.5d0)
else if (x <= 3.8d-255) then
tmp = t_0
else if (x <= 6d-211) then
tmp = y * (-0.5d0)
else if (x <= 5d+40) then
tmp = 1.0d0
else
tmp = -1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 + (2.0 / y);
double tmp;
if (x <= -1.46e+29) {
tmp = -1.0;
} else if (x <= -2.8e-243) {
tmp = t_0;
} else if (x <= 1.05e-287) {
tmp = y * -0.5;
} else if (x <= 3.8e-255) {
tmp = t_0;
} else if (x <= 6e-211) {
tmp = y * -0.5;
} else if (x <= 5e+40) {
tmp = 1.0;
} else {
tmp = -1.0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + (2.0 / y) tmp = 0 if x <= -1.46e+29: tmp = -1.0 elif x <= -2.8e-243: tmp = t_0 elif x <= 1.05e-287: tmp = y * -0.5 elif x <= 3.8e-255: tmp = t_0 elif x <= 6e-211: tmp = y * -0.5 elif x <= 5e+40: tmp = 1.0 else: tmp = -1.0 return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(2.0 / y)) tmp = 0.0 if (x <= -1.46e+29) tmp = -1.0; elseif (x <= -2.8e-243) tmp = t_0; elseif (x <= 1.05e-287) tmp = Float64(y * -0.5); elseif (x <= 3.8e-255) tmp = t_0; elseif (x <= 6e-211) tmp = Float64(y * -0.5); elseif (x <= 5e+40) tmp = 1.0; else tmp = -1.0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + (2.0 / y); tmp = 0.0; if (x <= -1.46e+29) tmp = -1.0; elseif (x <= -2.8e-243) tmp = t_0; elseif (x <= 1.05e-287) tmp = y * -0.5; elseif (x <= 3.8e-255) tmp = t_0; elseif (x <= 6e-211) tmp = y * -0.5; elseif (x <= 5e+40) tmp = 1.0; else tmp = -1.0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(2.0 / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.46e+29], -1.0, If[LessEqual[x, -2.8e-243], t$95$0, If[LessEqual[x, 1.05e-287], N[(y * -0.5), $MachinePrecision], If[LessEqual[x, 3.8e-255], t$95$0, If[LessEqual[x, 6e-211], N[(y * -0.5), $MachinePrecision], If[LessEqual[x, 5e+40], 1.0, -1.0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{2}{y}\\
\mathbf{if}\;x \leq -1.46 \cdot 10^{+29}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \leq -2.8 \cdot 10^{-243}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.05 \cdot 10^{-287}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;x \leq 3.8 \cdot 10^{-255}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 6 \cdot 10^{-211}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;x \leq 5 \cdot 10^{+40}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
(FPCore (x y) :precision binary64 (if (<= x -5e-27) (/ x (- 2.0 x)) (if (<= x 1.12e+57) (/ (- y) (- 2.0 y)) -1.0)))
double code(double x, double y) {
double tmp;
if (x <= -5e-27) {
tmp = x / (2.0 - x);
} else if (x <= 1.12e+57) {
tmp = -y / (2.0 - y);
} 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 <= (-5d-27)) then
tmp = x / (2.0d0 - x)
else if (x <= 1.12d+57) then
tmp = -y / (2.0d0 - y)
else
tmp = -1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -5e-27) {
tmp = x / (2.0 - x);
} else if (x <= 1.12e+57) {
tmp = -y / (2.0 - y);
} else {
tmp = -1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -5e-27: tmp = x / (2.0 - x) elif x <= 1.12e+57: tmp = -y / (2.0 - y) else: tmp = -1.0 return tmp
function code(x, y) tmp = 0.0 if (x <= -5e-27) tmp = Float64(x / Float64(2.0 - x)); elseif (x <= 1.12e+57) tmp = Float64(Float64(-y) / Float64(2.0 - y)); else tmp = -1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -5e-27) tmp = x / (2.0 - x); elseif (x <= 1.12e+57) tmp = -y / (2.0 - y); else tmp = -1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -5e-27], N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.12e+57], N[((-y) / N[(2.0 - y), $MachinePrecision]), $MachinePrecision], -1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{-27}:\\
\;\;\;\;\frac{x}{2 - x}\\
\mathbf{elif}\;x \leq 1.12 \cdot 10^{+57}:\\
\;\;\;\;\frac{-y}{2 - y}\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\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}
(FPCore (x y) :precision binary64 (if (<= x -1.4e+29) -1.0 (if (<= x 1.25e+42) 1.0 -1.0)))
double code(double x, double y) {
double tmp;
if (x <= -1.4e+29) {
tmp = -1.0;
} else if (x <= 1.25e+42) {
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.4d+29)) then
tmp = -1.0d0
else if (x <= 1.25d+42) 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.4e+29) {
tmp = -1.0;
} else if (x <= 1.25e+42) {
tmp = 1.0;
} else {
tmp = -1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.4e+29: tmp = -1.0 elif x <= 1.25e+42: tmp = 1.0 else: tmp = -1.0 return tmp
function code(x, y) tmp = 0.0 if (x <= -1.4e+29) tmp = -1.0; elseif (x <= 1.25e+42) tmp = 1.0; else tmp = -1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1.4e+29) tmp = -1.0; elseif (x <= 1.25e+42) tmp = 1.0; else tmp = -1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.4e+29], -1.0, If[LessEqual[x, 1.25e+42], 1.0, -1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \cdot 10^{+29}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \leq 1.25 \cdot 10^{+42}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
(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}
(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 2023350
(FPCore (x y)
:name "Data.Colour.RGB:hslsv from colour-2.3.3, C"
:precision binary64
:herbie-target
(- (/ x (- 2.0 (+ x y))) (/ y (- 2.0 (+ x y))))
(/ (- x y) (- 2.0 (+ x y))))