(FPCore (x y z t) :precision binary64 (* x (/ (* (/ y z) t) t)))
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ x (/ z y))) (t_2 (* y (/ x z))))
(if (<= (/ y z) -4.793136556035763e+249)
t_2
(if (<= (/ y z) -7.851769693067612e-293)
t_1
(if (<= (/ y z) 3.176090190266049e-124)
t_2
(if (<= (/ y z) 4.2418494777197253e+219)
t_1
(* (/ 1.0 z) (* y x))))))))double code(double x, double y, double z, double t) {
return x * (((y / z) * t) / t);
}
double code(double x, double y, double z, double t) {
double t_1 = x / (z / y);
double t_2 = y * (x / z);
double tmp;
if ((y / z) <= -4.793136556035763e+249) {
tmp = t_2;
} else if ((y / z) <= -7.851769693067612e-293) {
tmp = t_1;
} else if ((y / z) <= 3.176090190266049e-124) {
tmp = t_2;
} else if ((y / z) <= 4.2418494777197253e+219) {
tmp = t_1;
} else {
tmp = (1.0 / z) * (y * x);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x * (((y / z) * t) / t)
end function
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = x / (z / y)
t_2 = y * (x / z)
if ((y / z) <= (-4.793136556035763d+249)) then
tmp = t_2
else if ((y / z) <= (-7.851769693067612d-293)) then
tmp = t_1
else if ((y / z) <= 3.176090190266049d-124) then
tmp = t_2
else if ((y / z) <= 4.2418494777197253d+219) then
tmp = t_1
else
tmp = (1.0d0 / z) * (y * x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
return x * (((y / z) * t) / t);
}
public static double code(double x, double y, double z, double t) {
double t_1 = x / (z / y);
double t_2 = y * (x / z);
double tmp;
if ((y / z) <= -4.793136556035763e+249) {
tmp = t_2;
} else if ((y / z) <= -7.851769693067612e-293) {
tmp = t_1;
} else if ((y / z) <= 3.176090190266049e-124) {
tmp = t_2;
} else if ((y / z) <= 4.2418494777197253e+219) {
tmp = t_1;
} else {
tmp = (1.0 / z) * (y * x);
}
return tmp;
}
def code(x, y, z, t): return x * (((y / z) * t) / t)
def code(x, y, z, t): t_1 = x / (z / y) t_2 = y * (x / z) tmp = 0 if (y / z) <= -4.793136556035763e+249: tmp = t_2 elif (y / z) <= -7.851769693067612e-293: tmp = t_1 elif (y / z) <= 3.176090190266049e-124: tmp = t_2 elif (y / z) <= 4.2418494777197253e+219: tmp = t_1 else: tmp = (1.0 / z) * (y * x) return tmp
function code(x, y, z, t) return Float64(x * Float64(Float64(Float64(y / z) * t) / t)) end
function code(x, y, z, t) t_1 = Float64(x / Float64(z / y)) t_2 = Float64(y * Float64(x / z)) tmp = 0.0 if (Float64(y / z) <= -4.793136556035763e+249) tmp = t_2; elseif (Float64(y / z) <= -7.851769693067612e-293) tmp = t_1; elseif (Float64(y / z) <= 3.176090190266049e-124) tmp = t_2; elseif (Float64(y / z) <= 4.2418494777197253e+219) tmp = t_1; else tmp = Float64(Float64(1.0 / z) * Float64(y * x)); end return tmp end
function tmp = code(x, y, z, t) tmp = x * (((y / z) * t) / t); end
function tmp_2 = code(x, y, z, t) t_1 = x / (z / y); t_2 = y * (x / z); tmp = 0.0; if ((y / z) <= -4.793136556035763e+249) tmp = t_2; elseif ((y / z) <= -7.851769693067612e-293) tmp = t_1; elseif ((y / z) <= 3.176090190266049e-124) tmp = t_2; elseif ((y / z) <= 4.2418494777197253e+219) tmp = t_1; else tmp = (1.0 / z) * (y * x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := N[(x * N[(N[(N[(y / z), $MachinePrecision] * t), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(y / z), $MachinePrecision], -4.793136556035763e+249], t$95$2, If[LessEqual[N[(y / z), $MachinePrecision], -7.851769693067612e-293], t$95$1, If[LessEqual[N[(y / z), $MachinePrecision], 3.176090190266049e-124], t$95$2, If[LessEqual[N[(y / z), $MachinePrecision], 4.2418494777197253e+219], t$95$1, N[(N[(1.0 / z), $MachinePrecision] * N[(y * x), $MachinePrecision]), $MachinePrecision]]]]]]]
x \cdot \frac{\frac{y}{z} \cdot t}{t}
\begin{array}{l}
t_1 := \frac{x}{\frac{z}{y}}\\
t_2 := y \cdot \frac{x}{z}\\
\mathbf{if}\;\frac{y}{z} \leq -4.793136556035763 \cdot 10^{+249}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{y}{z} \leq -7.851769693067612 \cdot 10^{-293}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{y}{z} \leq 3.176090190266049 \cdot 10^{-124}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{y}{z} \leq 4.2418494777197253 \cdot 10^{+219}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{z} \cdot \left(y \cdot x\right)\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 14.8 |
|---|---|
| Target | 1.4 |
| Herbie | 0.5 |
if (/.f64 y z) < -4.7931365560357632e249 or -7.8517696930676123e-293 < (/.f64 y z) < 3.17609019026604883e-124Initial program 20.8
Simplified14.2
Applied egg-rr14.8
Applied egg-rr0.8
if -4.7931365560357632e249 < (/.f64 y z) < -7.8517696930676123e-293 or 3.17609019026604883e-124 < (/.f64 y z) < 4.2418494777197253e219Initial program 9.4
Simplified0.2
Applied egg-rr0.2
if 4.2418494777197253e219 < (/.f64 y z) Initial program 42.8
Simplified28.4
Applied egg-rr25.6
Applied egg-rr1.1
Applied egg-rr1.0
Final simplification0.5
herbie shell --seed 2022133
(FPCore (x y z t)
:name "Graphics.Rendering.Chart.Backend.Diagrams:calcFontMetrics from Chart-diagrams-1.5.1, B"
:precision binary64
:herbie-target
(if (< (/ (* (/ y z) t) t) -1.20672205123045e+245) (/ y (/ z x)) (if (< (/ (* (/ y z) t) t) -5.907522236933906e-275) (* x (/ y z)) (if (< (/ (* (/ y z) t) t) 5.658954423153415e-65) (/ y (/ z x)) (if (< (/ (* (/ y z) t) t) 2.0087180502407133e+217) (* x (/ y z)) (/ (* y x) z)))))
(* x (/ (* (/ y z) t) t)))