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




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 6.3 |
|---|---|
| Target | 6.2 |
| Herbie | 0.9 |
if (*.f64 x y) < -5.1398436446398618e134Initial program 16.2
Applied associate-/l*_binary643.4
Applied associate-/r/_binary643.1
if -5.1398436446398618e134 < (*.f64 x y) < -4.7599396831404991e-100 or 5.63453545950737703e-233 < (*.f64 x y) < 2.5574535907645148e208Initial program 0.2
if -4.7599396831404991e-100 < (*.f64 x y) < 5.63453545950737703e-233 or 2.5574535907645148e208 < (*.f64 x y) Initial program 12.0
Applied associate-/l*_binary641.3
Final simplification0.9
herbie shell --seed 2022131
(FPCore (x y z)
:name "Diagrams.Solve.Tridiagonal:solveCyclicTriDiagonal from diagrams-solve-0.1, A"
:precision binary64
:herbie-target
(if (< z -4.262230790519429e-138) (/ (* x y) z) (if (< z 1.7042130660650472e-164) (/ x (/ z y)) (* (/ x z) y)))
(/ (* x y) z))