
(FPCore (x y z) :precision binary64 (/ (* x (+ (- y z) 1.0)) z))
double code(double x, double y, double z) {
return (x * ((y - z) + 1.0)) / z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x * ((y - z) + 1.0d0)) / z
end function
public static double code(double x, double y, double z) {
return (x * ((y - z) + 1.0)) / z;
}
def code(x, y, z): return (x * ((y - z) + 1.0)) / z
function code(x, y, z) return Float64(Float64(x * Float64(Float64(y - z) + 1.0)) / z) end
function tmp = code(x, y, z) tmp = (x * ((y - z) + 1.0)) / z; end
code[x_, y_, z_] := N[(N[(x * N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (* x (+ (- y z) 1.0)) z))
double code(double x, double y, double z) {
return (x * ((y - z) + 1.0)) / z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x * ((y - z) + 1.0d0)) / z
end function
public static double code(double x, double y, double z) {
return (x * ((y - z) + 1.0)) / z;
}
def code(x, y, z): return (x * ((y - z) + 1.0)) / z
function code(x, y, z) return Float64(Float64(x * Float64(Float64(y - z) + 1.0)) / z) end
function tmp = code(x, y, z) tmp = (x * ((y - z) + 1.0)) / z; end
code[x_, y_, z_] := N[(N[(x * N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z}
\end{array}
(FPCore (x y z) :precision binary64 (if (or (<= z -5e+15) (not (<= z 500000.0))) (* x (+ (/ (+ 1.0 y) z) -1.0)) (* (/ x z) (+ 1.0 (- y z)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -5e+15) || !(z <= 500000.0)) {
tmp = x * (((1.0 + y) / z) + -1.0);
} else {
tmp = (x / z) * (1.0 + (y - z));
}
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 ((z <= (-5d+15)) .or. (.not. (z <= 500000.0d0))) then
tmp = x * (((1.0d0 + y) / z) + (-1.0d0))
else
tmp = (x / z) * (1.0d0 + (y - z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -5e+15) || !(z <= 500000.0)) {
tmp = x * (((1.0 + y) / z) + -1.0);
} else {
tmp = (x / z) * (1.0 + (y - z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -5e+15) or not (z <= 500000.0): tmp = x * (((1.0 + y) / z) + -1.0) else: tmp = (x / z) * (1.0 + (y - z)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -5e+15) || !(z <= 500000.0)) tmp = Float64(x * Float64(Float64(Float64(1.0 + y) / z) + -1.0)); else tmp = Float64(Float64(x / z) * Float64(1.0 + Float64(y - z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -5e+15) || ~((z <= 500000.0))) tmp = x * (((1.0 + y) / z) + -1.0); else tmp = (x / z) * (1.0 + (y - z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -5e+15], N[Not[LessEqual[z, 500000.0]], $MachinePrecision]], N[(x * N[(N[(N[(1.0 + y), $MachinePrecision] / z), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * N[(1.0 + N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{+15} \lor \neg \left(z \leq 500000\right):\\
\;\;\;\;x \cdot \left(\frac{1 + y}{z} + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} \cdot \left(1 + \left(y - z\right)\right)\\
\end{array}
\end{array}
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* y (/ x z))))
(if (<= z -1.0)
(- x)
(if (<= z -1e-253)
(/ x z)
(if (<= z 1.02e-107)
t_0
(if (<= z 3.8e-19) (/ x z) (if (<= z 1.05e+48) t_0 (- x))))))))
double code(double x, double y, double z) {
double t_0 = y * (x / z);
double tmp;
if (z <= -1.0) {
tmp = -x;
} else if (z <= -1e-253) {
tmp = x / z;
} else if (z <= 1.02e-107) {
tmp = t_0;
} else if (z <= 3.8e-19) {
tmp = x / z;
} else if (z <= 1.05e+48) {
tmp = t_0;
} else {
tmp = -x;
}
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) :: tmp
t_0 = y * (x / z)
if (z <= (-1.0d0)) then
tmp = -x
else if (z <= (-1d-253)) then
tmp = x / z
else if (z <= 1.02d-107) then
tmp = t_0
else if (z <= 3.8d-19) then
tmp = x / z
else if (z <= 1.05d+48) then
tmp = t_0
else
tmp = -x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y * (x / z);
double tmp;
if (z <= -1.0) {
tmp = -x;
} else if (z <= -1e-253) {
tmp = x / z;
} else if (z <= 1.02e-107) {
tmp = t_0;
} else if (z <= 3.8e-19) {
tmp = x / z;
} else if (z <= 1.05e+48) {
tmp = t_0;
} else {
tmp = -x;
}
return tmp;
}
def code(x, y, z): t_0 = y * (x / z) tmp = 0 if z <= -1.0: tmp = -x elif z <= -1e-253: tmp = x / z elif z <= 1.02e-107: tmp = t_0 elif z <= 3.8e-19: tmp = x / z elif z <= 1.05e+48: tmp = t_0 else: tmp = -x return tmp
function code(x, y, z) t_0 = Float64(y * Float64(x / z)) tmp = 0.0 if (z <= -1.0) tmp = Float64(-x); elseif (z <= -1e-253) tmp = Float64(x / z); elseif (z <= 1.02e-107) tmp = t_0; elseif (z <= 3.8e-19) tmp = Float64(x / z); elseif (z <= 1.05e+48) tmp = t_0; else tmp = Float64(-x); end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * (x / z); tmp = 0.0; if (z <= -1.0) tmp = -x; elseif (z <= -1e-253) tmp = x / z; elseif (z <= 1.02e-107) tmp = t_0; elseif (z <= 3.8e-19) tmp = x / z; elseif (z <= 1.05e+48) tmp = t_0; else tmp = -x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.0], (-x), If[LessEqual[z, -1e-253], N[(x / z), $MachinePrecision], If[LessEqual[z, 1.02e-107], t$95$0, If[LessEqual[z, 3.8e-19], N[(x / z), $MachinePrecision], If[LessEqual[z, 1.05e+48], t$95$0, (-x)]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \frac{x}{z}\\
\mathbf{if}\;z \leq -1:\\
\;\;\;\;-x\\
\mathbf{elif}\;z \leq -1 \cdot 10^{-253}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;z \leq 1.02 \cdot 10^{-107}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{-19}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{+48}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
\end{array}
(FPCore (x y z) :precision binary64 (if (or (<= z -1.8e-6) (not (<= z 3e-17))) (* x (+ (/ (+ 1.0 y) z) -1.0)) (/ (+ x (* y x)) z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.8e-6) || !(z <= 3e-17)) {
tmp = x * (((1.0 + y) / z) + -1.0);
} else {
tmp = (x + (y * x)) / z;
}
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 ((z <= (-1.8d-6)) .or. (.not. (z <= 3d-17))) then
tmp = x * (((1.0d0 + y) / z) + (-1.0d0))
else
tmp = (x + (y * x)) / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.8e-6) || !(z <= 3e-17)) {
tmp = x * (((1.0 + y) / z) + -1.0);
} else {
tmp = (x + (y * x)) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.8e-6) or not (z <= 3e-17): tmp = x * (((1.0 + y) / z) + -1.0) else: tmp = (x + (y * x)) / z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.8e-6) || !(z <= 3e-17)) tmp = Float64(x * Float64(Float64(Float64(1.0 + y) / z) + -1.0)); else tmp = Float64(Float64(x + Float64(y * x)) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.8e-6) || ~((z <= 3e-17))) tmp = x * (((1.0 + y) / z) + -1.0); else tmp = (x + (y * x)) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.8e-6], N[Not[LessEqual[z, 3e-17]], $MachinePrecision]], N[(x * N[(N[(N[(1.0 + y), $MachinePrecision] / z), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(y * x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{-6} \lor \neg \left(z \leq 3 \cdot 10^{-17}\right):\\
\;\;\;\;x \cdot \left(\frac{1 + y}{z} + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x + y \cdot x}{z}\\
\end{array}
\end{array}
(FPCore (x y z) :precision binary64 (if (or (<= y -5500.0) (not (<= y 4.4e-15))) (- (* y (/ x z)) x) (- (/ x z) x)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -5500.0) || !(y <= 4.4e-15)) {
tmp = (y * (x / z)) - x;
} else {
tmp = (x / z) - x;
}
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 ((y <= (-5500.0d0)) .or. (.not. (y <= 4.4d-15))) then
tmp = (y * (x / z)) - x
else
tmp = (x / z) - x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -5500.0) || !(y <= 4.4e-15)) {
tmp = (y * (x / z)) - x;
} else {
tmp = (x / z) - x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -5500.0) or not (y <= 4.4e-15): tmp = (y * (x / z)) - x else: tmp = (x / z) - x return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -5500.0) || !(y <= 4.4e-15)) tmp = Float64(Float64(y * Float64(x / z)) - x); else tmp = Float64(Float64(x / z) - x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -5500.0) || ~((y <= 4.4e-15))) tmp = (y * (x / z)) - x; else tmp = (x / z) - x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -5500.0], N[Not[LessEqual[y, 4.4e-15]], $MachinePrecision]], N[(N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5500 \lor \neg \left(y \leq 4.4 \cdot 10^{-15}\right):\\
\;\;\;\;y \cdot \frac{x}{z} - x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} - x\\
\end{array}
\end{array}
(FPCore (x y z) :precision binary64 (if (or (<= y -6.5e+38) (not (<= y 3.3e+118))) (* y (/ x z)) (- (/ x z) x)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -6.5e+38) || !(y <= 3.3e+118)) {
tmp = y * (x / z);
} else {
tmp = (x / z) - x;
}
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 ((y <= (-6.5d+38)) .or. (.not. (y <= 3.3d+118))) then
tmp = y * (x / z)
else
tmp = (x / z) - x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -6.5e+38) || !(y <= 3.3e+118)) {
tmp = y * (x / z);
} else {
tmp = (x / z) - x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -6.5e+38) or not (y <= 3.3e+118): tmp = y * (x / z) else: tmp = (x / z) - x return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -6.5e+38) || !(y <= 3.3e+118)) tmp = Float64(y * Float64(x / z)); else tmp = Float64(Float64(x / z) - x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -6.5e+38) || ~((y <= 3.3e+118))) tmp = y * (x / z); else tmp = (x / z) - x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -6.5e+38], N[Not[LessEqual[y, 3.3e+118]], $MachinePrecision]], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.5 \cdot 10^{+38} \lor \neg \left(y \leq 3.3 \cdot 10^{+118}\right):\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} - x\\
\end{array}
\end{array}
(FPCore (x y z) :precision binary64 (if (<= y -4.4e+38) (/ y (/ z x)) (if (<= y 1.22e+119) (- (/ x z) x) (* y (/ x z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -4.4e+38) {
tmp = y / (z / x);
} else if (y <= 1.22e+119) {
tmp = (x / z) - x;
} else {
tmp = y * (x / z);
}
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 (y <= (-4.4d+38)) then
tmp = y / (z / x)
else if (y <= 1.22d+119) then
tmp = (x / z) - x
else
tmp = y * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -4.4e+38) {
tmp = y / (z / x);
} else if (y <= 1.22e+119) {
tmp = (x / z) - x;
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -4.4e+38: tmp = y / (z / x) elif y <= 1.22e+119: tmp = (x / z) - x else: tmp = y * (x / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -4.4e+38) tmp = Float64(y / Float64(z / x)); elseif (y <= 1.22e+119) tmp = Float64(Float64(x / z) - x); else tmp = Float64(y * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -4.4e+38) tmp = y / (z / x); elseif (y <= 1.22e+119) tmp = (x / z) - x; else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -4.4e+38], N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.22e+119], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.4 \cdot 10^{+38}:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\
\mathbf{elif}\;y \leq 1.22 \cdot 10^{+119}:\\
\;\;\;\;\frac{x}{z} - x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
(FPCore (x y z) :precision binary64 (if (<= y -1.1e+39) (/ y (/ z x)) (if (<= y 3.1e+117) (- (/ x z) x) (/ (* y x) z))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.1e+39) {
tmp = y / (z / x);
} else if (y <= 3.1e+117) {
tmp = (x / z) - x;
} else {
tmp = (y * x) / z;
}
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 (y <= (-1.1d+39)) then
tmp = y / (z / x)
else if (y <= 3.1d+117) then
tmp = (x / z) - x
else
tmp = (y * x) / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.1e+39) {
tmp = y / (z / x);
} else if (y <= 3.1e+117) {
tmp = (x / z) - x;
} else {
tmp = (y * x) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.1e+39: tmp = y / (z / x) elif y <= 3.1e+117: tmp = (x / z) - x else: tmp = (y * x) / z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.1e+39) tmp = Float64(y / Float64(z / x)); elseif (y <= 3.1e+117) tmp = Float64(Float64(x / z) - x); else tmp = Float64(Float64(y * x) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.1e+39) tmp = y / (z / x); elseif (y <= 3.1e+117) tmp = (x / z) - x; else tmp = (y * x) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.1e+39], N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.1e+117], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision], N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.1 \cdot 10^{+39}:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\
\mathbf{elif}\;y \leq 3.1 \cdot 10^{+117}:\\
\;\;\;\;\frac{x}{z} - x\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot x}{z}\\
\end{array}
\end{array}
(FPCore (x y z) :precision binary64 (- (* (+ 1.0 y) (/ x z)) x))
double code(double x, double y, double z) {
return ((1.0 + y) * (x / z)) - x;
}
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 + y) * (x / z)) - x
end function
public static double code(double x, double y, double z) {
return ((1.0 + y) * (x / z)) - x;
}
def code(x, y, z): return ((1.0 + y) * (x / z)) - x
function code(x, y, z) return Float64(Float64(Float64(1.0 + y) * Float64(x / z)) - x) end
function tmp = code(x, y, z) tmp = ((1.0 + y) * (x / z)) - x; end
code[x_, y_, z_] := N[(N[(N[(1.0 + y), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]
\begin{array}{l}
\\
\left(1 + y\right) \cdot \frac{x}{z} - x
\end{array}
(FPCore (x y z) :precision binary64 (if (or (<= z -1.0) (not (<= z 1.0))) (- x) (/ x z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 1.0)) {
tmp = -x;
} else {
tmp = x / z;
}
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 ((z <= (-1.0d0)) .or. (.not. (z <= 1.0d0))) then
tmp = -x
else
tmp = x / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 1.0)) {
tmp = -x;
} else {
tmp = x / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.0) or not (z <= 1.0): tmp = -x else: tmp = x / z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.0) || !(z <= 1.0)) tmp = Float64(-x); else tmp = Float64(x / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.0) || ~((z <= 1.0))) tmp = -x; else tmp = x / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], (-x), N[(x / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;-x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z}\\
\end{array}
\end{array}
(FPCore (x y z) :precision binary64 (- x))
double code(double x, double y, double z) {
return -x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = -x
end function
public static double code(double x, double y, double z) {
return -x;
}
def code(x, y, z): return -x
function code(x, y, z) return Float64(-x) end
function tmp = code(x, y, z) tmp = -x; end
code[x_, y_, z_] := (-x)
\begin{array}{l}
\\
-x
\end{array}
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (* (+ 1.0 y) (/ x z)) x)))
(if (< x -2.71483106713436e-162)
t_0
(if (< x 3.874108816439546e-197)
(* (* x (+ (- y z) 1.0)) (/ 1.0 z))
t_0))))
double code(double x, double y, double z) {
double t_0 = ((1.0 + y) * (x / z)) - x;
double tmp;
if (x < -2.71483106713436e-162) {
tmp = t_0;
} else if (x < 3.874108816439546e-197) {
tmp = (x * ((y - z) + 1.0)) * (1.0 / z);
} else {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = ((1.0d0 + y) * (x / z)) - x
if (x < (-2.71483106713436d-162)) then
tmp = t_0
else if (x < 3.874108816439546d-197) then
tmp = (x * ((y - z) + 1.0d0)) * (1.0d0 / z)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = ((1.0 + y) * (x / z)) - x;
double tmp;
if (x < -2.71483106713436e-162) {
tmp = t_0;
} else if (x < 3.874108816439546e-197) {
tmp = (x * ((y - z) + 1.0)) * (1.0 / z);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = ((1.0 + y) * (x / z)) - x tmp = 0 if x < -2.71483106713436e-162: tmp = t_0 elif x < 3.874108816439546e-197: tmp = (x * ((y - z) + 1.0)) * (1.0 / z) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(1.0 + y) * Float64(x / z)) - x) tmp = 0.0 if (x < -2.71483106713436e-162) tmp = t_0; elseif (x < 3.874108816439546e-197) tmp = Float64(Float64(x * Float64(Float64(y - z) + 1.0)) * Float64(1.0 / z)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = ((1.0 + y) * (x / z)) - x; tmp = 0.0; if (x < -2.71483106713436e-162) tmp = t_0; elseif (x < 3.874108816439546e-197) tmp = (x * ((y - z) + 1.0)) * (1.0 / z); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(1.0 + y), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]}, If[Less[x, -2.71483106713436e-162], t$95$0, If[Less[x, 3.874108816439546e-197], N[(N[(x * N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * N[(1.0 / z), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 + y\right) \cdot \frac{x}{z} - x\\
\mathbf{if}\;x < -2.71483106713436 \cdot 10^{-162}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x < 3.874108816439546 \cdot 10^{-197}:\\
\;\;\;\;\left(x \cdot \left(\left(y - z\right) + 1\right)\right) \cdot \frac{1}{z}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
herbie shell --seed 2024003
(FPCore (x y z)
:name "Diagrams.TwoD.Segment.Bernstein:evaluateBernstein from diagrams-lib-1.3.0.3"
:precision binary64
:herbie-target
(if (< x -2.71483106713436e-162) (- (* (+ 1.0 y) (/ x z)) x) (if (< x 3.874108816439546e-197) (* (* x (+ (- y z) 1.0)) (/ 1.0 z)) (- (* (+ 1.0 y) (/ x z)) x)))
(/ (* x (+ (- y z) 1.0)) z))