
(FPCore (x y) :precision binary64 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0)))
double code(double x, double y) {
return (x * ((x / y) + 1.0)) / (x + 1.0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * ((x / y) + 1.0d0)) / (x + 1.0d0)
end function
public static double code(double x, double y) {
return (x * ((x / y) + 1.0)) / (x + 1.0);
}
def code(x, y): return (x * ((x / y) + 1.0)) / (x + 1.0)
function code(x, y) return Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0)) end
function tmp = code(x, y) tmp = (x * ((x / y) + 1.0)) / (x + 1.0); end
code[x_, y_] := N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0)))
double code(double x, double y) {
return (x * ((x / y) + 1.0)) / (x + 1.0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * ((x / y) + 1.0d0)) / (x + 1.0d0)
end function
public static double code(double x, double y) {
return (x * ((x / y) + 1.0)) / (x + 1.0);
}
def code(x, y): return (x * ((x / y) + 1.0)) / (x + 1.0)
function code(x, y) return Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0)) end
function tmp = code(x, y) tmp = (x * ((x / y) + 1.0)) / (x + 1.0); end
code[x_, y_] := N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}
\end{array}
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (/ x y))))
(if (<= x -4.5e+51)
t_0
(if (<= x 2500000000000.0) (/ (* x t_0) (+ x 1.0)) (+ t_0 (/ -1.0 y))))))
double code(double x, double y) {
double t_0 = 1.0 + (x / y);
double tmp;
if (x <= -4.5e+51) {
tmp = t_0;
} else if (x <= 2500000000000.0) {
tmp = (x * t_0) / (x + 1.0);
} else {
tmp = t_0 + (-1.0 / y);
}
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 (x <= (-4.5d+51)) then
tmp = t_0
else if (x <= 2500000000000.0d0) then
tmp = (x * t_0) / (x + 1.0d0)
else
tmp = t_0 + ((-1.0d0) / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 + (x / y);
double tmp;
if (x <= -4.5e+51) {
tmp = t_0;
} else if (x <= 2500000000000.0) {
tmp = (x * t_0) / (x + 1.0);
} else {
tmp = t_0 + (-1.0 / y);
}
return tmp;
}
def code(x, y): t_0 = 1.0 + (x / y) tmp = 0 if x <= -4.5e+51: tmp = t_0 elif x <= 2500000000000.0: tmp = (x * t_0) / (x + 1.0) else: tmp = t_0 + (-1.0 / y) return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(x / y)) tmp = 0.0 if (x <= -4.5e+51) tmp = t_0; elseif (x <= 2500000000000.0) tmp = Float64(Float64(x * t_0) / Float64(x + 1.0)); else tmp = Float64(t_0 + Float64(-1.0 / y)); end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + (x / y); tmp = 0.0; if (x <= -4.5e+51) tmp = t_0; elseif (x <= 2500000000000.0) tmp = (x * t_0) / (x + 1.0); else tmp = t_0 + (-1.0 / y); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4.5e+51], t$95$0, If[LessEqual[x, 2500000000000.0], N[(N[(x * t$95$0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(-1.0 / y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{x}{y}\\
\mathbf{if}\;x \leq -4.5 \cdot 10^{+51}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 2500000000000:\\
\;\;\;\;\frac{x \cdot t_0}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;t_0 + \frac{-1}{y}\\
\end{array}
\end{array}
(FPCore (x y) :precision binary64 (+ (/ x (+ y (/ y x))) (/ 1.0 (+ 1.0 (/ 1.0 x)))))
double code(double x, double y) {
return (x / (y + (y / x))) + (1.0 / (1.0 + (1.0 / x)));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x / (y + (y / x))) + (1.0d0 / (1.0d0 + (1.0d0 / x)))
end function
public static double code(double x, double y) {
return (x / (y + (y / x))) + (1.0 / (1.0 + (1.0 / x)));
}
def code(x, y): return (x / (y + (y / x))) + (1.0 / (1.0 + (1.0 / x)))
function code(x, y) return Float64(Float64(x / Float64(y + Float64(y / x))) + Float64(1.0 / Float64(1.0 + Float64(1.0 / x)))) end
function tmp = code(x, y) tmp = (x / (y + (y / x))) + (1.0 / (1.0 + (1.0 / x))); end
code[x_, y_] := N[(N[(x / N[(y + N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y + \frac{y}{x}} + \frac{1}{1 + \frac{1}{x}}
\end{array}
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (+ x 1.0))))
(if (<= x -3.6e+27)
(/ x y)
(if (<= x 1.7e-27)
t_0
(if (<= x 1.75e-13) (* x (/ x y)) (if (<= x 2.8e+65) t_0 (/ x y)))))))
double code(double x, double y) {
double t_0 = x / (x + 1.0);
double tmp;
if (x <= -3.6e+27) {
tmp = x / y;
} else if (x <= 1.7e-27) {
tmp = t_0;
} else if (x <= 1.75e-13) {
tmp = x * (x / y);
} else if (x <= 2.8e+65) {
tmp = t_0;
} else {
tmp = x / y;
}
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 + 1.0d0)
if (x <= (-3.6d+27)) then
tmp = x / y
else if (x <= 1.7d-27) then
tmp = t_0
else if (x <= 1.75d-13) then
tmp = x * (x / y)
else if (x <= 2.8d+65) then
tmp = t_0
else
tmp = x / y
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x / (x + 1.0);
double tmp;
if (x <= -3.6e+27) {
tmp = x / y;
} else if (x <= 1.7e-27) {
tmp = t_0;
} else if (x <= 1.75e-13) {
tmp = x * (x / y);
} else if (x <= 2.8e+65) {
tmp = t_0;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y): t_0 = x / (x + 1.0) tmp = 0 if x <= -3.6e+27: tmp = x / y elif x <= 1.7e-27: tmp = t_0 elif x <= 1.75e-13: tmp = x * (x / y) elif x <= 2.8e+65: tmp = t_0 else: tmp = x / y return tmp
function code(x, y) t_0 = Float64(x / Float64(x + 1.0)) tmp = 0.0 if (x <= -3.6e+27) tmp = Float64(x / y); elseif (x <= 1.7e-27) tmp = t_0; elseif (x <= 1.75e-13) tmp = Float64(x * Float64(x / y)); elseif (x <= 2.8e+65) tmp = t_0; else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y) t_0 = x / (x + 1.0); tmp = 0.0; if (x <= -3.6e+27) tmp = x / y; elseif (x <= 1.7e-27) tmp = t_0; elseif (x <= 1.75e-13) tmp = x * (x / y); elseif (x <= 2.8e+65) tmp = t_0; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.6e+27], N[(x / y), $MachinePrecision], If[LessEqual[x, 1.7e-27], t$95$0, If[LessEqual[x, 1.75e-13], N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.8e+65], t$95$0, N[(x / y), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{x + 1}\\
\mathbf{if}\;x \leq -3.6 \cdot 10^{+27}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq 1.7 \cdot 10^{-27}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.75 \cdot 10^{-13}:\\
\;\;\;\;x \cdot \frac{x}{y}\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{+65}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (/ x y))) (t_1 (/ x (+ x 1.0))))
(if (<= x -2.5e+27)
t_0
(if (<= x 4.8e-30)
t_1
(if (<= x 5.7e-9) (* x (/ x y)) (if (<= x 26500000.0) t_1 t_0))))))
double code(double x, double y) {
double t_0 = 1.0 + (x / y);
double t_1 = x / (x + 1.0);
double tmp;
if (x <= -2.5e+27) {
tmp = t_0;
} else if (x <= 4.8e-30) {
tmp = t_1;
} else if (x <= 5.7e-9) {
tmp = x * (x / y);
} else if (x <= 26500000.0) {
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 / (x + 1.0d0)
if (x <= (-2.5d+27)) then
tmp = t_0
else if (x <= 4.8d-30) then
tmp = t_1
else if (x <= 5.7d-9) then
tmp = x * (x / y)
else if (x <= 26500000.0d0) 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 / (x + 1.0);
double tmp;
if (x <= -2.5e+27) {
tmp = t_0;
} else if (x <= 4.8e-30) {
tmp = t_1;
} else if (x <= 5.7e-9) {
tmp = x * (x / y);
} else if (x <= 26500000.0) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + (x / y) t_1 = x / (x + 1.0) tmp = 0 if x <= -2.5e+27: tmp = t_0 elif x <= 4.8e-30: tmp = t_1 elif x <= 5.7e-9: tmp = x * (x / y) elif x <= 26500000.0: 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(x + 1.0)) tmp = 0.0 if (x <= -2.5e+27) tmp = t_0; elseif (x <= 4.8e-30) tmp = t_1; elseif (x <= 5.7e-9) tmp = Float64(x * Float64(x / y)); elseif (x <= 26500000.0) 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 / (x + 1.0); tmp = 0.0; if (x <= -2.5e+27) tmp = t_0; elseif (x <= 4.8e-30) tmp = t_1; elseif (x <= 5.7e-9) tmp = x * (x / y); elseif (x <= 26500000.0) 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[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.5e+27], t$95$0, If[LessEqual[x, 4.8e-30], t$95$1, If[LessEqual[x, 5.7e-9], N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 26500000.0], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{x}{y}\\
t_1 := \frac{x}{x + 1}\\
\mathbf{if}\;x \leq -2.5 \cdot 10^{+27}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 4.8 \cdot 10^{-30}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 5.7 \cdot 10^{-9}:\\
\;\;\;\;x \cdot \frac{x}{y}\\
\mathbf{elif}\;x \leq 26500000:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
(FPCore (x y) :precision binary64 (if (or (<= x -15.0) (not (<= x 2600000000000.0))) (+ 1.0 (/ x y)) (+ x (/ x (+ y (/ y x))))))
double code(double x, double y) {
double tmp;
if ((x <= -15.0) || !(x <= 2600000000000.0)) {
tmp = 1.0 + (x / y);
} else {
tmp = x + (x / (y + (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 <= (-15.0d0)) .or. (.not. (x <= 2600000000000.0d0))) then
tmp = 1.0d0 + (x / y)
else
tmp = x + (x / (y + (y / x)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -15.0) || !(x <= 2600000000000.0)) {
tmp = 1.0 + (x / y);
} else {
tmp = x + (x / (y + (y / x)));
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -15.0) or not (x <= 2600000000000.0): tmp = 1.0 + (x / y) else: tmp = x + (x / (y + (y / x))) return tmp
function code(x, y) tmp = 0.0 if ((x <= -15.0) || !(x <= 2600000000000.0)) tmp = Float64(1.0 + Float64(x / y)); else tmp = Float64(x + Float64(x / Float64(y + Float64(y / x)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -15.0) || ~((x <= 2600000000000.0))) tmp = 1.0 + (x / y); else tmp = x + (x / (y + (y / x))); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -15.0], N[Not[LessEqual[x, 2600000000000.0]], $MachinePrecision]], N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision], N[(x + N[(x / N[(y + N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -15 \lor \neg \left(x \leq 2600000000000\right):\\
\;\;\;\;1 + \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{x}{y + \frac{y}{x}}\\
\end{array}
\end{array}
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (/ x y))))
(if (<= x -15.0)
t_0
(if (<= x 8500.0) (+ x (/ x (+ y (/ y x)))) (+ t_0 (/ -1.0 y))))))
double code(double x, double y) {
double t_0 = 1.0 + (x / y);
double tmp;
if (x <= -15.0) {
tmp = t_0;
} else if (x <= 8500.0) {
tmp = x + (x / (y + (y / x)));
} else {
tmp = t_0 + (-1.0 / y);
}
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 (x <= (-15.0d0)) then
tmp = t_0
else if (x <= 8500.0d0) then
tmp = x + (x / (y + (y / x)))
else
tmp = t_0 + ((-1.0d0) / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 + (x / y);
double tmp;
if (x <= -15.0) {
tmp = t_0;
} else if (x <= 8500.0) {
tmp = x + (x / (y + (y / x)));
} else {
tmp = t_0 + (-1.0 / y);
}
return tmp;
}
def code(x, y): t_0 = 1.0 + (x / y) tmp = 0 if x <= -15.0: tmp = t_0 elif x <= 8500.0: tmp = x + (x / (y + (y / x))) else: tmp = t_0 + (-1.0 / y) return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(x / y)) tmp = 0.0 if (x <= -15.0) tmp = t_0; elseif (x <= 8500.0) tmp = Float64(x + Float64(x / Float64(y + Float64(y / x)))); else tmp = Float64(t_0 + Float64(-1.0 / y)); end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + (x / y); tmp = 0.0; if (x <= -15.0) tmp = t_0; elseif (x <= 8500.0) tmp = x + (x / (y + (y / x))); else tmp = t_0 + (-1.0 / y); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -15.0], t$95$0, If[LessEqual[x, 8500.0], N[(x + N[(x / N[(y + N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(-1.0 / y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{x}{y}\\
\mathbf{if}\;x \leq -15:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 8500:\\
\;\;\;\;x + \frac{x}{y + \frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;t_0 + \frac{-1}{y}\\
\end{array}
\end{array}
(FPCore (x y) :precision binary64 (if (<= x -1.0) (/ x y) (if (<= x 4.2e-27) x (if (<= x 2.45e-8) (* x (/ x y)) (/ x y)))))
double code(double x, double y) {
double tmp;
if (x <= -1.0) {
tmp = x / y;
} else if (x <= 4.2e-27) {
tmp = x;
} else if (x <= 2.45e-8) {
tmp = x * (x / y);
} else {
tmp = x / y;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.0d0)) then
tmp = x / y
else if (x <= 4.2d-27) then
tmp = x
else if (x <= 2.45d-8) then
tmp = x * (x / y)
else
tmp = x / y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -1.0) {
tmp = x / y;
} else if (x <= 4.2e-27) {
tmp = x;
} else if (x <= 2.45e-8) {
tmp = x * (x / y);
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.0: tmp = x / y elif x <= 4.2e-27: tmp = x elif x <= 2.45e-8: tmp = x * (x / y) else: tmp = x / y return tmp
function code(x, y) tmp = 0.0 if (x <= -1.0) tmp = Float64(x / y); elseif (x <= 4.2e-27) tmp = x; elseif (x <= 2.45e-8) tmp = Float64(x * Float64(x / y)); else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1.0) tmp = x / y; elseif (x <= 4.2e-27) tmp = x; elseif (x <= 2.45e-8) tmp = x * (x / y); else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.0], N[(x / y), $MachinePrecision], If[LessEqual[x, 4.2e-27], x, If[LessEqual[x, 2.45e-8], N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq 4.2 \cdot 10^{-27}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.45 \cdot 10^{-8}:\\
\;\;\;\;x \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
(FPCore (x y) :precision binary64 (let* ((t_0 (+ 1.0 (/ x y)))) (if (or (<= x -1.0) (not (<= x 1.0))) t_0 (* x t_0))))
double code(double x, double y) {
double t_0 = 1.0 + (x / y);
double tmp;
if ((x <= -1.0) || !(x <= 1.0)) {
tmp = t_0;
} else {
tmp = x * 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 ((x <= (-1.0d0)) .or. (.not. (x <= 1.0d0))) then
tmp = t_0
else
tmp = x * 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 ((x <= -1.0) || !(x <= 1.0)) {
tmp = t_0;
} else {
tmp = x * t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + (x / y) tmp = 0 if (x <= -1.0) or not (x <= 1.0): tmp = t_0 else: tmp = x * t_0 return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(x / y)) tmp = 0.0 if ((x <= -1.0) || !(x <= 1.0)) tmp = t_0; else tmp = Float64(x * t_0); end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + (x / y); tmp = 0.0; if ((x <= -1.0) || ~((x <= 1.0))) tmp = t_0; else tmp = x * t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[x, -1.0], N[Not[LessEqual[x, 1.0]], $MachinePrecision]], t$95$0, N[(x * t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{x}{y}\\
\mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 1\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;x \cdot t_0\\
\end{array}
\end{array}
(FPCore (x y) :precision binary64 (/ (+ 1.0 (/ x y)) (- (/ 1.0 x) -1.0)))
double code(double x, double y) {
return (1.0 + (x / y)) / ((1.0 / x) - -1.0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (1.0d0 + (x / y)) / ((1.0d0 / x) - (-1.0d0))
end function
public static double code(double x, double y) {
return (1.0 + (x / y)) / ((1.0 / x) - -1.0);
}
def code(x, y): return (1.0 + (x / y)) / ((1.0 / x) - -1.0)
function code(x, y) return Float64(Float64(1.0 + Float64(x / y)) / Float64(Float64(1.0 / x) - -1.0)) end
function tmp = code(x, y) tmp = (1.0 + (x / y)) / ((1.0 / x) - -1.0); end
code[x_, y_] := N[(N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 / x), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1 + \frac{x}{y}}{\frac{1}{x} - -1}
\end{array}
(FPCore (x y) :precision binary64 (if (or (<= x -1.0) (not (<= x 0.98))) (/ x y) x))
double code(double x, double y) {
double tmp;
if ((x <= -1.0) || !(x <= 0.98)) {
tmp = x / y;
} else {
tmp = 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.0d0)) .or. (.not. (x <= 0.98d0))) then
tmp = x / y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -1.0) || !(x <= 0.98)) {
tmp = x / y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -1.0) or not (x <= 0.98): tmp = x / y else: tmp = x return tmp
function code(x, y) tmp = 0.0 if ((x <= -1.0) || !(x <= 0.98)) tmp = Float64(x / y); else tmp = x; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -1.0) || ~((x <= 0.98))) tmp = x / y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -1.0], N[Not[LessEqual[x, 0.98]], $MachinePrecision]], N[(x / y), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 0.98\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
(FPCore (x y) :precision binary64 x)
double code(double x, double y) {
return x;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x
end function
public static double code(double x, double y) {
return x;
}
def code(x, y): return x
function code(x, y) return x end
function tmp = code(x, y) tmp = x; end
code[x_, y_] := x
\begin{array}{l}
\\
x
\end{array}
(FPCore (x y) :precision binary64 (* (/ x 1.0) (/ (+ (/ x y) 1.0) (+ x 1.0))))
double code(double x, double y) {
return (x / 1.0) * (((x / y) + 1.0) / (x + 1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x / 1.0d0) * (((x / y) + 1.0d0) / (x + 1.0d0))
end function
public static double code(double x, double y) {
return (x / 1.0) * (((x / y) + 1.0) / (x + 1.0));
}
def code(x, y): return (x / 1.0) * (((x / y) + 1.0) / (x + 1.0))
function code(x, y) return Float64(Float64(x / 1.0) * Float64(Float64(Float64(x / y) + 1.0) / Float64(x + 1.0))) end
function tmp = code(x, y) tmp = (x / 1.0) * (((x / y) + 1.0) / (x + 1.0)); end
code[x_, y_] := N[(N[(x / 1.0), $MachinePrecision] * N[(N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{1} \cdot \frac{\frac{x}{y} + 1}{x + 1}
\end{array}
herbie shell --seed 2024008
(FPCore (x y)
:name "Codec.Picture.Types:toneMapping from JuicyPixels-3.2.6.1"
:precision binary64
:herbie-target
(* (/ x 1.0) (/ (+ (/ x y) 1.0) (+ x 1.0)))
(/ (* x (+ (/ x y) 1.0)) (+ x 1.0)))