(FPCore (x y z) :precision binary64 (/ (* x y) z))
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (* x y) z)) (t_1 (/ (/ x z) (/ 1.0 y))))
(if (<= t_0 (- INFINITY))
(* x (* y (pow z -1.0)))
(if (<= t_0 -8.65e-322)
t_0
(if (<= t_0 0.0) t_1 (if (<= t_0 6.967586597423559e+277) t_0 t_1))))))double code(double x, double y, double z) {
return (x * y) / z;
}
double code(double x, double y, double z) {
double t_0 = (x * y) / z;
double t_1 = (x / z) / (1.0 / y);
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = x * (y * pow(z, -1.0));
} else if (t_0 <= -8.65e-322) {
tmp = t_0;
} else if (t_0 <= 0.0) {
tmp = t_1;
} else if (t_0 <= 6.967586597423559e+277) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
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 * y) / z;
double t_1 = (x / z) / (1.0 / y);
double tmp;
if (t_0 <= -Double.POSITIVE_INFINITY) {
tmp = x * (y * Math.pow(z, -1.0));
} else if (t_0 <= -8.65e-322) {
tmp = t_0;
} else if (t_0 <= 0.0) {
tmp = t_1;
} else if (t_0 <= 6.967586597423559e+277) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): return (x * y) / z
def code(x, y, z): t_0 = (x * y) / z t_1 = (x / z) / (1.0 / y) tmp = 0 if t_0 <= -math.inf: tmp = x * (y * math.pow(z, -1.0)) elif t_0 <= -8.65e-322: tmp = t_0 elif t_0 <= 0.0: tmp = t_1 elif t_0 <= 6.967586597423559e+277: tmp = t_0 else: tmp = t_1 return tmp
function code(x, y, z) return Float64(Float64(x * y) / z) end
function code(x, y, z) t_0 = Float64(Float64(x * y) / z) t_1 = Float64(Float64(x / z) / Float64(1.0 / y)) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(x * Float64(y * (z ^ -1.0))); elseif (t_0 <= -8.65e-322) tmp = t_0; elseif (t_0 <= 0.0) tmp = t_1; elseif (t_0 <= 6.967586597423559e+277) tmp = t_0; else tmp = t_1; 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 * y) / z; t_1 = (x / z) / (1.0 / y); tmp = 0.0; if (t_0 <= -Inf) tmp = x * (y * (z ^ -1.0)); elseif (t_0 <= -8.65e-322) tmp = t_0; elseif (t_0 <= 0.0) tmp = t_1; elseif (t_0 <= 6.967586597423559e+277) tmp = t_0; else tmp = t_1; 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[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x / z), $MachinePrecision] / N[(1.0 / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(x * N[(y * N[Power[z, -1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -8.65e-322], t$95$0, If[LessEqual[t$95$0, 0.0], t$95$1, If[LessEqual[t$95$0, 6.967586597423559e+277], t$95$0, t$95$1]]]]]]
\frac{x \cdot y}{z}
\begin{array}{l}
t_0 := \frac{x \cdot y}{z}\\
t_1 := \frac{\frac{x}{z}}{\frac{1}{y}}\\
\mathbf{if}\;t_0 \leq -\infty:\\
\;\;\;\;x \cdot \left(y \cdot {z}^{-1}\right)\\
\mathbf{elif}\;t_0 \leq -8.65 \cdot 10^{-322}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;t_0 \leq 0:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_0 \leq 6.967586597423559 \cdot 10^{+277}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 6.0 |
|---|---|
| Target | 6.2 |
| Herbie | 0.5 |
if (/.f64 (*.f64 x y) z) < -inf.0Initial program 64.0
Simplified0.3
Applied egg-rr1.3
Applied egg-rr0.3
Applied egg-rr0.3
if -inf.0 < (/.f64 (*.f64 x y) z) < -8.64615e-322 or -0.0 < (/.f64 (*.f64 x y) z) < 6.9675865974235591e277Initial program 0.5
if -8.64615e-322 < (/.f64 (*.f64 x y) z) < -0.0 or 6.9675865974235591e277 < (/.f64 (*.f64 x y) z) Initial program 15.7
Simplified1.4
Applied egg-rr1.6
Applied egg-rr0.7
Final simplification0.5
herbie shell --seed 2022150
(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))