
(FPCore (x y) :precision binary64 (/ (+ x y) (+ y 1.0)))
double code(double x, double y) {
return (x + y) / (y + 1.0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x + y) / (y + 1.0d0)
end function
public static double code(double x, double y) {
return (x + y) / (y + 1.0);
}
def code(x, y): return (x + y) / (y + 1.0)
function code(x, y) return Float64(Float64(x + y) / Float64(y + 1.0)) end
function tmp = code(x, y) tmp = (x + y) / (y + 1.0); end
code[x_, y_] := N[(N[(x + y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + y}{y + 1}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (+ x y) (+ y 1.0)))
double code(double x, double y) {
return (x + y) / (y + 1.0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x + y) / (y + 1.0d0)
end function
public static double code(double x, double y) {
return (x + y) / (y + 1.0);
}
def code(x, y): return (x + y) / (y + 1.0)
function code(x, y) return Float64(Float64(x + y) / Float64(y + 1.0)) end
function tmp = code(x, y) tmp = (x + y) / (y + 1.0); end
code[x_, y_] := N[(N[(x + y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + y}{y + 1}
\end{array}
(FPCore (x y) :precision binary64 (/ (+ x y) (+ y 1.0)))
double code(double x, double y) {
return (x + y) / (y + 1.0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x + y) / (y + 1.0d0)
end function
public static double code(double x, double y) {
return (x + y) / (y + 1.0);
}
def code(x, y): return (x + y) / (y + 1.0)
function code(x, y) return Float64(Float64(x + y) / Float64(y + 1.0)) end
function tmp = code(x, y) tmp = (x + y) / (y + 1.0); end
code[x_, y_] := N[(N[(x + y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + y}{y + 1}
\end{array}
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (+ y 1.0))) (t_1 (/ y (+ y 1.0))))
(if (<= x -4.2e+64)
t_0
(if (<= x -5.8e+18)
t_1
(if (<= x -2.2e-39)
t_0
(if (<= x 1.1e-70)
t_1
(if (or (<= x 1.22e+89) (not (<= x 1.6e+141))) t_0 1.0)))))))
double code(double x, double y) {
double t_0 = x / (y + 1.0);
double t_1 = y / (y + 1.0);
double tmp;
if (x <= -4.2e+64) {
tmp = t_0;
} else if (x <= -5.8e+18) {
tmp = t_1;
} else if (x <= -2.2e-39) {
tmp = t_0;
} else if (x <= 1.1e-70) {
tmp = t_1;
} else if ((x <= 1.22e+89) || !(x <= 1.6e+141)) {
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) :: t_1
real(8) :: tmp
t_0 = x / (y + 1.0d0)
t_1 = y / (y + 1.0d0)
if (x <= (-4.2d+64)) then
tmp = t_0
else if (x <= (-5.8d+18)) then
tmp = t_1
else if (x <= (-2.2d-39)) then
tmp = t_0
else if (x <= 1.1d-70) then
tmp = t_1
else if ((x <= 1.22d+89) .or. (.not. (x <= 1.6d+141))) 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 / (y + 1.0);
double t_1 = y / (y + 1.0);
double tmp;
if (x <= -4.2e+64) {
tmp = t_0;
} else if (x <= -5.8e+18) {
tmp = t_1;
} else if (x <= -2.2e-39) {
tmp = t_0;
} else if (x <= 1.1e-70) {
tmp = t_1;
} else if ((x <= 1.22e+89) || !(x <= 1.6e+141)) {
tmp = t_0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): t_0 = x / (y + 1.0) t_1 = y / (y + 1.0) tmp = 0 if x <= -4.2e+64: tmp = t_0 elif x <= -5.8e+18: tmp = t_1 elif x <= -2.2e-39: tmp = t_0 elif x <= 1.1e-70: tmp = t_1 elif (x <= 1.22e+89) or not (x <= 1.6e+141): tmp = t_0 else: tmp = 1.0 return tmp
function code(x, y) t_0 = Float64(x / Float64(y + 1.0)) t_1 = Float64(y / Float64(y + 1.0)) tmp = 0.0 if (x <= -4.2e+64) tmp = t_0; elseif (x <= -5.8e+18) tmp = t_1; elseif (x <= -2.2e-39) tmp = t_0; elseif (x <= 1.1e-70) tmp = t_1; elseif ((x <= 1.22e+89) || !(x <= 1.6e+141)) tmp = t_0; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) t_0 = x / (y + 1.0); t_1 = y / (y + 1.0); tmp = 0.0; if (x <= -4.2e+64) tmp = t_0; elseif (x <= -5.8e+18) tmp = t_1; elseif (x <= -2.2e-39) tmp = t_0; elseif (x <= 1.1e-70) tmp = t_1; elseif ((x <= 1.22e+89) || ~((x <= 1.6e+141))) tmp = t_0; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4.2e+64], t$95$0, If[LessEqual[x, -5.8e+18], t$95$1, If[LessEqual[x, -2.2e-39], t$95$0, If[LessEqual[x, 1.1e-70], t$95$1, If[Or[LessEqual[x, 1.22e+89], N[Not[LessEqual[x, 1.6e+141]], $MachinePrecision]], t$95$0, 1.0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{y + 1}\\
t_1 := \frac{y}{y + 1}\\
\mathbf{if}\;x \leq -4.2 \cdot 10^{+64}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -5.8 \cdot 10^{+18}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -2.2 \cdot 10^{-39}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{-70}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 1.22 \cdot 10^{+89} \lor \neg \left(x \leq 1.6 \cdot 10^{+141}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (+ y 1.0))))
(if (<= y -9.2e+27)
1.0
(if (<= y -5.8e-15)
t_0
(if (<= y -4e-41)
y
(if (<= y 4.2e-106)
x
(if (<= y 3.4e-60) y (if (<= y 1.12e+81) t_0 1.0))))))))
double code(double x, double y) {
double t_0 = x / (y + 1.0);
double tmp;
if (y <= -9.2e+27) {
tmp = 1.0;
} else if (y <= -5.8e-15) {
tmp = t_0;
} else if (y <= -4e-41) {
tmp = y;
} else if (y <= 4.2e-106) {
tmp = x;
} else if (y <= 3.4e-60) {
tmp = y;
} else if (y <= 1.12e+81) {
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 / (y + 1.0d0)
if (y <= (-9.2d+27)) then
tmp = 1.0d0
else if (y <= (-5.8d-15)) then
tmp = t_0
else if (y <= (-4d-41)) then
tmp = y
else if (y <= 4.2d-106) then
tmp = x
else if (y <= 3.4d-60) then
tmp = y
else if (y <= 1.12d+81) 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 / (y + 1.0);
double tmp;
if (y <= -9.2e+27) {
tmp = 1.0;
} else if (y <= -5.8e-15) {
tmp = t_0;
} else if (y <= -4e-41) {
tmp = y;
} else if (y <= 4.2e-106) {
tmp = x;
} else if (y <= 3.4e-60) {
tmp = y;
} else if (y <= 1.12e+81) {
tmp = t_0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): t_0 = x / (y + 1.0) tmp = 0 if y <= -9.2e+27: tmp = 1.0 elif y <= -5.8e-15: tmp = t_0 elif y <= -4e-41: tmp = y elif y <= 4.2e-106: tmp = x elif y <= 3.4e-60: tmp = y elif y <= 1.12e+81: tmp = t_0 else: tmp = 1.0 return tmp
function code(x, y) t_0 = Float64(x / Float64(y + 1.0)) tmp = 0.0 if (y <= -9.2e+27) tmp = 1.0; elseif (y <= -5.8e-15) tmp = t_0; elseif (y <= -4e-41) tmp = y; elseif (y <= 4.2e-106) tmp = x; elseif (y <= 3.4e-60) tmp = y; elseif (y <= 1.12e+81) tmp = t_0; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) t_0 = x / (y + 1.0); tmp = 0.0; if (y <= -9.2e+27) tmp = 1.0; elseif (y <= -5.8e-15) tmp = t_0; elseif (y <= -4e-41) tmp = y; elseif (y <= 4.2e-106) tmp = x; elseif (y <= 3.4e-60) tmp = y; elseif (y <= 1.12e+81) tmp = t_0; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -9.2e+27], 1.0, If[LessEqual[y, -5.8e-15], t$95$0, If[LessEqual[y, -4e-41], y, If[LessEqual[y, 4.2e-106], x, If[LessEqual[y, 3.4e-60], y, If[LessEqual[y, 1.12e+81], t$95$0, 1.0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{y + 1}\\
\mathbf{if}\;y \leq -9.2 \cdot 10^{+27}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -5.8 \cdot 10^{-15}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -4 \cdot 10^{-41}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{-106}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 3.4 \cdot 10^{-60}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 1.12 \cdot 10^{+81}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
(FPCore (x y)
:precision binary64
(let* ((t_0 (- x (* x y))))
(if (<= y -1.0)
1.0
(if (<= y 4.2e-106)
t_0
(if (<= y 2e-57) y (if (<= y 5.2e-14) t_0 1.0))))))
double code(double x, double y) {
double t_0 = x - (x * y);
double tmp;
if (y <= -1.0) {
tmp = 1.0;
} else if (y <= 4.2e-106) {
tmp = t_0;
} else if (y <= 2e-57) {
tmp = y;
} else if (y <= 5.2e-14) {
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 - (x * y)
if (y <= (-1.0d0)) then
tmp = 1.0d0
else if (y <= 4.2d-106) then
tmp = t_0
else if (y <= 2d-57) then
tmp = y
else if (y <= 5.2d-14) 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 - (x * y);
double tmp;
if (y <= -1.0) {
tmp = 1.0;
} else if (y <= 4.2e-106) {
tmp = t_0;
} else if (y <= 2e-57) {
tmp = y;
} else if (y <= 5.2e-14) {
tmp = t_0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): t_0 = x - (x * y) tmp = 0 if y <= -1.0: tmp = 1.0 elif y <= 4.2e-106: tmp = t_0 elif y <= 2e-57: tmp = y elif y <= 5.2e-14: tmp = t_0 else: tmp = 1.0 return tmp
function code(x, y) t_0 = Float64(x - Float64(x * y)) tmp = 0.0 if (y <= -1.0) tmp = 1.0; elseif (y <= 4.2e-106) tmp = t_0; elseif (y <= 2e-57) tmp = y; elseif (y <= 5.2e-14) tmp = t_0; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) t_0 = x - (x * y); tmp = 0.0; if (y <= -1.0) tmp = 1.0; elseif (y <= 4.2e-106) tmp = t_0; elseif (y <= 2e-57) tmp = y; elseif (y <= 5.2e-14) tmp = t_0; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x - N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.0], 1.0, If[LessEqual[y, 4.2e-106], t$95$0, If[LessEqual[y, 2e-57], y, If[LessEqual[y, 5.2e-14], t$95$0, 1.0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x - x \cdot y\\
\mathbf{if}\;y \leq -1:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{-106}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 2 \cdot 10^{-57}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 5.2 \cdot 10^{-14}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (/ x y))))
(if (<= y -3000.0)
t_0
(if (<= y 4.2e-106)
(/ x (+ y 1.0))
(if (<= y 3.2e-60)
(/ y (+ y 1.0))
(if (<= y 5.2e-14) (- x (* x y)) t_0))))))
double code(double x, double y) {
double t_0 = 1.0 + (x / y);
double tmp;
if (y <= -3000.0) {
tmp = t_0;
} else if (y <= 4.2e-106) {
tmp = x / (y + 1.0);
} else if (y <= 3.2e-60) {
tmp = y / (y + 1.0);
} else if (y <= 5.2e-14) {
tmp = x - (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 + (x / y)
if (y <= (-3000.0d0)) then
tmp = t_0
else if (y <= 4.2d-106) then
tmp = x / (y + 1.0d0)
else if (y <= 3.2d-60) then
tmp = y / (y + 1.0d0)
else if (y <= 5.2d-14) then
tmp = x - (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 + (x / y);
double tmp;
if (y <= -3000.0) {
tmp = t_0;
} else if (y <= 4.2e-106) {
tmp = x / (y + 1.0);
} else if (y <= 3.2e-60) {
tmp = y / (y + 1.0);
} else if (y <= 5.2e-14) {
tmp = x - (x * y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + (x / y) tmp = 0 if y <= -3000.0: tmp = t_0 elif y <= 4.2e-106: tmp = x / (y + 1.0) elif y <= 3.2e-60: tmp = y / (y + 1.0) elif y <= 5.2e-14: tmp = x - (x * y) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(x / y)) tmp = 0.0 if (y <= -3000.0) tmp = t_0; elseif (y <= 4.2e-106) tmp = Float64(x / Float64(y + 1.0)); elseif (y <= 3.2e-60) tmp = Float64(y / Float64(y + 1.0)); elseif (y <= 5.2e-14) tmp = Float64(x - Float64(x * y)); 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 <= -3000.0) tmp = t_0; elseif (y <= 4.2e-106) tmp = x / (y + 1.0); elseif (y <= 3.2e-60) tmp = y / (y + 1.0); elseif (y <= 5.2e-14) tmp = x - (x * y); 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, -3000.0], t$95$0, If[LessEqual[y, 4.2e-106], N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.2e-60], N[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.2e-14], N[(x - N[(x * y), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{x}{y}\\
\mathbf{if}\;y \leq -3000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{-106}:\\
\;\;\;\;\frac{x}{y + 1}\\
\mathbf{elif}\;y \leq 3.2 \cdot 10^{-60}:\\
\;\;\;\;\frac{y}{y + 1}\\
\mathbf{elif}\;y \leq 5.2 \cdot 10^{-14}:\\
\;\;\;\;x - x \cdot y\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
(FPCore (x y) :precision binary64 (if (or (<= y -1.0) (not (<= y 0.78))) (+ 1.0 (/ x y)) (+ x (* y (- 1.0 x)))))
double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 0.78)) {
tmp = 1.0 + (x / y);
} else {
tmp = x + (y * (1.0 - x));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-1.0d0)) .or. (.not. (y <= 0.78d0))) then
tmp = 1.0d0 + (x / y)
else
tmp = x + (y * (1.0d0 - x))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 0.78)) {
tmp = 1.0 + (x / y);
} else {
tmp = x + (y * (1.0 - x));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.0) or not (y <= 0.78): tmp = 1.0 + (x / y) else: tmp = x + (y * (1.0 - x)) return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.0) || !(y <= 0.78)) tmp = Float64(1.0 + Float64(x / y)); else tmp = Float64(x + Float64(y * Float64(1.0 - x))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1.0) || ~((y <= 0.78))) tmp = 1.0 + (x / y); else tmp = x + (y * (1.0 - x)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 0.78]], $MachinePrecision]], N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 0.78\right):\\
\;\;\;\;1 + \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(1 - x\right)\\
\end{array}
\end{array}
(FPCore (x y) :precision binary64 (if (or (<= y -1.0) (not (<= y 1.0))) (+ 1.0 (/ (+ x -1.0) y)) (+ x (* y (- 1.0 x)))))
double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 1.0)) {
tmp = 1.0 + ((x + -1.0) / y);
} else {
tmp = x + (y * (1.0 - x));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-1.0d0)) .or. (.not. (y <= 1.0d0))) then
tmp = 1.0d0 + ((x + (-1.0d0)) / y)
else
tmp = x + (y * (1.0d0 - x))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 1.0)) {
tmp = 1.0 + ((x + -1.0) / y);
} else {
tmp = x + (y * (1.0 - x));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.0) or not (y <= 1.0): tmp = 1.0 + ((x + -1.0) / y) else: tmp = x + (y * (1.0 - x)) return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.0) || !(y <= 1.0)) tmp = Float64(1.0 + Float64(Float64(x + -1.0) / y)); else tmp = Float64(x + Float64(y * Float64(1.0 - x))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1.0) || ~((y <= 1.0))) tmp = 1.0 + ((x + -1.0) / y); else tmp = x + (y * (1.0 - x)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 1.0]], $MachinePrecision]], N[(1.0 + N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 1\right):\\
\;\;\;\;1 + \frac{x + -1}{y}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(1 - x\right)\\
\end{array}
\end{array}
(FPCore (x y) :precision binary64 (if (<= y -1.0) 1.0 (if (<= y 4.2e-106) x (if (<= y 3.2e-60) y (if (<= y 5.2e-14) x 1.0)))))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = 1.0;
} else if (y <= 4.2e-106) {
tmp = x;
} else if (y <= 3.2e-60) {
tmp = y;
} else if (y <= 5.2e-14) {
tmp = x;
} 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.0d0)) then
tmp = 1.0d0
else if (y <= 4.2d-106) then
tmp = x
else if (y <= 3.2d-60) then
tmp = y
else if (y <= 5.2d-14) then
tmp = x
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = 1.0;
} else if (y <= 4.2e-106) {
tmp = x;
} else if (y <= 3.2e-60) {
tmp = y;
} else if (y <= 5.2e-14) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = 1.0 elif y <= 4.2e-106: tmp = x elif y <= 3.2e-60: tmp = y elif y <= 5.2e-14: tmp = x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = 1.0; elseif (y <= 4.2e-106) tmp = x; elseif (y <= 3.2e-60) tmp = y; elseif (y <= 5.2e-14) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.0) tmp = 1.0; elseif (y <= 4.2e-106) tmp = x; elseif (y <= 3.2e-60) tmp = y; elseif (y <= 5.2e-14) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], 1.0, If[LessEqual[y, 4.2e-106], x, If[LessEqual[y, 3.2e-60], y, If[LessEqual[y, 5.2e-14], x, 1.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{-106}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 3.2 \cdot 10^{-60}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 5.2 \cdot 10^{-14}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
(FPCore (x y) :precision binary64 (if (<= y -1.0) 1.0 (if (<= y 5.2e-14) x 1.0)))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = 1.0;
} else if (y <= 5.2e-14) {
tmp = x;
} 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.0d0)) then
tmp = 1.0d0
else if (y <= 5.2d-14) then
tmp = x
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = 1.0;
} else if (y <= 5.2e-14) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = 1.0 elif y <= 5.2e-14: tmp = x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = 1.0; elseif (y <= 5.2e-14) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.0) tmp = 1.0; elseif (y <= 5.2e-14) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], 1.0, If[LessEqual[y, 5.2e-14], x, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 5.2 \cdot 10^{-14}:\\
\;\;\;\;x\\
\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}
herbie shell --seed 2023350
(FPCore (x y)
:name "Data.Colour.SRGB:invTransferFunction from colour-2.3.3"
:precision binary64
(/ (+ x y) (+ y 1.0)))