
(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 13 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 (/ (* x (+ 1.0 (/ x y))) (+ x 1.0))))
(if (<= t_0 -5e+121)
(/ (/ x y) (+ 1.0 (/ 1.0 x)))
(if (<= t_0 500000000000.0) t_0 (/ x (+ y (/ y x)))))))
double code(double x, double y) {
double t_0 = (x * (1.0 + (x / y))) / (x + 1.0);
double tmp;
if (t_0 <= -5e+121) {
tmp = (x / y) / (1.0 + (1.0 / x));
} else if (t_0 <= 500000000000.0) {
tmp = t_0;
} else {
tmp = x / (y + (y / x));
}
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 * (1.0d0 + (x / y))) / (x + 1.0d0)
if (t_0 <= (-5d+121)) then
tmp = (x / y) / (1.0d0 + (1.0d0 / x))
else if (t_0 <= 500000000000.0d0) then
tmp = t_0
else
tmp = x / (y + (y / x))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (x * (1.0 + (x / y))) / (x + 1.0);
double tmp;
if (t_0 <= -5e+121) {
tmp = (x / y) / (1.0 + (1.0 / x));
} else if (t_0 <= 500000000000.0) {
tmp = t_0;
} else {
tmp = x / (y + (y / x));
}
return tmp;
}
def code(x, y): t_0 = (x * (1.0 + (x / y))) / (x + 1.0) tmp = 0 if t_0 <= -5e+121: tmp = (x / y) / (1.0 + (1.0 / x)) elif t_0 <= 500000000000.0: tmp = t_0 else: tmp = x / (y + (y / x)) return tmp
function code(x, y) t_0 = Float64(Float64(x * Float64(1.0 + Float64(x / y))) / Float64(x + 1.0)) tmp = 0.0 if (t_0 <= -5e+121) tmp = Float64(Float64(x / y) / Float64(1.0 + Float64(1.0 / x))); elseif (t_0 <= 500000000000.0) tmp = t_0; else tmp = Float64(x / Float64(y + Float64(y / x))); end return tmp end
function tmp_2 = code(x, y) t_0 = (x * (1.0 + (x / y))) / (x + 1.0); tmp = 0.0; if (t_0 <= -5e+121) tmp = (x / y) / (1.0 + (1.0 / x)); elseif (t_0 <= 500000000000.0) tmp = t_0; else tmp = x / (y + (y / x)); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(x * N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e+121], N[(N[(x / y), $MachinePrecision] / N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 500000000000.0], t$95$0, N[(x / N[(y + N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x \cdot \left(1 + \frac{x}{y}\right)}{x + 1}\\
\mathbf{if}\;t_0 \leq -5 \cdot 10^{+121}:\\
\;\;\;\;\frac{\frac{x}{y}}{1 + \frac{1}{x}}\\
\mathbf{elif}\;t_0 \leq 500000000000:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y + \frac{y}{x}}\\
\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 -4.7e+14)
(/ x y)
(if (<= x -3e-22)
t_0
(if (<= x -3.4e-61)
(* x (/ x y))
(if (<= x 730000000.0) t_0 (/ x y)))))))
double code(double x, double y) {
double t_0 = x / (x + 1.0);
double tmp;
if (x <= -4.7e+14) {
tmp = x / y;
} else if (x <= -3e-22) {
tmp = t_0;
} else if (x <= -3.4e-61) {
tmp = x * (x / y);
} else if (x <= 730000000.0) {
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 <= (-4.7d+14)) then
tmp = x / y
else if (x <= (-3d-22)) then
tmp = t_0
else if (x <= (-3.4d-61)) then
tmp = x * (x / y)
else if (x <= 730000000.0d0) 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 <= -4.7e+14) {
tmp = x / y;
} else if (x <= -3e-22) {
tmp = t_0;
} else if (x <= -3.4e-61) {
tmp = x * (x / y);
} else if (x <= 730000000.0) {
tmp = t_0;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y): t_0 = x / (x + 1.0) tmp = 0 if x <= -4.7e+14: tmp = x / y elif x <= -3e-22: tmp = t_0 elif x <= -3.4e-61: tmp = x * (x / y) elif x <= 730000000.0: 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 <= -4.7e+14) tmp = Float64(x / y); elseif (x <= -3e-22) tmp = t_0; elseif (x <= -3.4e-61) tmp = Float64(x * Float64(x / y)); elseif (x <= 730000000.0) 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 <= -4.7e+14) tmp = x / y; elseif (x <= -3e-22) tmp = t_0; elseif (x <= -3.4e-61) tmp = x * (x / y); elseif (x <= 730000000.0) 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, -4.7e+14], N[(x / y), $MachinePrecision], If[LessEqual[x, -3e-22], t$95$0, If[LessEqual[x, -3.4e-61], N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 730000000.0], t$95$0, N[(x / y), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{x + 1}\\
\mathbf{if}\;x \leq -4.7 \cdot 10^{+14}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq -3 \cdot 10^{-22}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -3.4 \cdot 10^{-61}:\\
\;\;\;\;x \cdot \frac{x}{y}\\
\mathbf{elif}\;x \leq 730000000:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (+ x 1.0))))
(if (<= x -1600000000000.0)
(/ x y)
(if (<= x -2.4e-24)
t_0
(if (<= x -7.4e-62)
(* x (* x (/ 1.0 y)))
(if (<= x 6000.0) t_0 (/ x y)))))))
double code(double x, double y) {
double t_0 = x / (x + 1.0);
double tmp;
if (x <= -1600000000000.0) {
tmp = x / y;
} else if (x <= -2.4e-24) {
tmp = t_0;
} else if (x <= -7.4e-62) {
tmp = x * (x * (1.0 / y));
} else if (x <= 6000.0) {
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 <= (-1600000000000.0d0)) then
tmp = x / y
else if (x <= (-2.4d-24)) then
tmp = t_0
else if (x <= (-7.4d-62)) then
tmp = x * (x * (1.0d0 / y))
else if (x <= 6000.0d0) 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 <= -1600000000000.0) {
tmp = x / y;
} else if (x <= -2.4e-24) {
tmp = t_0;
} else if (x <= -7.4e-62) {
tmp = x * (x * (1.0 / y));
} else if (x <= 6000.0) {
tmp = t_0;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y): t_0 = x / (x + 1.0) tmp = 0 if x <= -1600000000000.0: tmp = x / y elif x <= -2.4e-24: tmp = t_0 elif x <= -7.4e-62: tmp = x * (x * (1.0 / y)) elif x <= 6000.0: 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 <= -1600000000000.0) tmp = Float64(x / y); elseif (x <= -2.4e-24) tmp = t_0; elseif (x <= -7.4e-62) tmp = Float64(x * Float64(x * Float64(1.0 / y))); elseif (x <= 6000.0) 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 <= -1600000000000.0) tmp = x / y; elseif (x <= -2.4e-24) tmp = t_0; elseif (x <= -7.4e-62) tmp = x * (x * (1.0 / y)); elseif (x <= 6000.0) 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, -1600000000000.0], N[(x / y), $MachinePrecision], If[LessEqual[x, -2.4e-24], t$95$0, If[LessEqual[x, -7.4e-62], N[(x * N[(x * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 6000.0], t$95$0, N[(x / y), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{x + 1}\\
\mathbf{if}\;x \leq -1600000000000:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq -2.4 \cdot 10^{-24}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -7.4 \cdot 10^{-62}:\\
\;\;\;\;x \cdot \left(x \cdot \frac{1}{y}\right)\\
\mathbf{elif}\;x \leq 6000:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
(FPCore (x y)
:precision binary64
(if (<= x -3.4e+15)
(/ x y)
(if (<= x -2.5e-10)
(/ x (+ x 1.0))
(if (<= x 44.0) (+ x (* x (/ x y))) (/ x y)))))
double code(double x, double y) {
double tmp;
if (x <= -3.4e+15) {
tmp = x / y;
} else if (x <= -2.5e-10) {
tmp = x / (x + 1.0);
} else if (x <= 44.0) {
tmp = x + (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 <= (-3.4d+15)) then
tmp = x / y
else if (x <= (-2.5d-10)) then
tmp = x / (x + 1.0d0)
else if (x <= 44.0d0) then
tmp = x + (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 <= -3.4e+15) {
tmp = x / y;
} else if (x <= -2.5e-10) {
tmp = x / (x + 1.0);
} else if (x <= 44.0) {
tmp = x + (x * (x / y));
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -3.4e+15: tmp = x / y elif x <= -2.5e-10: tmp = x / (x + 1.0) elif x <= 44.0: tmp = x + (x * (x / y)) else: tmp = x / y return tmp
function code(x, y) tmp = 0.0 if (x <= -3.4e+15) tmp = Float64(x / y); elseif (x <= -2.5e-10) tmp = Float64(x / Float64(x + 1.0)); elseif (x <= 44.0) tmp = Float64(x + 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 <= -3.4e+15) tmp = x / y; elseif (x <= -2.5e-10) tmp = x / (x + 1.0); elseif (x <= 44.0) tmp = x + (x * (x / y)); else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -3.4e+15], N[(x / y), $MachinePrecision], If[LessEqual[x, -2.5e-10], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 44.0], N[(x + N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.4 \cdot 10^{+15}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq -2.5 \cdot 10^{-10}:\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{elif}\;x \leq 44:\\
\;\;\;\;x + x \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
(FPCore (x y) :precision binary64 (if (or (<= x -5.2) (not (<= x 3.9e+15))) (+ 1.0 (/ x y)) (+ x (/ x (+ y (/ y x))))))
double code(double x, double y) {
double tmp;
if ((x <= -5.2) || !(x <= 3.9e+15)) {
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 <= (-5.2d0)) .or. (.not. (x <= 3.9d+15))) 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 <= -5.2) || !(x <= 3.9e+15)) {
tmp = 1.0 + (x / y);
} else {
tmp = x + (x / (y + (y / x)));
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -5.2) or not (x <= 3.9e+15): tmp = 1.0 + (x / y) else: tmp = x + (x / (y + (y / x))) return tmp
function code(x, y) tmp = 0.0 if ((x <= -5.2) || !(x <= 3.9e+15)) 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 <= -5.2) || ~((x <= 3.9e+15))) tmp = 1.0 + (x / y); else tmp = x + (x / (y + (y / x))); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -5.2], N[Not[LessEqual[x, 3.9e+15]], $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 -5.2 \lor \neg \left(x \leq 3.9 \cdot 10^{+15}\right):\\
\;\;\;\;1 + \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{x}{y + \frac{y}{x}}\\
\end{array}
\end{array}
(FPCore (x y) :precision binary64 (if (or (<= x -2.05e-7) (not (<= x 1.5e-9))) (/ x (+ y (/ y x))) (+ x (* x (/ x y)))))
double code(double x, double y) {
double tmp;
if ((x <= -2.05e-7) || !(x <= 1.5e-9)) {
tmp = x / (y + (y / x));
} else {
tmp = x + (x * (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 <= (-2.05d-7)) .or. (.not. (x <= 1.5d-9))) then
tmp = x / (y + (y / x))
else
tmp = x + (x * (x / y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -2.05e-7) || !(x <= 1.5e-9)) {
tmp = x / (y + (y / x));
} else {
tmp = x + (x * (x / y));
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -2.05e-7) or not (x <= 1.5e-9): tmp = x / (y + (y / x)) else: tmp = x + (x * (x / y)) return tmp
function code(x, y) tmp = 0.0 if ((x <= -2.05e-7) || !(x <= 1.5e-9)) tmp = Float64(x / Float64(y + Float64(y / x))); else tmp = Float64(x + Float64(x * Float64(x / y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -2.05e-7) || ~((x <= 1.5e-9))) tmp = x / (y + (y / x)); else tmp = x + (x * (x / y)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -2.05e-7], N[Not[LessEqual[x, 1.5e-9]], $MachinePrecision]], N[(x / N[(y + N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.05 \cdot 10^{-7} \lor \neg \left(x \leq 1.5 \cdot 10^{-9}\right):\\
\;\;\;\;\frac{x}{y + \frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;x + x \cdot \frac{x}{y}\\
\end{array}
\end{array}
(FPCore (x y) :precision binary64 (if (or (<= x -1.0) (not (<= x 1.0))) (+ 1.0 (/ x y)) (+ x (* x (/ x y)))))
double code(double x, double y) {
double tmp;
if ((x <= -1.0) || !(x <= 1.0)) {
tmp = 1.0 + (x / y);
} else {
tmp = x + (x * (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)) .or. (.not. (x <= 1.0d0))) then
tmp = 1.0d0 + (x / y)
else
tmp = x + (x * (x / y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -1.0) || !(x <= 1.0)) {
tmp = 1.0 + (x / y);
} else {
tmp = x + (x * (x / y));
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -1.0) or not (x <= 1.0): tmp = 1.0 + (x / y) else: tmp = x + (x * (x / y)) return tmp
function code(x, y) tmp = 0.0 if ((x <= -1.0) || !(x <= 1.0)) tmp = Float64(1.0 + Float64(x / y)); else tmp = Float64(x + Float64(x * Float64(x / y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -1.0) || ~((x <= 1.0))) tmp = 1.0 + (x / y); else tmp = x + (x * (x / y)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -1.0], N[Not[LessEqual[x, 1.0]], $MachinePrecision]], N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision], N[(x + N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 1\right):\\
\;\;\;\;1 + \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;x + x \cdot \frac{x}{y}\\
\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 (<= x -5.5) (/ x y) (if (<= x -6.8e-60) (* x (/ x y)) (if (<= x 0.031) x (/ x y)))))
double code(double x, double y) {
double tmp;
if (x <= -5.5) {
tmp = x / y;
} else if (x <= -6.8e-60) {
tmp = x * (x / y);
} else if (x <= 0.031) {
tmp = x;
} 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 <= (-5.5d0)) then
tmp = x / y
else if (x <= (-6.8d-60)) then
tmp = x * (x / y)
else if (x <= 0.031d0) then
tmp = x
else
tmp = x / y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -5.5) {
tmp = x / y;
} else if (x <= -6.8e-60) {
tmp = x * (x / y);
} else if (x <= 0.031) {
tmp = x;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -5.5: tmp = x / y elif x <= -6.8e-60: tmp = x * (x / y) elif x <= 0.031: tmp = x else: tmp = x / y return tmp
function code(x, y) tmp = 0.0 if (x <= -5.5) tmp = Float64(x / y); elseif (x <= -6.8e-60) tmp = Float64(x * Float64(x / y)); elseif (x <= 0.031) tmp = x; else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -5.5) tmp = x / y; elseif (x <= -6.8e-60) tmp = x * (x / y); elseif (x <= 0.031) tmp = x; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -5.5], N[(x / y), $MachinePrecision], If[LessEqual[x, -6.8e-60], N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.031], x, N[(x / y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.5:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq -6.8 \cdot 10^{-60}:\\
\;\;\;\;x \cdot \frac{x}{y}\\
\mathbf{elif}\;x \leq 0.031:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
(FPCore (x y) :precision binary64 (if (or (<= x -1.0) (not (<= x 3.75))) (/ x y) x))
double code(double x, double y) {
double tmp;
if ((x <= -1.0) || !(x <= 3.75)) {
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 <= 3.75d0))) 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 <= 3.75)) {
tmp = x / y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -1.0) or not (x <= 3.75): tmp = x / y else: tmp = x return tmp
function code(x, y) tmp = 0.0 if ((x <= -1.0) || !(x <= 3.75)) 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 <= 3.75))) tmp = x / y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -1.0], N[Not[LessEqual[x, 3.75]], $MachinePrecision]], N[(x / y), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 3.75\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
(FPCore (x y) :precision binary64 (if (<= x -1.0) 1.0 (if (<= x 9.2e+17) x 1.0)))
double code(double x, double y) {
double tmp;
if (x <= -1.0) {
tmp = 1.0;
} else if (x <= 9.2e+17) {
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 (x <= (-1.0d0)) then
tmp = 1.0d0
else if (x <= 9.2d+17) then
tmp = x
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -1.0) {
tmp = 1.0;
} else if (x <= 9.2e+17) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.0: tmp = 1.0 elif x <= 9.2e+17: tmp = x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (x <= -1.0) tmp = 1.0; elseif (x <= 9.2e+17) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1.0) tmp = 1.0; elseif (x <= 9.2e+17) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.0], 1.0, If[LessEqual[x, 9.2e+17], x, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 9.2 \cdot 10^{+17}:\\
\;\;\;\;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}
(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 2023364
(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)))