
(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 10 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 (<= x -9.8e+64)
(+ -1.0 (/ y x))
(if (<= x 1.9e-100)
(/ y (+ y -2.0))
(if (<= x 4.6e-18)
(/ x (- 2.0 x))
(if (<= x 4.55e+24) 1.0 (/ (- x y) (- x)))))))
double code(double x, double y) {
double tmp;
if (x <= -9.8e+64) {
tmp = -1.0 + (y / x);
} else if (x <= 1.9e-100) {
tmp = y / (y + -2.0);
} else if (x <= 4.6e-18) {
tmp = x / (2.0 - x);
} else if (x <= 4.55e+24) {
tmp = 1.0;
} else {
tmp = (x - 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 <= (-9.8d+64)) then
tmp = (-1.0d0) + (y / x)
else if (x <= 1.9d-100) then
tmp = y / (y + (-2.0d0))
else if (x <= 4.6d-18) then
tmp = x / (2.0d0 - x)
else if (x <= 4.55d+24) then
tmp = 1.0d0
else
tmp = (x - y) / -x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -9.8e+64) {
tmp = -1.0 + (y / x);
} else if (x <= 1.9e-100) {
tmp = y / (y + -2.0);
} else if (x <= 4.6e-18) {
tmp = x / (2.0 - x);
} else if (x <= 4.55e+24) {
tmp = 1.0;
} else {
tmp = (x - y) / -x;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -9.8e+64: tmp = -1.0 + (y / x) elif x <= 1.9e-100: tmp = y / (y + -2.0) elif x <= 4.6e-18: tmp = x / (2.0 - x) elif x <= 4.55e+24: tmp = 1.0 else: tmp = (x - y) / -x return tmp
function code(x, y) tmp = 0.0 if (x <= -9.8e+64) tmp = Float64(-1.0 + Float64(y / x)); elseif (x <= 1.9e-100) tmp = Float64(y / Float64(y + -2.0)); elseif (x <= 4.6e-18) tmp = Float64(x / Float64(2.0 - x)); elseif (x <= 4.55e+24) tmp = 1.0; else tmp = Float64(Float64(x - y) / Float64(-x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -9.8e+64) tmp = -1.0 + (y / x); elseif (x <= 1.9e-100) tmp = y / (y + -2.0); elseif (x <= 4.6e-18) tmp = x / (2.0 - x); elseif (x <= 4.55e+24) tmp = 1.0; else tmp = (x - y) / -x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -9.8e+64], N[(-1.0 + N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.9e-100], N[(y / N[(y + -2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.6e-18], N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.55e+24], 1.0, N[(N[(x - y), $MachinePrecision] / (-x)), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.8 \cdot 10^{+64}:\\
\;\;\;\;-1 + \frac{y}{x}\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{-100}:\\
\;\;\;\;\frac{y}{y + -2}\\
\mathbf{elif}\;x \leq 4.6 \cdot 10^{-18}:\\
\;\;\;\;\frac{x}{2 - x}\\
\mathbf{elif}\;x \leq 4.55 \cdot 10^{+24}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{x - y}{-x}\\
\end{array}
\end{array}
(FPCore (x y)
:precision binary64
(let* ((t_0 (- 1.0 (/ x y))) (t_1 (/ x (- 2.0 x))))
(if (<= y -9e-20)
t_0
(if (<= y -1.55e-89)
t_1
(if (<= y -1.9e-133) (* y -0.5) (if (<= y 2.2e+30) t_1 t_0))))))
double code(double x, double y) {
double t_0 = 1.0 - (x / y);
double t_1 = x / (2.0 - x);
double tmp;
if (y <= -9e-20) {
tmp = t_0;
} else if (y <= -1.55e-89) {
tmp = t_1;
} else if (y <= -1.9e-133) {
tmp = y * -0.5;
} else if (y <= 2.2e+30) {
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)
t_1 = x / (2.0d0 - x)
if (y <= (-9d-20)) then
tmp = t_0
else if (y <= (-1.55d-89)) then
tmp = t_1
else if (y <= (-1.9d-133)) then
tmp = y * (-0.5d0)
else if (y <= 2.2d+30) 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);
double t_1 = x / (2.0 - x);
double tmp;
if (y <= -9e-20) {
tmp = t_0;
} else if (y <= -1.55e-89) {
tmp = t_1;
} else if (y <= -1.9e-133) {
tmp = y * -0.5;
} else if (y <= 2.2e+30) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 - (x / y) t_1 = x / (2.0 - x) tmp = 0 if y <= -9e-20: tmp = t_0 elif y <= -1.55e-89: tmp = t_1 elif y <= -1.9e-133: tmp = y * -0.5 elif y <= 2.2e+30: tmp = t_1 else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 - Float64(x / y)) t_1 = Float64(x / Float64(2.0 - x)) tmp = 0.0 if (y <= -9e-20) tmp = t_0; elseif (y <= -1.55e-89) tmp = t_1; elseif (y <= -1.9e-133) tmp = Float64(y * -0.5); elseif (y <= 2.2e+30) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 - (x / y); t_1 = x / (2.0 - x); tmp = 0.0; if (y <= -9e-20) tmp = t_0; elseif (y <= -1.55e-89) tmp = t_1; elseif (y <= -1.9e-133) tmp = y * -0.5; elseif (y <= 2.2e+30) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -9e-20], t$95$0, If[LessEqual[y, -1.55e-89], t$95$1, If[LessEqual[y, -1.9e-133], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 2.2e+30], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \frac{x}{y}\\
t_1 := \frac{x}{2 - x}\\
\mathbf{if}\;y \leq -9 \cdot 10^{-20}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -1.55 \cdot 10^{-89}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -1.9 \cdot 10^{-133}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 2.2 \cdot 10^{+30}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ -1.0 (/ y x))))
(if (<= x -1.55e+62)
t_0
(if (<= x 6e-103)
(/ y (+ y -2.0))
(if (<= x 7e-19) (/ x (- 2.0 x)) (if (<= x 4.8e+24) 1.0 t_0))))))
double code(double x, double y) {
double t_0 = -1.0 + (y / x);
double tmp;
if (x <= -1.55e+62) {
tmp = t_0;
} else if (x <= 6e-103) {
tmp = y / (y + -2.0);
} else if (x <= 7e-19) {
tmp = x / (2.0 - x);
} else if (x <= 4.8e+24) {
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.55d+62)) then
tmp = t_0
else if (x <= 6d-103) then
tmp = y / (y + (-2.0d0))
else if (x <= 7d-19) then
tmp = x / (2.0d0 - x)
else if (x <= 4.8d+24) 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.55e+62) {
tmp = t_0;
} else if (x <= 6e-103) {
tmp = y / (y + -2.0);
} else if (x <= 7e-19) {
tmp = x / (2.0 - x);
} else if (x <= 4.8e+24) {
tmp = 1.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = -1.0 + (y / x) tmp = 0 if x <= -1.55e+62: tmp = t_0 elif x <= 6e-103: tmp = y / (y + -2.0) elif x <= 7e-19: tmp = x / (2.0 - x) elif x <= 4.8e+24: 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.55e+62) tmp = t_0; elseif (x <= 6e-103) tmp = Float64(y / Float64(y + -2.0)); elseif (x <= 7e-19) tmp = Float64(x / Float64(2.0 - x)); elseif (x <= 4.8e+24) 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.55e+62) tmp = t_0; elseif (x <= 6e-103) tmp = y / (y + -2.0); elseif (x <= 7e-19) tmp = x / (2.0 - x); elseif (x <= 4.8e+24) 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.55e+62], t$95$0, If[LessEqual[x, 6e-103], N[(y / N[(y + -2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7e-19], N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.8e+24], 1.0, t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -1 + \frac{y}{x}\\
\mathbf{if}\;x \leq -1.55 \cdot 10^{+62}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 6 \cdot 10^{-103}:\\
\;\;\;\;\frac{y}{y + -2}\\
\mathbf{elif}\;x \leq 7 \cdot 10^{-19}:\\
\;\;\;\;\frac{x}{2 - x}\\
\mathbf{elif}\;x \leq 4.8 \cdot 10^{+24}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
(FPCore (x y) :precision binary64 (if (or (<= x -6.2e+62) (not (<= x 4.7e+24))) (- -1.0 (/ (+ 2.0 (* y -2.0)) x)) (/ (- x y) (- 2.0 y))))
double code(double x, double y) {
double tmp;
if ((x <= -6.2e+62) || !(x <= 4.7e+24)) {
tmp = -1.0 - ((2.0 + (y * -2.0)) / x);
} else {
tmp = (x - y) / (2.0 - y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((x <= (-6.2d+62)) .or. (.not. (x <= 4.7d+24))) then
tmp = (-1.0d0) - ((2.0d0 + (y * (-2.0d0))) / x)
else
tmp = (x - y) / (2.0d0 - y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -6.2e+62) || !(x <= 4.7e+24)) {
tmp = -1.0 - ((2.0 + (y * -2.0)) / x);
} else {
tmp = (x - y) / (2.0 - y);
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -6.2e+62) or not (x <= 4.7e+24): tmp = -1.0 - ((2.0 + (y * -2.0)) / x) else: tmp = (x - y) / (2.0 - y) return tmp
function code(x, y) tmp = 0.0 if ((x <= -6.2e+62) || !(x <= 4.7e+24)) tmp = Float64(-1.0 - Float64(Float64(2.0 + Float64(y * -2.0)) / x)); else tmp = Float64(Float64(x - y) / Float64(2.0 - y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -6.2e+62) || ~((x <= 4.7e+24))) tmp = -1.0 - ((2.0 + (y * -2.0)) / x); else tmp = (x - y) / (2.0 - y); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -6.2e+62], N[Not[LessEqual[x, 4.7e+24]], $MachinePrecision]], N[(-1.0 - N[(N[(2.0 + N[(y * -2.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(N[(x - y), $MachinePrecision] / N[(2.0 - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.2 \cdot 10^{+62} \lor \neg \left(x \leq 4.7 \cdot 10^{+24}\right):\\
\;\;\;\;-1 - \frac{2 + y \cdot -2}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - y}{2 - y}\\
\end{array}
\end{array}
(FPCore (x y)
:precision binary64
(let* ((t_0 (- 1.0 (/ x y))))
(if (<= y -1.8)
t_0
(if (<= y -2.05e-134) (* y -0.5) (if (<= y 4.8e+31) -1.0 t_0)))))
double code(double x, double y) {
double t_0 = 1.0 - (x / y);
double tmp;
if (y <= -1.8) {
tmp = t_0;
} else if (y <= -2.05e-134) {
tmp = y * -0.5;
} else if (y <= 4.8e+31) {
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 - (x / y)
if (y <= (-1.8d0)) then
tmp = t_0
else if (y <= (-2.05d-134)) then
tmp = y * (-0.5d0)
else if (y <= 4.8d+31) 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 - (x / y);
double tmp;
if (y <= -1.8) {
tmp = t_0;
} else if (y <= -2.05e-134) {
tmp = y * -0.5;
} else if (y <= 4.8e+31) {
tmp = -1.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 - (x / y) tmp = 0 if y <= -1.8: tmp = t_0 elif y <= -2.05e-134: tmp = y * -0.5 elif y <= 4.8e+31: tmp = -1.0 else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 - Float64(x / y)) tmp = 0.0 if (y <= -1.8) tmp = t_0; elseif (y <= -2.05e-134) tmp = Float64(y * -0.5); elseif (y <= 4.8e+31) tmp = -1.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 - (x / y); tmp = 0.0; if (y <= -1.8) tmp = t_0; elseif (y <= -2.05e-134) tmp = y * -0.5; elseif (y <= 4.8e+31) tmp = -1.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.8], t$95$0, If[LessEqual[y, -2.05e-134], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 4.8e+31], -1.0, t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \frac{x}{y}\\
\mathbf{if}\;y \leq -1.8:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -2.05 \cdot 10^{-134}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 4.8 \cdot 10^{+31}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
(FPCore (x y) :precision binary64 (if (<= x -1.55e+62) (+ -1.0 (/ y x)) (if (<= x 5.2e+29) (/ (- x y) (- 2.0 y)) (/ (- x y) (- x)))))
double code(double x, double y) {
double tmp;
if (x <= -1.55e+62) {
tmp = -1.0 + (y / x);
} else if (x <= 5.2e+29) {
tmp = (x - y) / (2.0 - y);
} else {
tmp = (x - 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.55d+62)) then
tmp = (-1.0d0) + (y / x)
else if (x <= 5.2d+29) then
tmp = (x - y) / (2.0d0 - y)
else
tmp = (x - y) / -x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -1.55e+62) {
tmp = -1.0 + (y / x);
} else if (x <= 5.2e+29) {
tmp = (x - y) / (2.0 - y);
} else {
tmp = (x - y) / -x;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.55e+62: tmp = -1.0 + (y / x) elif x <= 5.2e+29: tmp = (x - y) / (2.0 - y) else: tmp = (x - y) / -x return tmp
function code(x, y) tmp = 0.0 if (x <= -1.55e+62) tmp = Float64(-1.0 + Float64(y / x)); elseif (x <= 5.2e+29) tmp = Float64(Float64(x - y) / Float64(2.0 - y)); else tmp = Float64(Float64(x - y) / Float64(-x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1.55e+62) tmp = -1.0 + (y / x); elseif (x <= 5.2e+29) tmp = (x - y) / (2.0 - y); else tmp = (x - y) / -x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.55e+62], N[(-1.0 + N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.2e+29], N[(N[(x - y), $MachinePrecision] / N[(2.0 - y), $MachinePrecision]), $MachinePrecision], N[(N[(x - y), $MachinePrecision] / (-x)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.55 \cdot 10^{+62}:\\
\;\;\;\;-1 + \frac{y}{x}\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{+29}:\\
\;\;\;\;\frac{x - y}{2 - y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - y}{-x}\\
\end{array}
\end{array}
(FPCore (x y) :precision binary64 (if (<= y -2.0) 1.0 (if (<= y -2.1e-133) (* y -0.5) (if (<= y 8.5e+29) -1.0 1.0))))
double code(double x, double y) {
double tmp;
if (y <= -2.0) {
tmp = 1.0;
} else if (y <= -2.1e-133) {
tmp = y * -0.5;
} else if (y <= 8.5e+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 <= (-2.0d0)) then
tmp = 1.0d0
else if (y <= (-2.1d-133)) then
tmp = y * (-0.5d0)
else if (y <= 8.5d+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 <= -2.0) {
tmp = 1.0;
} else if (y <= -2.1e-133) {
tmp = y * -0.5;
} else if (y <= 8.5e+29) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -2.0: tmp = 1.0 elif y <= -2.1e-133: tmp = y * -0.5 elif y <= 8.5e+29: tmp = -1.0 else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -2.0) tmp = 1.0; elseif (y <= -2.1e-133) tmp = Float64(y * -0.5); elseif (y <= 8.5e+29) tmp = -1.0; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -2.0) tmp = 1.0; elseif (y <= -2.1e-133) tmp = y * -0.5; elseif (y <= 8.5e+29) tmp = -1.0; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -2.0], 1.0, If[LessEqual[y, -2.1e-133], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 8.5e+29], -1.0, 1.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -2.1 \cdot 10^{-133}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 8.5 \cdot 10^{+29}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
(FPCore (x y) :precision binary64 (if (<= y -9e-20) 1.0 (if (<= y 1.2e+30) -1.0 1.0)))
double code(double x, double y) {
double tmp;
if (y <= -9e-20) {
tmp = 1.0;
} else if (y <= 1.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 (y <= (-9d-20)) then
tmp = 1.0d0
else if (y <= 1.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 (y <= -9e-20) {
tmp = 1.0;
} else if (y <= 1.2e+30) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -9e-20: tmp = 1.0 elif y <= 1.2e+30: tmp = -1.0 else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -9e-20) tmp = 1.0; elseif (y <= 1.2e+30) tmp = -1.0; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -9e-20) tmp = 1.0; elseif (y <= 1.2e+30) tmp = -1.0; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -9e-20], 1.0, If[LessEqual[y, 1.2e+30], -1.0, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9 \cdot 10^{-20}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{+30}:\\
\;\;\;\;-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 2023348
(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))))