
(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 8 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 (/ x (/ z (+ (- y z) 1.0))))
double code(double x, double y, double z) {
return x / (z / ((y - z) + 1.0));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x / (z / ((y - z) + 1.0d0))
end function
public static double code(double x, double y, double z) {
return x / (z / ((y - z) + 1.0));
}
def code(x, y, z): return x / (z / ((y - z) + 1.0))
function code(x, y, z) return Float64(x / Float64(z / Float64(Float64(y - z) + 1.0))) end
function tmp = code(x, y, z) tmp = x / (z / ((y - z) + 1.0)); end
code[x_, y_, z_] := N[(x / N[(z / N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{\frac{z}{\left(y - z\right) + 1}}
\end{array}
Initial program 88.9%
associate-/l*97.7%
Simplified97.7%
Final simplification97.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* y (/ x z))))
(if (<= z -1.0)
(- x)
(if (<= z 1.8e-298)
(/ x z)
(if (<= z 3.2e-258)
t_0
(if (<= z 5e-202)
(/ x z)
(if (<= z 4.2e-96) t_0 (if (<= z 1.0) (/ x z) (- 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 <= 1.8e-298) {
tmp = x / z;
} else if (z <= 3.2e-258) {
tmp = t_0;
} else if (z <= 5e-202) {
tmp = x / z;
} else if (z <= 4.2e-96) {
tmp = t_0;
} else if (z <= 1.0) {
tmp = x / z;
} 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 <= 1.8d-298) then
tmp = x / z
else if (z <= 3.2d-258) then
tmp = t_0
else if (z <= 5d-202) then
tmp = x / z
else if (z <= 4.2d-96) then
tmp = t_0
else if (z <= 1.0d0) then
tmp = x / z
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 <= 1.8e-298) {
tmp = x / z;
} else if (z <= 3.2e-258) {
tmp = t_0;
} else if (z <= 5e-202) {
tmp = x / z;
} else if (z <= 4.2e-96) {
tmp = t_0;
} else if (z <= 1.0) {
tmp = x / z;
} 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 <= 1.8e-298: tmp = x / z elif z <= 3.2e-258: tmp = t_0 elif z <= 5e-202: tmp = x / z elif z <= 4.2e-96: tmp = t_0 elif z <= 1.0: tmp = x / z 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 <= 1.8e-298) tmp = Float64(x / z); elseif (z <= 3.2e-258) tmp = t_0; elseif (z <= 5e-202) tmp = Float64(x / z); elseif (z <= 4.2e-96) tmp = t_0; elseif (z <= 1.0) tmp = Float64(x / z); 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 <= 1.8e-298) tmp = x / z; elseif (z <= 3.2e-258) tmp = t_0; elseif (z <= 5e-202) tmp = x / z; elseif (z <= 4.2e-96) tmp = t_0; elseif (z <= 1.0) tmp = x / z; 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, 1.8e-298], N[(x / z), $MachinePrecision], If[LessEqual[z, 3.2e-258], t$95$0, If[LessEqual[z, 5e-202], N[(x / z), $MachinePrecision], If[LessEqual[z, 4.2e-96], t$95$0, If[LessEqual[z, 1.0], N[(x / z), $MachinePrecision], (-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.8 \cdot 10^{-298}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{-258}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 5 \cdot 10^{-202}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{-96}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
\end{array}
if z < -1 or 1 < z Initial program 79.7%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around inf 74.2%
neg-mul-174.2%
Simplified74.2%
if -1 < z < 1.80000000000000001e-298 or 3.2000000000000002e-258 < z < 4.99999999999999973e-202 or 4.20000000000000002e-96 < z < 1Initial program 99.9%
associate-/l*98.8%
Simplified98.8%
Taylor expanded in z around 0 94.7%
associate-/l*94.5%
associate-/r/93.4%
Simplified93.4%
Taylor expanded in y around 0 71.0%
if 1.80000000000000001e-298 < z < 3.2000000000000002e-258 or 4.99999999999999973e-202 < z < 4.20000000000000002e-96Initial program 99.9%
associate-/l*84.8%
Simplified84.8%
Taylor expanded in y around inf 82.5%
*-commutative82.5%
associate-/l*67.4%
Simplified67.4%
associate-/r/82.4%
Applied egg-rr82.4%
Final simplification74.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.5e-11) (not (<= z 8.7e-10))) (- (/ x z) x) (/ (* x (+ y 1.0)) z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.5e-11) || !(z <= 8.7e-10)) {
tmp = (x / z) - x;
} else {
tmp = (x * (y + 1.0)) / 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.5d-11)) .or. (.not. (z <= 8.7d-10))) then
tmp = (x / z) - x
else
tmp = (x * (y + 1.0d0)) / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.5e-11) || !(z <= 8.7e-10)) {
tmp = (x / z) - x;
} else {
tmp = (x * (y + 1.0)) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.5e-11) or not (z <= 8.7e-10): tmp = (x / z) - x else: tmp = (x * (y + 1.0)) / z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.5e-11) || !(z <= 8.7e-10)) tmp = Float64(Float64(x / z) - x); else tmp = Float64(Float64(x * Float64(y + 1.0)) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.5e-11) || ~((z <= 8.7e-10))) tmp = (x / z) - x; else tmp = (x * (y + 1.0)) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.5e-11], N[Not[LessEqual[z, 8.7e-10]], $MachinePrecision]], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision], N[(N[(x * N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.5 \cdot 10^{-11} \lor \neg \left(z \leq 8.7 \cdot 10^{-10}\right):\\
\;\;\;\;\frac{x}{z} - x\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(y + 1\right)}{z}\\
\end{array}
\end{array}
if z < -1.5e-11 or 8.69999999999999994e-10 < z Initial program 80.7%
associate-/l*99.9%
Simplified99.9%
associate-/r/79.3%
Applied egg-rr79.3%
Taylor expanded in y around 0 63.8%
associate-/l*60.4%
div-sub60.5%
associate-/r/60.4%
associate-*l/60.5%
*-lft-identity60.5%
associate-/r/77.9%
*-inverses77.9%
*-lft-identity77.9%
Simplified77.9%
if -1.5e-11 < z < 8.69999999999999994e-10Initial program 100.0%
associate-/l*94.6%
Simplified94.6%
Taylor expanded in z around 0 99.7%
Final simplification87.2%
(FPCore (x y z) :precision binary64 (if (<= z -8.6e+189) (- x) (* (+ (- y z) 1.0) (/ x z))))
double code(double x, double y, double z) {
double tmp;
if (z <= -8.6e+189) {
tmp = -x;
} else {
tmp = ((y - z) + 1.0) * (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 <= (-8.6d+189)) then
tmp = -x
else
tmp = ((y - z) + 1.0d0) * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -8.6e+189) {
tmp = -x;
} else {
tmp = ((y - z) + 1.0) * (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -8.6e+189: tmp = -x else: tmp = ((y - z) + 1.0) * (x / z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -8.6e+189) tmp = Float64(-x); else tmp = Float64(Float64(Float64(y - z) + 1.0) * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -8.6e+189) tmp = -x; else tmp = ((y - z) + 1.0) * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -8.6e+189], (-x), N[(N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.6 \cdot 10^{+189}:\\
\;\;\;\;-x\\
\mathbf{else}:\\
\;\;\;\;\left(\left(y - z\right) + 1\right) \cdot \frac{x}{z}\\
\end{array}
\end{array}
if z < -8.59999999999999995e189Initial program 89.4%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in z around inf 100.0%
neg-mul-1100.0%
Simplified100.0%
if -8.59999999999999995e189 < z Initial program 88.9%
associate-/l*97.4%
Simplified97.4%
associate-/r/93.1%
Applied egg-rr93.1%
Final simplification93.8%
(FPCore (x y z) :precision binary64 (if (<= y -5.5e+28) (* y (/ x z)) (if (<= y 1.26e+92) (- (/ x z) x) (* x (/ y z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -5.5e+28) {
tmp = y * (x / z);
} else if (y <= 1.26e+92) {
tmp = (x / z) - x;
} else {
tmp = x * (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 (y <= (-5.5d+28)) then
tmp = y * (x / z)
else if (y <= 1.26d+92) then
tmp = (x / z) - x
else
tmp = x * (y / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -5.5e+28) {
tmp = y * (x / z);
} else if (y <= 1.26e+92) {
tmp = (x / z) - x;
} else {
tmp = x * (y / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -5.5e+28: tmp = y * (x / z) elif y <= 1.26e+92: tmp = (x / z) - x else: tmp = x * (y / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -5.5e+28) tmp = Float64(y * Float64(x / z)); elseif (y <= 1.26e+92) tmp = Float64(Float64(x / z) - x); else tmp = Float64(x * Float64(y / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -5.5e+28) tmp = y * (x / z); elseif (y <= 1.26e+92) tmp = (x / z) - x; else tmp = x * (y / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -5.5e+28], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.26e+92], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.5 \cdot 10^{+28}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{elif}\;y \leq 1.26 \cdot 10^{+92}:\\
\;\;\;\;\frac{x}{z} - x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\end{array}
\end{array}
if y < -5.5000000000000003e28Initial program 91.0%
associate-/l*94.3%
Simplified94.3%
Taylor expanded in y around inf 69.1%
*-commutative69.1%
associate-/l*67.0%
Simplified67.0%
associate-/r/71.3%
Applied egg-rr71.3%
if -5.5000000000000003e28 < y < 1.26e92Initial program 89.4%
associate-/l*99.9%
Simplified99.9%
associate-/r/89.5%
Applied egg-rr89.5%
Taylor expanded in y around 0 84.0%
associate-/l*83.2%
div-sub78.2%
associate-/r/78.2%
associate-*l/78.4%
*-lft-identity78.4%
associate-/r/94.6%
*-inverses94.6%
*-lft-identity94.6%
Simplified94.6%
if 1.26e92 < y Initial program 84.6%
associate-/l*93.4%
Simplified93.4%
Taylor expanded in y around inf 73.5%
associate-/l*68.9%
associate-/r/77.9%
Simplified77.9%
Final simplification86.9%
(FPCore (x y z) :precision binary64 (if (<= y -1.7e+21) (* y (/ x z)) (if (<= y 2.1e+87) (- (/ x z) x) (/ x (/ z y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.7e+21) {
tmp = y * (x / z);
} else if (y <= 2.1e+87) {
tmp = (x / z) - x;
} else {
tmp = x / (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 (y <= (-1.7d+21)) then
tmp = y * (x / z)
else if (y <= 2.1d+87) then
tmp = (x / z) - x
else
tmp = x / (z / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.7e+21) {
tmp = y * (x / z);
} else if (y <= 2.1e+87) {
tmp = (x / z) - x;
} else {
tmp = x / (z / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.7e+21: tmp = y * (x / z) elif y <= 2.1e+87: tmp = (x / z) - x else: tmp = x / (z / y) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.7e+21) tmp = Float64(y * Float64(x / z)); elseif (y <= 2.1e+87) tmp = Float64(Float64(x / z) - x); else tmp = Float64(x / Float64(z / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.7e+21) tmp = y * (x / z); elseif (y <= 2.1e+87) tmp = (x / z) - x; else tmp = x / (z / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.7e+21], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.1e+87], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.7 \cdot 10^{+21}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{elif}\;y \leq 2.1 \cdot 10^{+87}:\\
\;\;\;\;\frac{x}{z} - x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\end{array}
\end{array}
if y < -1.7e21Initial program 91.0%
associate-/l*94.3%
Simplified94.3%
Taylor expanded in y around inf 69.1%
*-commutative69.1%
associate-/l*67.0%
Simplified67.0%
associate-/r/71.3%
Applied egg-rr71.3%
if -1.7e21 < y < 2.1e87Initial program 89.4%
associate-/l*99.9%
Simplified99.9%
associate-/r/89.5%
Applied egg-rr89.5%
Taylor expanded in y around 0 84.0%
associate-/l*83.2%
div-sub78.2%
associate-/r/78.2%
associate-*l/78.4%
*-lft-identity78.4%
associate-/r/94.6%
*-inverses94.6%
*-lft-identity94.6%
Simplified94.6%
if 2.1e87 < y Initial program 84.6%
associate-/l*93.4%
Simplified93.4%
Taylor expanded in y around inf 73.5%
*-commutative73.5%
associate-/l*78.0%
Simplified78.0%
Final simplification87.0%
(FPCore (x y z) :precision binary64 (if (<= z -1.0) (- x) (if (<= z 1.0) (/ x z) (- x))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = -x;
} else if (z <= 1.0) {
tmp = x / z;
} 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) :: tmp
if (z <= (-1.0d0)) then
tmp = -x
else if (z <= 1.0d0) then
tmp = x / z
else
tmp = -x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = -x;
} else if (z <= 1.0) {
tmp = x / z;
} else {
tmp = -x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.0: tmp = -x elif z <= 1.0: tmp = x / z else: tmp = -x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.0) tmp = Float64(-x); elseif (z <= 1.0) tmp = Float64(x / z); else tmp = Float64(-x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.0) tmp = -x; elseif (z <= 1.0) tmp = x / z; else tmp = -x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.0], (-x), If[LessEqual[z, 1.0], N[(x / z), $MachinePrecision], (-x)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;-x\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
\end{array}
if z < -1 or 1 < z Initial program 79.7%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around inf 74.2%
neg-mul-174.2%
Simplified74.2%
if -1 < z < 1Initial program 99.9%
associate-/l*95.0%
Simplified95.0%
Taylor expanded in z around 0 96.1%
associate-/l*95.9%
associate-/r/90.5%
Simplified90.5%
Taylor expanded in y around 0 59.1%
Final simplification67.3%
(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}
Initial program 88.9%
associate-/l*97.7%
Simplified97.7%
Taylor expanded in z around inf 41.9%
neg-mul-141.9%
Simplified41.9%
Final simplification41.9%
(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 2023214
(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))