| Alternative 1 | |
|---|---|
| Accuracy | 69.4% |
| Cost | 6857 |
\[\begin{array}{l}
\mathbf{if}\;x \leq -4.8 \cdot 10^{+89} \lor \neg \left(x \leq 1.9 \cdot 10^{-131}\right):\\
\;\;\;\;\left|\frac{x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\]
(FPCore (x y) :precision binary64 (/ (fabs (- x y)) (fabs y)))
(FPCore (x y) :precision binary64 (fabs (/ (- y x) y)))
double code(double x, double y) {
return fabs((x - y)) / fabs(y);
}
double code(double x, double y) {
return fabs(((y - x) / y));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = abs((x - y)) / abs(y)
end function
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = abs(((y - x) / y))
end function
public static double code(double x, double y) {
return Math.abs((x - y)) / Math.abs(y);
}
public static double code(double x, double y) {
return Math.abs(((y - x) / y));
}
def code(x, y): return math.fabs((x - y)) / math.fabs(y)
def code(x, y): return math.fabs(((y - x) / y))
function code(x, y) return Float64(abs(Float64(x - y)) / abs(y)) end
function code(x, y) return abs(Float64(Float64(y - x) / y)) end
function tmp = code(x, y) tmp = abs((x - y)) / abs(y); end
function tmp = code(x, y) tmp = abs(((y - x) / y)); end
code[x_, y_] := N[(N[Abs[N[(x - y), $MachinePrecision]], $MachinePrecision] / N[Abs[y], $MachinePrecision]), $MachinePrecision]
code[x_, y_] := N[Abs[N[(N[(y - x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]
\frac{\left|x - y\right|}{\left|y\right|}
\left|\frac{y - x}{y}\right|
Results
Initial program 100.0%
Taylor expanded in x around -inf 100.0%
Simplified100.0%
[Start]100.0 | \[ \frac{\left|-\left(y + -1 \cdot x\right)\right|}{\left|y\right|}
\] |
|---|---|
mul-1-neg [=>]100.0 | \[ \frac{\left|-\left(y + \color{blue}{\left(-x\right)}\right)\right|}{\left|y\right|}
\] |
sub-neg [<=]100.0 | \[ \frac{\left|-\color{blue}{\left(y - x\right)}\right|}{\left|y\right|}
\] |
fabs-neg [=>]100.0 | \[ \frac{\color{blue}{\left|y - x\right|}}{\left|y\right|}
\] |
fabs-div [<=]100.0 | \[ \color{blue}{\left|\frac{y - x}{y}\right|}
\] |
Final simplification100.0%
| Alternative 1 | |
|---|---|
| Accuracy | 69.4% |
| Cost | 6857 |
| Alternative 2 | |
|---|---|
| Accuracy | 60.3% |
| Cost | 841 |
| Alternative 3 | |
|---|---|
| Accuracy | 60.8% |
| Cost | 840 |
| Alternative 4 | |
|---|---|
| Accuracy | 60.7% |
| Cost | 585 |
| Alternative 5 | |
|---|---|
| Accuracy | 23.5% |
| Cost | 192 |
| Alternative 6 | |
|---|---|
| Accuracy | 1.4% |
| Cost | 64 |
herbie shell --seed 2023133
(FPCore (x y)
:name "Numeric.LinearAlgebra.Util:formatSparse from hmatrix-0.16.1.5"
:precision binary64
(/ (fabs (- x y)) (fabs y)))