
(FPCore (x y z) :precision binary64 (+ 1.0 (/ (* 4.0 (- (+ x (* y 0.25)) z)) y)))
double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0 + ((4.0d0 * ((x + (y * 0.25d0)) - z)) / y)
end function
public static double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y);
}
def code(x, y, z): return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y)
function code(x, y, z) return Float64(1.0 + Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.25)) - z)) / y)) end
function tmp = code(x, y, z) tmp = 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y); end
code[x_, y_, z_] := N[(1.0 + N[(N[(4.0 * N[(N[(x + N[(y * 0.25), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \frac{4 \cdot \left(\left(x + y \cdot 0.25\right) - z\right)}{y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ 1.0 (/ (* 4.0 (- (+ x (* y 0.25)) z)) y)))
double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0 + ((4.0d0 * ((x + (y * 0.25d0)) - z)) / y)
end function
public static double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y);
}
def code(x, y, z): return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y)
function code(x, y, z) return Float64(1.0 + Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.25)) - z)) / y)) end
function tmp = code(x, y, z) tmp = 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y); end
code[x_, y_, z_] := N[(1.0 + N[(N[(4.0 * N[(N[(x + N[(y * 0.25), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \frac{4 \cdot \left(\left(x + y \cdot 0.25\right) - z\right)}{y}
\end{array}
(FPCore (x y z) :precision binary64 (+ 2.0 (/ (- x z) (* y 0.25))))
double code(double x, double y, double z) {
return 2.0 + ((x - z) / (y * 0.25));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 2.0d0 + ((x - z) / (y * 0.25d0))
end function
public static double code(double x, double y, double z) {
return 2.0 + ((x - z) / (y * 0.25));
}
def code(x, y, z): return 2.0 + ((x - z) / (y * 0.25))
function code(x, y, z) return Float64(2.0 + Float64(Float64(x - z) / Float64(y * 0.25))) end
function tmp = code(x, y, z) tmp = 2.0 + ((x - z) / (y * 0.25)); end
code[x_, y_, z_] := N[(2.0 + N[(N[(x - z), $MachinePrecision] / N[(y * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 + \frac{x - z}{y \cdot 0.25}
\end{array}
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ 1.0 (* z (/ -4.0 y)))) (t_1 (+ 1.0 (* x (/ 4.0 y)))))
(if (<= x -2.4e+32)
t_1
(if (<= x -0.0195)
t_0
(if (<= x -1.1e-47)
t_1
(if (<= x -2.9e-305)
t_0
(if (<= x 6e-166)
2.0
(if (<= x 1.18e-136) t_0 (if (<= x 600000.0) 2.0 t_1)))))))))
double code(double x, double y, double z) {
double t_0 = 1.0 + (z * (-4.0 / y));
double t_1 = 1.0 + (x * (4.0 / y));
double tmp;
if (x <= -2.4e+32) {
tmp = t_1;
} else if (x <= -0.0195) {
tmp = t_0;
} else if (x <= -1.1e-47) {
tmp = t_1;
} else if (x <= -2.9e-305) {
tmp = t_0;
} else if (x <= 6e-166) {
tmp = 2.0;
} else if (x <= 1.18e-136) {
tmp = t_0;
} else if (x <= 600000.0) {
tmp = 2.0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 + (z * ((-4.0d0) / y))
t_1 = 1.0d0 + (x * (4.0d0 / y))
if (x <= (-2.4d+32)) then
tmp = t_1
else if (x <= (-0.0195d0)) then
tmp = t_0
else if (x <= (-1.1d-47)) then
tmp = t_1
else if (x <= (-2.9d-305)) then
tmp = t_0
else if (x <= 6d-166) then
tmp = 2.0d0
else if (x <= 1.18d-136) then
tmp = t_0
else if (x <= 600000.0d0) then
tmp = 2.0d0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 1.0 + (z * (-4.0 / y));
double t_1 = 1.0 + (x * (4.0 / y));
double tmp;
if (x <= -2.4e+32) {
tmp = t_1;
} else if (x <= -0.0195) {
tmp = t_0;
} else if (x <= -1.1e-47) {
tmp = t_1;
} else if (x <= -2.9e-305) {
tmp = t_0;
} else if (x <= 6e-166) {
tmp = 2.0;
} else if (x <= 1.18e-136) {
tmp = t_0;
} else if (x <= 600000.0) {
tmp = 2.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 + (z * (-4.0 / y)) t_1 = 1.0 + (x * (4.0 / y)) tmp = 0 if x <= -2.4e+32: tmp = t_1 elif x <= -0.0195: tmp = t_0 elif x <= -1.1e-47: tmp = t_1 elif x <= -2.9e-305: tmp = t_0 elif x <= 6e-166: tmp = 2.0 elif x <= 1.18e-136: tmp = t_0 elif x <= 600000.0: tmp = 2.0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(1.0 + Float64(z * Float64(-4.0 / y))) t_1 = Float64(1.0 + Float64(x * Float64(4.0 / y))) tmp = 0.0 if (x <= -2.4e+32) tmp = t_1; elseif (x <= -0.0195) tmp = t_0; elseif (x <= -1.1e-47) tmp = t_1; elseif (x <= -2.9e-305) tmp = t_0; elseif (x <= 6e-166) tmp = 2.0; elseif (x <= 1.18e-136) tmp = t_0; elseif (x <= 600000.0) tmp = 2.0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 + (z * (-4.0 / y)); t_1 = 1.0 + (x * (4.0 / y)); tmp = 0.0; if (x <= -2.4e+32) tmp = t_1; elseif (x <= -0.0195) tmp = t_0; elseif (x <= -1.1e-47) tmp = t_1; elseif (x <= -2.9e-305) tmp = t_0; elseif (x <= 6e-166) tmp = 2.0; elseif (x <= 1.18e-136) tmp = t_0; elseif (x <= 600000.0) tmp = 2.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 + N[(z * N[(-4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(x * N[(4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.4e+32], t$95$1, If[LessEqual[x, -0.0195], t$95$0, If[LessEqual[x, -1.1e-47], t$95$1, If[LessEqual[x, -2.9e-305], t$95$0, If[LessEqual[x, 6e-166], 2.0, If[LessEqual[x, 1.18e-136], t$95$0, If[LessEqual[x, 600000.0], 2.0, t$95$1]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + z \cdot \frac{-4}{y}\\
t_1 := 1 + x \cdot \frac{4}{y}\\
\mathbf{if}\;x \leq -2.4 \cdot 10^{+32}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -0.0195:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -1.1 \cdot 10^{-47}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -2.9 \cdot 10^{-305}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 6 \cdot 10^{-166}:\\
\;\;\;\;2\\
\mathbf{elif}\;x \leq 1.18 \cdot 10^{-136}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 600000:\\
\;\;\;\;2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ 1.0 (/ (* z -4.0) y))) (t_1 (+ 1.0 (* x (/ 4.0 y)))))
(if (<= x -1.95e+33)
t_1
(if (<= x -0.027)
t_0
(if (<= x -2e-47)
t_1
(if (<= x -3.5e-305)
t_0
(if (<= x 1.65e-165)
2.0
(if (<= x 2.75e-142)
(+ 1.0 (* z (/ -4.0 y)))
(if (<= x 215000000.0) 2.0 t_1)))))))))
double code(double x, double y, double z) {
double t_0 = 1.0 + ((z * -4.0) / y);
double t_1 = 1.0 + (x * (4.0 / y));
double tmp;
if (x <= -1.95e+33) {
tmp = t_1;
} else if (x <= -0.027) {
tmp = t_0;
} else if (x <= -2e-47) {
tmp = t_1;
} else if (x <= -3.5e-305) {
tmp = t_0;
} else if (x <= 1.65e-165) {
tmp = 2.0;
} else if (x <= 2.75e-142) {
tmp = 1.0 + (z * (-4.0 / y));
} else if (x <= 215000000.0) {
tmp = 2.0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 + ((z * (-4.0d0)) / y)
t_1 = 1.0d0 + (x * (4.0d0 / y))
if (x <= (-1.95d+33)) then
tmp = t_1
else if (x <= (-0.027d0)) then
tmp = t_0
else if (x <= (-2d-47)) then
tmp = t_1
else if (x <= (-3.5d-305)) then
tmp = t_0
else if (x <= 1.65d-165) then
tmp = 2.0d0
else if (x <= 2.75d-142) then
tmp = 1.0d0 + (z * ((-4.0d0) / y))
else if (x <= 215000000.0d0) then
tmp = 2.0d0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 1.0 + ((z * -4.0) / y);
double t_1 = 1.0 + (x * (4.0 / y));
double tmp;
if (x <= -1.95e+33) {
tmp = t_1;
} else if (x <= -0.027) {
tmp = t_0;
} else if (x <= -2e-47) {
tmp = t_1;
} else if (x <= -3.5e-305) {
tmp = t_0;
} else if (x <= 1.65e-165) {
tmp = 2.0;
} else if (x <= 2.75e-142) {
tmp = 1.0 + (z * (-4.0 / y));
} else if (x <= 215000000.0) {
tmp = 2.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 + ((z * -4.0) / y) t_1 = 1.0 + (x * (4.0 / y)) tmp = 0 if x <= -1.95e+33: tmp = t_1 elif x <= -0.027: tmp = t_0 elif x <= -2e-47: tmp = t_1 elif x <= -3.5e-305: tmp = t_0 elif x <= 1.65e-165: tmp = 2.0 elif x <= 2.75e-142: tmp = 1.0 + (z * (-4.0 / y)) elif x <= 215000000.0: tmp = 2.0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(1.0 + Float64(Float64(z * -4.0) / y)) t_1 = Float64(1.0 + Float64(x * Float64(4.0 / y))) tmp = 0.0 if (x <= -1.95e+33) tmp = t_1; elseif (x <= -0.027) tmp = t_0; elseif (x <= -2e-47) tmp = t_1; elseif (x <= -3.5e-305) tmp = t_0; elseif (x <= 1.65e-165) tmp = 2.0; elseif (x <= 2.75e-142) tmp = Float64(1.0 + Float64(z * Float64(-4.0 / y))); elseif (x <= 215000000.0) tmp = 2.0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 + ((z * -4.0) / y); t_1 = 1.0 + (x * (4.0 / y)); tmp = 0.0; if (x <= -1.95e+33) tmp = t_1; elseif (x <= -0.027) tmp = t_0; elseif (x <= -2e-47) tmp = t_1; elseif (x <= -3.5e-305) tmp = t_0; elseif (x <= 1.65e-165) tmp = 2.0; elseif (x <= 2.75e-142) tmp = 1.0 + (z * (-4.0 / y)); elseif (x <= 215000000.0) tmp = 2.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 + N[(N[(z * -4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(x * N[(4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.95e+33], t$95$1, If[LessEqual[x, -0.027], t$95$0, If[LessEqual[x, -2e-47], t$95$1, If[LessEqual[x, -3.5e-305], t$95$0, If[LessEqual[x, 1.65e-165], 2.0, If[LessEqual[x, 2.75e-142], N[(1.0 + N[(z * N[(-4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 215000000.0], 2.0, t$95$1]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{z \cdot -4}{y}\\
t_1 := 1 + x \cdot \frac{4}{y}\\
\mathbf{if}\;x \leq -1.95 \cdot 10^{+33}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -0.027:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -2 \cdot 10^{-47}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -3.5 \cdot 10^{-305}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.65 \cdot 10^{-165}:\\
\;\;\;\;2\\
\mathbf{elif}\;x \leq 2.75 \cdot 10^{-142}:\\
\;\;\;\;1 + z \cdot \frac{-4}{y}\\
\mathbf{elif}\;x \leq 215000000:\\
\;\;\;\;2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ 1.0 (/ (* z -4.0) y))) (t_1 (+ 1.0 (/ (* x 4.0) y))))
(if (<= x -2.95e+32)
t_1
(if (<= x -0.017)
t_0
(if (<= x -1.35e-47)
t_1
(if (<= x -3.2e-305)
t_0
(if (<= x 1.35e-165)
2.0
(if (<= x 2.02e-137)
(+ 1.0 (* z (/ -4.0 y)))
(if (<= x 8500000.0) 2.0 t_1)))))))))
double code(double x, double y, double z) {
double t_0 = 1.0 + ((z * -4.0) / y);
double t_1 = 1.0 + ((x * 4.0) / y);
double tmp;
if (x <= -2.95e+32) {
tmp = t_1;
} else if (x <= -0.017) {
tmp = t_0;
} else if (x <= -1.35e-47) {
tmp = t_1;
} else if (x <= -3.2e-305) {
tmp = t_0;
} else if (x <= 1.35e-165) {
tmp = 2.0;
} else if (x <= 2.02e-137) {
tmp = 1.0 + (z * (-4.0 / y));
} else if (x <= 8500000.0) {
tmp = 2.0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 + ((z * (-4.0d0)) / y)
t_1 = 1.0d0 + ((x * 4.0d0) / y)
if (x <= (-2.95d+32)) then
tmp = t_1
else if (x <= (-0.017d0)) then
tmp = t_0
else if (x <= (-1.35d-47)) then
tmp = t_1
else if (x <= (-3.2d-305)) then
tmp = t_0
else if (x <= 1.35d-165) then
tmp = 2.0d0
else if (x <= 2.02d-137) then
tmp = 1.0d0 + (z * ((-4.0d0) / y))
else if (x <= 8500000.0d0) then
tmp = 2.0d0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 1.0 + ((z * -4.0) / y);
double t_1 = 1.0 + ((x * 4.0) / y);
double tmp;
if (x <= -2.95e+32) {
tmp = t_1;
} else if (x <= -0.017) {
tmp = t_0;
} else if (x <= -1.35e-47) {
tmp = t_1;
} else if (x <= -3.2e-305) {
tmp = t_0;
} else if (x <= 1.35e-165) {
tmp = 2.0;
} else if (x <= 2.02e-137) {
tmp = 1.0 + (z * (-4.0 / y));
} else if (x <= 8500000.0) {
tmp = 2.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 + ((z * -4.0) / y) t_1 = 1.0 + ((x * 4.0) / y) tmp = 0 if x <= -2.95e+32: tmp = t_1 elif x <= -0.017: tmp = t_0 elif x <= -1.35e-47: tmp = t_1 elif x <= -3.2e-305: tmp = t_0 elif x <= 1.35e-165: tmp = 2.0 elif x <= 2.02e-137: tmp = 1.0 + (z * (-4.0 / y)) elif x <= 8500000.0: tmp = 2.0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(1.0 + Float64(Float64(z * -4.0) / y)) t_1 = Float64(1.0 + Float64(Float64(x * 4.0) / y)) tmp = 0.0 if (x <= -2.95e+32) tmp = t_1; elseif (x <= -0.017) tmp = t_0; elseif (x <= -1.35e-47) tmp = t_1; elseif (x <= -3.2e-305) tmp = t_0; elseif (x <= 1.35e-165) tmp = 2.0; elseif (x <= 2.02e-137) tmp = Float64(1.0 + Float64(z * Float64(-4.0 / y))); elseif (x <= 8500000.0) tmp = 2.0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 + ((z * -4.0) / y); t_1 = 1.0 + ((x * 4.0) / y); tmp = 0.0; if (x <= -2.95e+32) tmp = t_1; elseif (x <= -0.017) tmp = t_0; elseif (x <= -1.35e-47) tmp = t_1; elseif (x <= -3.2e-305) tmp = t_0; elseif (x <= 1.35e-165) tmp = 2.0; elseif (x <= 2.02e-137) tmp = 1.0 + (z * (-4.0 / y)); elseif (x <= 8500000.0) tmp = 2.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 + N[(N[(z * -4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(N[(x * 4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.95e+32], t$95$1, If[LessEqual[x, -0.017], t$95$0, If[LessEqual[x, -1.35e-47], t$95$1, If[LessEqual[x, -3.2e-305], t$95$0, If[LessEqual[x, 1.35e-165], 2.0, If[LessEqual[x, 2.02e-137], N[(1.0 + N[(z * N[(-4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 8500000.0], 2.0, t$95$1]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{z \cdot -4}{y}\\
t_1 := 1 + \frac{x \cdot 4}{y}\\
\mathbf{if}\;x \leq -2.95 \cdot 10^{+32}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -0.017:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -1.35 \cdot 10^{-47}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -3.2 \cdot 10^{-305}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{-165}:\\
\;\;\;\;2\\
\mathbf{elif}\;x \leq 2.02 \cdot 10^{-137}:\\
\;\;\;\;1 + z \cdot \frac{-4}{y}\\
\mathbf{elif}\;x \leq 8500000:\\
\;\;\;\;2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
(FPCore (x y z)
:precision binary64
(if (or (<= x -1.85e+69)
(and (not (<= x 98000000000000.0))
(or (<= x 1.45e+108) (not (<= x 1e+169)))))
(+ 1.0 (/ (* x 4.0) y))
(+ 2.0 (* -4.0 (/ z y)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.85e+69) || (!(x <= 98000000000000.0) && ((x <= 1.45e+108) || !(x <= 1e+169)))) {
tmp = 1.0 + ((x * 4.0) / y);
} else {
tmp = 2.0 + (-4.0 * (z / y));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-1.85d+69)) .or. (.not. (x <= 98000000000000.0d0)) .and. (x <= 1.45d+108) .or. (.not. (x <= 1d+169))) then
tmp = 1.0d0 + ((x * 4.0d0) / y)
else
tmp = 2.0d0 + ((-4.0d0) * (z / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.85e+69) || (!(x <= 98000000000000.0) && ((x <= 1.45e+108) || !(x <= 1e+169)))) {
tmp = 1.0 + ((x * 4.0) / y);
} else {
tmp = 2.0 + (-4.0 * (z / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.85e+69) or (not (x <= 98000000000000.0) and ((x <= 1.45e+108) or not (x <= 1e+169))): tmp = 1.0 + ((x * 4.0) / y) else: tmp = 2.0 + (-4.0 * (z / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.85e+69) || (!(x <= 98000000000000.0) && ((x <= 1.45e+108) || !(x <= 1e+169)))) tmp = Float64(1.0 + Float64(Float64(x * 4.0) / y)); else tmp = Float64(2.0 + Float64(-4.0 * Float64(z / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.85e+69) || (~((x <= 98000000000000.0)) && ((x <= 1.45e+108) || ~((x <= 1e+169))))) tmp = 1.0 + ((x * 4.0) / y); else tmp = 2.0 + (-4.0 * (z / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.85e+69], And[N[Not[LessEqual[x, 98000000000000.0]], $MachinePrecision], Or[LessEqual[x, 1.45e+108], N[Not[LessEqual[x, 1e+169]], $MachinePrecision]]]], N[(1.0 + N[(N[(x * 4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(2.0 + N[(-4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.85 \cdot 10^{+69} \lor \neg \left(x \leq 98000000000000\right) \land \left(x \leq 1.45 \cdot 10^{+108} \lor \neg \left(x \leq 10^{+169}\right)\right):\\
\;\;\;\;1 + \frac{x \cdot 4}{y}\\
\mathbf{else}:\\
\;\;\;\;2 + -4 \cdot \frac{z}{y}\\
\end{array}
\end{array}
(FPCore (x y z)
:precision binary64
(if (or (<= x -1.2e+33)
(and (not (<= x -0.021)) (or (<= x -2e-47) (not (<= x 8.6e-51)))))
(+ 2.0 (/ x (* y 0.25)))
(+ 2.0 (* -4.0 (/ z y)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.2e+33) || (!(x <= -0.021) && ((x <= -2e-47) || !(x <= 8.6e-51)))) {
tmp = 2.0 + (x / (y * 0.25));
} else {
tmp = 2.0 + (-4.0 * (z / y));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-1.2d+33)) .or. (.not. (x <= (-0.021d0))) .and. (x <= (-2d-47)) .or. (.not. (x <= 8.6d-51))) then
tmp = 2.0d0 + (x / (y * 0.25d0))
else
tmp = 2.0d0 + ((-4.0d0) * (z / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.2e+33) || (!(x <= -0.021) && ((x <= -2e-47) || !(x <= 8.6e-51)))) {
tmp = 2.0 + (x / (y * 0.25));
} else {
tmp = 2.0 + (-4.0 * (z / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.2e+33) or (not (x <= -0.021) and ((x <= -2e-47) or not (x <= 8.6e-51))): tmp = 2.0 + (x / (y * 0.25)) else: tmp = 2.0 + (-4.0 * (z / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.2e+33) || (!(x <= -0.021) && ((x <= -2e-47) || !(x <= 8.6e-51)))) tmp = Float64(2.0 + Float64(x / Float64(y * 0.25))); else tmp = Float64(2.0 + Float64(-4.0 * Float64(z / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.2e+33) || (~((x <= -0.021)) && ((x <= -2e-47) || ~((x <= 8.6e-51))))) tmp = 2.0 + (x / (y * 0.25)); else tmp = 2.0 + (-4.0 * (z / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.2e+33], And[N[Not[LessEqual[x, -0.021]], $MachinePrecision], Or[LessEqual[x, -2e-47], N[Not[LessEqual[x, 8.6e-51]], $MachinePrecision]]]], N[(2.0 + N[(x / N[(y * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 + N[(-4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.2 \cdot 10^{+33} \lor \neg \left(x \leq -0.021\right) \land \left(x \leq -2 \cdot 10^{-47} \lor \neg \left(x \leq 8.6 \cdot 10^{-51}\right)\right):\\
\;\;\;\;2 + \frac{x}{y \cdot 0.25}\\
\mathbf{else}:\\
\;\;\;\;2 + -4 \cdot \frac{z}{y}\\
\end{array}
\end{array}
(FPCore (x y z) :precision binary64 (if (or (<= x -7.4e+53) (not (<= x 225000000000.0))) (+ 1.0 (* x (/ 4.0 y))) 2.0))
double code(double x, double y, double z) {
double tmp;
if ((x <= -7.4e+53) || !(x <= 225000000000.0)) {
tmp = 1.0 + (x * (4.0 / y));
} else {
tmp = 2.0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-7.4d+53)) .or. (.not. (x <= 225000000000.0d0))) then
tmp = 1.0d0 + (x * (4.0d0 / y))
else
tmp = 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -7.4e+53) || !(x <= 225000000000.0)) {
tmp = 1.0 + (x * (4.0 / y));
} else {
tmp = 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -7.4e+53) or not (x <= 225000000000.0): tmp = 1.0 + (x * (4.0 / y)) else: tmp = 2.0 return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -7.4e+53) || !(x <= 225000000000.0)) tmp = Float64(1.0 + Float64(x * Float64(4.0 / y))); else tmp = 2.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -7.4e+53) || ~((x <= 225000000000.0))) tmp = 1.0 + (x * (4.0 / y)); else tmp = 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -7.4e+53], N[Not[LessEqual[x, 225000000000.0]], $MachinePrecision]], N[(1.0 + N[(x * N[(4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.4 \cdot 10^{+53} \lor \neg \left(x \leq 225000000000\right):\\
\;\;\;\;1 + x \cdot \frac{4}{y}\\
\mathbf{else}:\\
\;\;\;\;2\\
\end{array}
\end{array}
(FPCore (x y z) :precision binary64 (+ 2.0 (* (- x z) (/ 4.0 y))))
double code(double x, double y, double z) {
return 2.0 + ((x - z) * (4.0 / y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 2.0d0 + ((x - z) * (4.0d0 / y))
end function
public static double code(double x, double y, double z) {
return 2.0 + ((x - z) * (4.0 / y));
}
def code(x, y, z): return 2.0 + ((x - z) * (4.0 / y))
function code(x, y, z) return Float64(2.0 + Float64(Float64(x - z) * Float64(4.0 / y))) end
function tmp = code(x, y, z) tmp = 2.0 + ((x - z) * (4.0 / y)); end
code[x_, y_, z_] := N[(2.0 + N[(N[(x - z), $MachinePrecision] * N[(4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 + \left(x - z\right) \cdot \frac{4}{y}
\end{array}
(FPCore (x y z) :precision binary64 2.0)
double code(double x, double y, double z) {
return 2.0;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 2.0d0
end function
public static double code(double x, double y, double z) {
return 2.0;
}
def code(x, y, z): return 2.0
function code(x, y, z) return 2.0 end
function tmp = code(x, y, z) tmp = 2.0; end
code[x_, y_, z_] := 2.0
\begin{array}{l}
\\
2
\end{array}
herbie shell --seed 2023350
(FPCore (x y z)
:name "Data.Array.Repa.Algorithms.ColorRamp:rampColorHotToCold from repa-algorithms-3.4.0.1, C"
:precision binary64
(+ 1.0 (/ (* 4.0 (- (+ x (* y 0.25)) z)) y)))