
(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}
(FPCore (x y)
:precision binary64
(if (<= y -7.8)
(+ 1.0 (/ 2.0 y))
(if (<= y -8.2e-216)
-1.0
(if (<= y -5.8e-278)
(* x 0.5)
(if (<= y -1.65e-300)
-1.0
(if (<= y 1.65e-215)
(* x 0.5)
(if (<= y 3.5e+34) -1.0 (- 1.0 (/ x y)))))))))
double code(double x, double y) {
double tmp;
if (y <= -7.8) {
tmp = 1.0 + (2.0 / y);
} else if (y <= -8.2e-216) {
tmp = -1.0;
} else if (y <= -5.8e-278) {
tmp = x * 0.5;
} else if (y <= -1.65e-300) {
tmp = -1.0;
} else if (y <= 1.65e-215) {
tmp = x * 0.5;
} else if (y <= 3.5e+34) {
tmp = -1.0;
} else {
tmp = 1.0 - (x / y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-7.8d0)) then
tmp = 1.0d0 + (2.0d0 / y)
else if (y <= (-8.2d-216)) then
tmp = -1.0d0
else if (y <= (-5.8d-278)) then
tmp = x * 0.5d0
else if (y <= (-1.65d-300)) then
tmp = -1.0d0
else if (y <= 1.65d-215) then
tmp = x * 0.5d0
else if (y <= 3.5d+34) then
tmp = -1.0d0
else
tmp = 1.0d0 - (x / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -7.8) {
tmp = 1.0 + (2.0 / y);
} else if (y <= -8.2e-216) {
tmp = -1.0;
} else if (y <= -5.8e-278) {
tmp = x * 0.5;
} else if (y <= -1.65e-300) {
tmp = -1.0;
} else if (y <= 1.65e-215) {
tmp = x * 0.5;
} else if (y <= 3.5e+34) {
tmp = -1.0;
} else {
tmp = 1.0 - (x / y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -7.8: tmp = 1.0 + (2.0 / y) elif y <= -8.2e-216: tmp = -1.0 elif y <= -5.8e-278: tmp = x * 0.5 elif y <= -1.65e-300: tmp = -1.0 elif y <= 1.65e-215: tmp = x * 0.5 elif y <= 3.5e+34: tmp = -1.0 else: tmp = 1.0 - (x / y) return tmp
function code(x, y) tmp = 0.0 if (y <= -7.8) tmp = Float64(1.0 + Float64(2.0 / y)); elseif (y <= -8.2e-216) tmp = -1.0; elseif (y <= -5.8e-278) tmp = Float64(x * 0.5); elseif (y <= -1.65e-300) tmp = -1.0; elseif (y <= 1.65e-215) tmp = Float64(x * 0.5); elseif (y <= 3.5e+34) tmp = -1.0; else tmp = Float64(1.0 - Float64(x / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -7.8) tmp = 1.0 + (2.0 / y); elseif (y <= -8.2e-216) tmp = -1.0; elseif (y <= -5.8e-278) tmp = x * 0.5; elseif (y <= -1.65e-300) tmp = -1.0; elseif (y <= 1.65e-215) tmp = x * 0.5; elseif (y <= 3.5e+34) tmp = -1.0; else tmp = 1.0 - (x / y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -7.8], N[(1.0 + N[(2.0 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -8.2e-216], -1.0, If[LessEqual[y, -5.8e-278], N[(x * 0.5), $MachinePrecision], If[LessEqual[y, -1.65e-300], -1.0, If[LessEqual[y, 1.65e-215], N[(x * 0.5), $MachinePrecision], If[LessEqual[y, 3.5e+34], -1.0, N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.8:\\
\;\;\;\;1 + \frac{2}{y}\\
\mathbf{elif}\;y \leq -8.2 \cdot 10^{-216}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq -5.8 \cdot 10^{-278}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;y \leq -1.65 \cdot 10^{-300}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq 1.65 \cdot 10^{-215}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;y \leq 3.5 \cdot 10^{+34}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{y}\\
\end{array}
\end{array}
(FPCore (x y)
:precision binary64
(if (<= y -7.8)
(+ 1.0 (/ 2.0 y))
(if (<= y -7.6e-216)
(+ (/ y x) -1.0)
(if (<= y -1.9e-277)
(* x 0.5)
(if (<= y -1.45e-300)
-1.0
(if (<= y 7.6e-216)
(* x 0.5)
(if (<= y 2.4e+34) -1.0 (- 1.0 (/ x y)))))))))
double code(double x, double y) {
double tmp;
if (y <= -7.8) {
tmp = 1.0 + (2.0 / y);
} else if (y <= -7.6e-216) {
tmp = (y / x) + -1.0;
} else if (y <= -1.9e-277) {
tmp = x * 0.5;
} else if (y <= -1.45e-300) {
tmp = -1.0;
} else if (y <= 7.6e-216) {
tmp = x * 0.5;
} else if (y <= 2.4e+34) {
tmp = -1.0;
} else {
tmp = 1.0 - (x / y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-7.8d0)) then
tmp = 1.0d0 + (2.0d0 / y)
else if (y <= (-7.6d-216)) then
tmp = (y / x) + (-1.0d0)
else if (y <= (-1.9d-277)) then
tmp = x * 0.5d0
else if (y <= (-1.45d-300)) then
tmp = -1.0d0
else if (y <= 7.6d-216) then
tmp = x * 0.5d0
else if (y <= 2.4d+34) then
tmp = -1.0d0
else
tmp = 1.0d0 - (x / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -7.8) {
tmp = 1.0 + (2.0 / y);
} else if (y <= -7.6e-216) {
tmp = (y / x) + -1.0;
} else if (y <= -1.9e-277) {
tmp = x * 0.5;
} else if (y <= -1.45e-300) {
tmp = -1.0;
} else if (y <= 7.6e-216) {
tmp = x * 0.5;
} else if (y <= 2.4e+34) {
tmp = -1.0;
} else {
tmp = 1.0 - (x / y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -7.8: tmp = 1.0 + (2.0 / y) elif y <= -7.6e-216: tmp = (y / x) + -1.0 elif y <= -1.9e-277: tmp = x * 0.5 elif y <= -1.45e-300: tmp = -1.0 elif y <= 7.6e-216: tmp = x * 0.5 elif y <= 2.4e+34: tmp = -1.0 else: tmp = 1.0 - (x / y) return tmp
function code(x, y) tmp = 0.0 if (y <= -7.8) tmp = Float64(1.0 + Float64(2.0 / y)); elseif (y <= -7.6e-216) tmp = Float64(Float64(y / x) + -1.0); elseif (y <= -1.9e-277) tmp = Float64(x * 0.5); elseif (y <= -1.45e-300) tmp = -1.0; elseif (y <= 7.6e-216) tmp = Float64(x * 0.5); elseif (y <= 2.4e+34) tmp = -1.0; else tmp = Float64(1.0 - Float64(x / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -7.8) tmp = 1.0 + (2.0 / y); elseif (y <= -7.6e-216) tmp = (y / x) + -1.0; elseif (y <= -1.9e-277) tmp = x * 0.5; elseif (y <= -1.45e-300) tmp = -1.0; elseif (y <= 7.6e-216) tmp = x * 0.5; elseif (y <= 2.4e+34) tmp = -1.0; else tmp = 1.0 - (x / y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -7.8], N[(1.0 + N[(2.0 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -7.6e-216], N[(N[(y / x), $MachinePrecision] + -1.0), $MachinePrecision], If[LessEqual[y, -1.9e-277], N[(x * 0.5), $MachinePrecision], If[LessEqual[y, -1.45e-300], -1.0, If[LessEqual[y, 7.6e-216], N[(x * 0.5), $MachinePrecision], If[LessEqual[y, 2.4e+34], -1.0, N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.8:\\
\;\;\;\;1 + \frac{2}{y}\\
\mathbf{elif}\;y \leq -7.6 \cdot 10^{-216}:\\
\;\;\;\;\frac{y}{x} + -1\\
\mathbf{elif}\;y \leq -1.9 \cdot 10^{-277}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;y \leq -1.45 \cdot 10^{-300}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq 7.6 \cdot 10^{-216}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;y \leq 2.4 \cdot 10^{+34}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{y}\\
\end{array}
\end{array}
(FPCore (x y)
:precision binary64
(if (<= y -7.8)
1.0
(if (<= y -6.2e-216)
-1.0
(if (<= y -1.8e-275)
(* x 0.5)
(if (<= y -1.22e-300)
-1.0
(if (<= y 7e-216) (* x 0.5) (if (<= y 2e+34) -1.0 1.0)))))))
double code(double x, double y) {
double tmp;
if (y <= -7.8) {
tmp = 1.0;
} else if (y <= -6.2e-216) {
tmp = -1.0;
} else if (y <= -1.8e-275) {
tmp = x * 0.5;
} else if (y <= -1.22e-300) {
tmp = -1.0;
} else if (y <= 7e-216) {
tmp = x * 0.5;
} else if (y <= 2e+34) {
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 <= (-7.8d0)) then
tmp = 1.0d0
else if (y <= (-6.2d-216)) then
tmp = -1.0d0
else if (y <= (-1.8d-275)) then
tmp = x * 0.5d0
else if (y <= (-1.22d-300)) then
tmp = -1.0d0
else if (y <= 7d-216) then
tmp = x * 0.5d0
else if (y <= 2d+34) 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 <= -7.8) {
tmp = 1.0;
} else if (y <= -6.2e-216) {
tmp = -1.0;
} else if (y <= -1.8e-275) {
tmp = x * 0.5;
} else if (y <= -1.22e-300) {
tmp = -1.0;
} else if (y <= 7e-216) {
tmp = x * 0.5;
} else if (y <= 2e+34) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -7.8: tmp = 1.0 elif y <= -6.2e-216: tmp = -1.0 elif y <= -1.8e-275: tmp = x * 0.5 elif y <= -1.22e-300: tmp = -1.0 elif y <= 7e-216: tmp = x * 0.5 elif y <= 2e+34: tmp = -1.0 else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -7.8) tmp = 1.0; elseif (y <= -6.2e-216) tmp = -1.0; elseif (y <= -1.8e-275) tmp = Float64(x * 0.5); elseif (y <= -1.22e-300) tmp = -1.0; elseif (y <= 7e-216) tmp = Float64(x * 0.5); elseif (y <= 2e+34) tmp = -1.0; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -7.8) tmp = 1.0; elseif (y <= -6.2e-216) tmp = -1.0; elseif (y <= -1.8e-275) tmp = x * 0.5; elseif (y <= -1.22e-300) tmp = -1.0; elseif (y <= 7e-216) tmp = x * 0.5; elseif (y <= 2e+34) tmp = -1.0; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -7.8], 1.0, If[LessEqual[y, -6.2e-216], -1.0, If[LessEqual[y, -1.8e-275], N[(x * 0.5), $MachinePrecision], If[LessEqual[y, -1.22e-300], -1.0, If[LessEqual[y, 7e-216], N[(x * 0.5), $MachinePrecision], If[LessEqual[y, 2e+34], -1.0, 1.0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.8:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -6.2 \cdot 10^{-216}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq -1.8 \cdot 10^{-275}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;y \leq -1.22 \cdot 10^{-300}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq 7 \cdot 10^{-216}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+34}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
(FPCore (x y)
:precision binary64
(if (<= y -7.8)
(+ 1.0 (/ 2.0 y))
(if (<= y -1.4e-215)
-1.0
(if (<= y -1.1e-278)
(* x 0.5)
(if (<= y -1.75e-300)
-1.0
(if (<= y 7.2e-215) (* x 0.5) (if (<= y 1.04e+34) -1.0 1.0)))))))
double code(double x, double y) {
double tmp;
if (y <= -7.8) {
tmp = 1.0 + (2.0 / y);
} else if (y <= -1.4e-215) {
tmp = -1.0;
} else if (y <= -1.1e-278) {
tmp = x * 0.5;
} else if (y <= -1.75e-300) {
tmp = -1.0;
} else if (y <= 7.2e-215) {
tmp = x * 0.5;
} else if (y <= 1.04e+34) {
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 <= (-7.8d0)) then
tmp = 1.0d0 + (2.0d0 / y)
else if (y <= (-1.4d-215)) then
tmp = -1.0d0
else if (y <= (-1.1d-278)) then
tmp = x * 0.5d0
else if (y <= (-1.75d-300)) then
tmp = -1.0d0
else if (y <= 7.2d-215) then
tmp = x * 0.5d0
else if (y <= 1.04d+34) 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 <= -7.8) {
tmp = 1.0 + (2.0 / y);
} else if (y <= -1.4e-215) {
tmp = -1.0;
} else if (y <= -1.1e-278) {
tmp = x * 0.5;
} else if (y <= -1.75e-300) {
tmp = -1.0;
} else if (y <= 7.2e-215) {
tmp = x * 0.5;
} else if (y <= 1.04e+34) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -7.8: tmp = 1.0 + (2.0 / y) elif y <= -1.4e-215: tmp = -1.0 elif y <= -1.1e-278: tmp = x * 0.5 elif y <= -1.75e-300: tmp = -1.0 elif y <= 7.2e-215: tmp = x * 0.5 elif y <= 1.04e+34: tmp = -1.0 else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -7.8) tmp = Float64(1.0 + Float64(2.0 / y)); elseif (y <= -1.4e-215) tmp = -1.0; elseif (y <= -1.1e-278) tmp = Float64(x * 0.5); elseif (y <= -1.75e-300) tmp = -1.0; elseif (y <= 7.2e-215) tmp = Float64(x * 0.5); elseif (y <= 1.04e+34) tmp = -1.0; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -7.8) tmp = 1.0 + (2.0 / y); elseif (y <= -1.4e-215) tmp = -1.0; elseif (y <= -1.1e-278) tmp = x * 0.5; elseif (y <= -1.75e-300) tmp = -1.0; elseif (y <= 7.2e-215) tmp = x * 0.5; elseif (y <= 1.04e+34) tmp = -1.0; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -7.8], N[(1.0 + N[(2.0 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -1.4e-215], -1.0, If[LessEqual[y, -1.1e-278], N[(x * 0.5), $MachinePrecision], If[LessEqual[y, -1.75e-300], -1.0, If[LessEqual[y, 7.2e-215], N[(x * 0.5), $MachinePrecision], If[LessEqual[y, 1.04e+34], -1.0, 1.0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.8:\\
\;\;\;\;1 + \frac{2}{y}\\
\mathbf{elif}\;y \leq -1.4 \cdot 10^{-215}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq -1.1 \cdot 10^{-278}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;y \leq -1.75 \cdot 10^{-300}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq 7.2 \cdot 10^{-215}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;y \leq 1.04 \cdot 10^{+34}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
(FPCore (x y) :precision binary64 (if (<= y -7.8) (+ 1.0 (/ 2.0 y)) (if (<= y 3.45e+77) (/ x (- 2.0 x)) (- 1.0 (/ x y)))))
double code(double x, double y) {
double tmp;
if (y <= -7.8) {
tmp = 1.0 + (2.0 / y);
} else if (y <= 3.45e+77) {
tmp = x / (2.0 - x);
} else {
tmp = 1.0 - (x / y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-7.8d0)) then
tmp = 1.0d0 + (2.0d0 / y)
else if (y <= 3.45d+77) then
tmp = x / (2.0d0 - x)
else
tmp = 1.0d0 - (x / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -7.8) {
tmp = 1.0 + (2.0 / y);
} else if (y <= 3.45e+77) {
tmp = x / (2.0 - x);
} else {
tmp = 1.0 - (x / y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -7.8: tmp = 1.0 + (2.0 / y) elif y <= 3.45e+77: tmp = x / (2.0 - x) else: tmp = 1.0 - (x / y) return tmp
function code(x, y) tmp = 0.0 if (y <= -7.8) tmp = Float64(1.0 + Float64(2.0 / y)); elseif (y <= 3.45e+77) tmp = Float64(x / Float64(2.0 - x)); else tmp = Float64(1.0 - Float64(x / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -7.8) tmp = 1.0 + (2.0 / y); elseif (y <= 3.45e+77) tmp = x / (2.0 - x); else tmp = 1.0 - (x / y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -7.8], N[(1.0 + N[(2.0 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.45e+77], N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.8:\\
\;\;\;\;1 + \frac{2}{y}\\
\mathbf{elif}\;y \leq 3.45 \cdot 10^{+77}:\\
\;\;\;\;\frac{x}{2 - x}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{y}\\
\end{array}
\end{array}
(FPCore (x y) :precision binary64 (if (<= y -8.6e-35) (/ (- y) (- 2.0 y)) (if (<= y 3.45e+77) (/ x (- 2.0 x)) (- 1.0 (/ x y)))))
double code(double x, double y) {
double tmp;
if (y <= -8.6e-35) {
tmp = -y / (2.0 - y);
} else if (y <= 3.45e+77) {
tmp = x / (2.0 - x);
} else {
tmp = 1.0 - (x / y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-8.6d-35)) then
tmp = -y / (2.0d0 - y)
else if (y <= 3.45d+77) then
tmp = x / (2.0d0 - x)
else
tmp = 1.0d0 - (x / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -8.6e-35) {
tmp = -y / (2.0 - y);
} else if (y <= 3.45e+77) {
tmp = x / (2.0 - x);
} else {
tmp = 1.0 - (x / y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -8.6e-35: tmp = -y / (2.0 - y) elif y <= 3.45e+77: tmp = x / (2.0 - x) else: tmp = 1.0 - (x / y) return tmp
function code(x, y) tmp = 0.0 if (y <= -8.6e-35) tmp = Float64(Float64(-y) / Float64(2.0 - y)); elseif (y <= 3.45e+77) tmp = Float64(x / Float64(2.0 - x)); else tmp = Float64(1.0 - Float64(x / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -8.6e-35) tmp = -y / (2.0 - y); elseif (y <= 3.45e+77) tmp = x / (2.0 - x); else tmp = 1.0 - (x / y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -8.6e-35], N[((-y) / N[(2.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.45e+77], N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.6 \cdot 10^{-35}:\\
\;\;\;\;\frac{-y}{2 - y}\\
\mathbf{elif}\;y \leq 3.45 \cdot 10^{+77}:\\
\;\;\;\;\frac{x}{2 - x}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{y}\\
\end{array}
\end{array}
(FPCore (x y) :precision binary64 (if (<= y -7.8) 1.0 (if (<= y 5e+34) -1.0 1.0)))
double code(double x, double y) {
double tmp;
if (y <= -7.8) {
tmp = 1.0;
} else if (y <= 5e+34) {
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 <= (-7.8d0)) then
tmp = 1.0d0
else if (y <= 5d+34) 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 <= -7.8) {
tmp = 1.0;
} else if (y <= 5e+34) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -7.8: tmp = 1.0 elif y <= 5e+34: tmp = -1.0 else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -7.8) tmp = 1.0; elseif (y <= 5e+34) tmp = -1.0; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -7.8) tmp = 1.0; elseif (y <= 5e+34) tmp = -1.0; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -7.8], 1.0, If[LessEqual[y, 5e+34], -1.0, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.8:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 5 \cdot 10^{+34}:\\
\;\;\;\;-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 2024008
(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))))