
(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+227)
(/ (/ x y) (+ 1.0 (/ 1.0 x)))
(if (<= t_0 500000000000.0) t_0 (* (/ x y) (/ x (+ x 1.0)))))))
double code(double x, double y) {
double t_0 = (x * (1.0 + (x / y))) / (x + 1.0);
double tmp;
if (t_0 <= -5e+227) {
tmp = (x / y) / (1.0 + (1.0 / x));
} else if (t_0 <= 500000000000.0) {
tmp = t_0;
} else {
tmp = (x / y) * (x / (x + 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 * (1.0d0 + (x / y))) / (x + 1.0d0)
if (t_0 <= (-5d+227)) then
tmp = (x / y) / (1.0d0 + (1.0d0 / x))
else if (t_0 <= 500000000000.0d0) then
tmp = t_0
else
tmp = (x / y) * (x / (x + 1.0d0))
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+227) {
tmp = (x / y) / (1.0 + (1.0 / x));
} else if (t_0 <= 500000000000.0) {
tmp = t_0;
} else {
tmp = (x / y) * (x / (x + 1.0));
}
return tmp;
}
def code(x, y): t_0 = (x * (1.0 + (x / y))) / (x + 1.0) tmp = 0 if t_0 <= -5e+227: tmp = (x / y) / (1.0 + (1.0 / x)) elif t_0 <= 500000000000.0: tmp = t_0 else: tmp = (x / y) * (x / (x + 1.0)) 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+227) tmp = Float64(Float64(x / y) / Float64(1.0 + Float64(1.0 / x))); elseif (t_0 <= 500000000000.0) tmp = t_0; else tmp = Float64(Float64(x / y) * Float64(x / Float64(x + 1.0))); 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+227) tmp = (x / y) / (1.0 + (1.0 / x)); elseif (t_0 <= 500000000000.0) tmp = t_0; else tmp = (x / y) * (x / (x + 1.0)); 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+227], 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[(N[(x / y), $MachinePrecision] * N[(x / N[(x + 1.0), $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^{+227}:\\
\;\;\;\;\frac{\frac{x}{y}}{1 + \frac{1}{x}}\\
\mathbf{elif}\;t_0 \leq 500000000000:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{x}{x + 1}\\
\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 (if (or (<= x -50000.0) (not (<= x 47000.0))) (+ 1.0 (/ (+ x -1.0) y)) (+ x (/ x (+ y (/ y x))))))
double code(double x, double y) {
double tmp;
if ((x <= -50000.0) || !(x <= 47000.0)) {
tmp = 1.0 + ((x + -1.0) / 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 <= (-50000.0d0)) .or. (.not. (x <= 47000.0d0))) then
tmp = 1.0d0 + ((x + (-1.0d0)) / 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 <= -50000.0) || !(x <= 47000.0)) {
tmp = 1.0 + ((x + -1.0) / y);
} else {
tmp = x + (x / (y + (y / x)));
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -50000.0) or not (x <= 47000.0): tmp = 1.0 + ((x + -1.0) / y) else: tmp = x + (x / (y + (y / x))) return tmp
function code(x, y) tmp = 0.0 if ((x <= -50000.0) || !(x <= 47000.0)) tmp = Float64(1.0 + Float64(Float64(x + -1.0) / 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 <= -50000.0) || ~((x <= 47000.0))) tmp = 1.0 + ((x + -1.0) / y); else tmp = x + (x / (y + (y / x))); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -50000.0], N[Not[LessEqual[x, 47000.0]], $MachinePrecision]], N[(1.0 + N[(N[(x + -1.0), $MachinePrecision] / 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 -50000 \lor \neg \left(x \leq 47000\right):\\
\;\;\;\;1 + \frac{x + -1}{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 -1.0)
t_0
(if (<= x -3.3e-82)
(/ x (/ y x))
(if (<= x 950.0) (/ x (+ x 1.0)) t_0)))))
double code(double x, double y) {
double t_0 = 1.0 + (x / y);
double tmp;
if (x <= -1.0) {
tmp = t_0;
} else if (x <= -3.3e-82) {
tmp = x / (y / x);
} else if (x <= 950.0) {
tmp = x / (x + 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 (x <= (-1.0d0)) then
tmp = t_0
else if (x <= (-3.3d-82)) then
tmp = x / (y / x)
else if (x <= 950.0d0) then
tmp = x / (x + 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 (x <= -1.0) {
tmp = t_0;
} else if (x <= -3.3e-82) {
tmp = x / (y / x);
} else if (x <= 950.0) {
tmp = x / (x + 1.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + (x / y) tmp = 0 if x <= -1.0: tmp = t_0 elif x <= -3.3e-82: tmp = x / (y / x) elif x <= 950.0: tmp = x / (x + 1.0) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(x / y)) tmp = 0.0 if (x <= -1.0) tmp = t_0; elseif (x <= -3.3e-82) tmp = Float64(x / Float64(y / x)); elseif (x <= 950.0) tmp = Float64(x / Float64(x + 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 (x <= -1.0) tmp = t_0; elseif (x <= -3.3e-82) tmp = x / (y / x); elseif (x <= 950.0) tmp = x / (x + 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[x, -1.0], t$95$0, If[LessEqual[x, -3.3e-82], N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 950.0], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{x}{y}\\
\mathbf{if}\;x \leq -1:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -3.3 \cdot 10^{-82}:\\
\;\;\;\;\frac{x}{\frac{y}{x}}\\
\mathbf{elif}\;x \leq 950:\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\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 (if (or (<= x -1.0) (not (<= x 1.0))) (+ 1.0 (/ x y)) (+ x (/ x (/ y x)))))
double code(double x, double y) {
double tmp;
if ((x <= -1.0) || !(x <= 1.0)) {
tmp = 1.0 + (x / y);
} else {
tmp = x + (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.0d0)) .or. (.not. (x <= 1.0d0))) then
tmp = 1.0d0 + (x / y)
else
tmp = x + (x / (y / x))
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 / (y / x));
}
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 / (y / x)) 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(y / x))); 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 / (y / x)); 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[(y / x), $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 + \frac{x}{\frac{y}{x}}\\
\end{array}
\end{array}
(FPCore (x y) :precision binary64 (if (or (<= x -1.0) (not (<= x 1.22))) (+ 1.0 (/ (+ x -1.0) y)) (+ x (/ x (/ y x)))))
double code(double x, double y) {
double tmp;
if ((x <= -1.0) || !(x <= 1.22)) {
tmp = 1.0 + ((x + -1.0) / y);
} else {
tmp = x + (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.0d0)) .or. (.not. (x <= 1.22d0))) then
tmp = 1.0d0 + ((x + (-1.0d0)) / y)
else
tmp = x + (x / (y / x))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -1.0) || !(x <= 1.22)) {
tmp = 1.0 + ((x + -1.0) / y);
} else {
tmp = x + (x / (y / x));
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -1.0) or not (x <= 1.22): tmp = 1.0 + ((x + -1.0) / y) else: tmp = x + (x / (y / x)) return tmp
function code(x, y) tmp = 0.0 if ((x <= -1.0) || !(x <= 1.22)) tmp = Float64(1.0 + Float64(Float64(x + -1.0) / y)); else tmp = Float64(x + Float64(x / Float64(y / x))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -1.0) || ~((x <= 1.22))) tmp = 1.0 + ((x + -1.0) / y); else tmp = x + (x / (y / x)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -1.0], N[Not[LessEqual[x, 1.22]], $MachinePrecision]], N[(1.0 + N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(x + N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 1.22\right):\\
\;\;\;\;1 + \frac{x + -1}{y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{x}{\frac{y}{x}}\\
\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.0088))) (+ 1.0 (/ x y)) x))
double code(double x, double y) {
double tmp;
if ((x <= -1.0) || !(x <= 0.0088)) {
tmp = 1.0 + (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.0088d0))) then
tmp = 1.0d0 + (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.0088)) {
tmp = 1.0 + (x / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -1.0) or not (x <= 0.0088): tmp = 1.0 + (x / y) else: tmp = x return tmp
function code(x, y) tmp = 0.0 if ((x <= -1.0) || !(x <= 0.0088)) tmp = Float64(1.0 + 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.0088))) tmp = 1.0 + (x / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -1.0], N[Not[LessEqual[x, 0.0088]], $MachinePrecision]], N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 0.0088\right):\\
\;\;\;\;1 + \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
(FPCore (x y) :precision binary64 (if (or (<= x -68000000.0) (not (<= x 2600000.0))) (+ 1.0 (/ x y)) (/ x (+ x 1.0))))
double code(double x, double y) {
double tmp;
if ((x <= -68000000.0) || !(x <= 2600000.0)) {
tmp = 1.0 + (x / y);
} else {
tmp = x / (x + 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 <= (-68000000.0d0)) .or. (.not. (x <= 2600000.0d0))) then
tmp = 1.0d0 + (x / y)
else
tmp = x / (x + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -68000000.0) || !(x <= 2600000.0)) {
tmp = 1.0 + (x / y);
} else {
tmp = x / (x + 1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -68000000.0) or not (x <= 2600000.0): tmp = 1.0 + (x / y) else: tmp = x / (x + 1.0) return tmp
function code(x, y) tmp = 0.0 if ((x <= -68000000.0) || !(x <= 2600000.0)) tmp = Float64(1.0 + Float64(x / y)); else tmp = Float64(x / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -68000000.0) || ~((x <= 2600000.0))) tmp = 1.0 + (x / y); else tmp = x / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -68000000.0], N[Not[LessEqual[x, 2600000.0]], $MachinePrecision]], N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -68000000 \lor \neg \left(x \leq 2600000\right):\\
\;\;\;\;1 + \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x + 1}\\
\end{array}
\end{array}
(FPCore (x y) :precision binary64 (if (or (<= x -1.0) (not (<= x 0.07))) (/ x y) x))
double code(double x, double y) {
double tmp;
if ((x <= -1.0) || !(x <= 0.07)) {
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.07d0))) 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.07)) {
tmp = x / y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -1.0) or not (x <= 0.07): tmp = x / y else: tmp = x return tmp
function code(x, y) tmp = 0.0 if ((x <= -1.0) || !(x <= 0.07)) 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.07))) 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.07]], $MachinePrecision]], N[(x / y), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 0.07\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
(FPCore (x y) :precision binary64 (if (<= x -4.4e-5) 1.0 (if (<= x 45000000000.0) x 1.0)))
double code(double x, double y) {
double tmp;
if (x <= -4.4e-5) {
tmp = 1.0;
} else if (x <= 45000000000.0) {
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 <= (-4.4d-5)) then
tmp = 1.0d0
else if (x <= 45000000000.0d0) 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 <= -4.4e-5) {
tmp = 1.0;
} else if (x <= 45000000000.0) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -4.4e-5: tmp = 1.0 elif x <= 45000000000.0: tmp = x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (x <= -4.4e-5) tmp = 1.0; elseif (x <= 45000000000.0) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -4.4e-5) tmp = 1.0; elseif (x <= 45000000000.0) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -4.4e-5], 1.0, If[LessEqual[x, 45000000000.0], x, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.4 \cdot 10^{-5}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 45000000000:\\
\;\;\;\;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 2023350
(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)))