(FPCore (x y z) :precision binary64 (/ (* x (- y z)) y))
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- x (/ (* z x) y))) (t_1 (/ x (/ y (- y z)))))
(if (<= z -7.372894544810212e+234)
t_0
(if (<= z 5.267723067807247e+137)
t_1
(if (<= z 3.6281276401897885e+257) t_0 t_1)))))double code(double x, double y, double z) {
return (x * (y - z)) / y;
}
double code(double x, double y, double z) {
double t_0 = x - ((z * x) / y);
double t_1 = x / (y / (y - z));
double tmp;
if (z <= -7.372894544810212e+234) {
tmp = t_0;
} else if (z <= 5.267723067807247e+137) {
tmp = t_1;
} else if (z <= 3.6281276401897885e+257) {
tmp = t_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
code = (x * (y - z)) / y
end function
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 = x - ((z * x) / y)
t_1 = x / (y / (y - z))
if (z <= (-7.372894544810212d+234)) then
tmp = t_0
else if (z <= 5.267723067807247d+137) then
tmp = t_1
else if (z <= 3.6281276401897885d+257) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
return (x * (y - z)) / y;
}
public static double code(double x, double y, double z) {
double t_0 = x - ((z * x) / y);
double t_1 = x / (y / (y - z));
double tmp;
if (z <= -7.372894544810212e+234) {
tmp = t_0;
} else if (z <= 5.267723067807247e+137) {
tmp = t_1;
} else if (z <= 3.6281276401897885e+257) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): return (x * (y - z)) / y
def code(x, y, z): t_0 = x - ((z * x) / y) t_1 = x / (y / (y - z)) tmp = 0 if z <= -7.372894544810212e+234: tmp = t_0 elif z <= 5.267723067807247e+137: tmp = t_1 elif z <= 3.6281276401897885e+257: tmp = t_0 else: tmp = t_1 return tmp
function code(x, y, z) return Float64(Float64(x * Float64(y - z)) / y) end
function code(x, y, z) t_0 = Float64(x - Float64(Float64(z * x) / y)) t_1 = Float64(x / Float64(y / Float64(y - z))) tmp = 0.0 if (z <= -7.372894544810212e+234) tmp = t_0; elseif (z <= 5.267723067807247e+137) tmp = t_1; elseif (z <= 3.6281276401897885e+257) tmp = t_0; else tmp = t_1; end return tmp end
function tmp = code(x, y, z) tmp = (x * (y - z)) / y; end
function tmp_2 = code(x, y, z) t_0 = x - ((z * x) / y); t_1 = x / (y / (y - z)); tmp = 0.0; if (z <= -7.372894544810212e+234) tmp = t_0; elseif (z <= 5.267723067807247e+137) tmp = t_1; elseif (z <= 3.6281276401897885e+257) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]
code[x_, y_, z_] := Block[{t$95$0 = N[(x - N[(N[(z * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x / N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7.372894544810212e+234], t$95$0, If[LessEqual[z, 5.267723067807247e+137], t$95$1, If[LessEqual[z, 3.6281276401897885e+257], t$95$0, t$95$1]]]]]
\frac{x \cdot \left(y - z\right)}{y}
\begin{array}{l}
t_0 := x - \frac{z \cdot x}{y}\\
t_1 := \frac{x}{\frac{y}{y - z}}\\
\mathbf{if}\;z \leq -7.372894544810212 \cdot 10^{+234}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 5.267723067807247 \cdot 10^{+137}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 3.6281276401897885 \cdot 10^{+257}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 13.0 |
|---|---|
| Target | 2.9 |
| Herbie | 3.1 |
if z < -7.3728945448102116e234 or 5.2677230678072466e137 < z < 3.62812764018978853e257Initial program 13.7
Taylor expanded in y around 0 11.8
if -7.3728945448102116e234 < z < 5.2677230678072466e137 or 3.62812764018978853e257 < z Initial program 12.9
Applied egg-rr2.1
Applied egg-rr1.9
Final simplification3.1
herbie shell --seed 2022133
(FPCore (x y z)
:name "Diagrams.Backend.Cairo.Internal:setTexture from diagrams-cairo-1.3.0.3"
:precision binary64
:herbie-target
(if (< z -2.060202331921739e+104) (- x (/ (* z x) y)) (if (< z 1.6939766013828526e+213) (/ x (/ y (- y z))) (* (- y z) (/ x y))))
(/ (* x (- y z)) y))