| Alternative 1 | |
|---|---|
| Accuracy | 99.7% |
| Cost | 448 |
\[\left(x \cdot 3 + -0.41379310344827586\right) \cdot y
\]

(FPCore (x y) :precision binary64 (* (* (- x (/ 16.0 116.0)) 3.0) y))
(FPCore (x y) :precision binary64 (* (+ (* x 3.0) -0.41379310344827586) y))
double code(double x, double y) {
return ((x - (16.0 / 116.0)) * 3.0) * y;
}
double code(double x, double y) {
return ((x * 3.0) + -0.41379310344827586) * y;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x - (16.0d0 / 116.0d0)) * 3.0d0) * y
end function
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x * 3.0d0) + (-0.41379310344827586d0)) * y
end function
public static double code(double x, double y) {
return ((x - (16.0 / 116.0)) * 3.0) * y;
}
public static double code(double x, double y) {
return ((x * 3.0) + -0.41379310344827586) * y;
}
def code(x, y): return ((x - (16.0 / 116.0)) * 3.0) * y
def code(x, y): return ((x * 3.0) + -0.41379310344827586) * y
function code(x, y) return Float64(Float64(Float64(x - Float64(16.0 / 116.0)) * 3.0) * y) end
function code(x, y) return Float64(Float64(Float64(x * 3.0) + -0.41379310344827586) * y) end
function tmp = code(x, y) tmp = ((x - (16.0 / 116.0)) * 3.0) * y; end
function tmp = code(x, y) tmp = ((x * 3.0) + -0.41379310344827586) * y; end
code[x_, y_] := N[(N[(N[(x - N[(16.0 / 116.0), $MachinePrecision]), $MachinePrecision] * 3.0), $MachinePrecision] * y), $MachinePrecision]
code[x_, y_] := N[(N[(N[(x * 3.0), $MachinePrecision] + -0.41379310344827586), $MachinePrecision] * y), $MachinePrecision]
\left(\left(x - \frac{16}{116}\right) \cdot 3\right) \cdot y
\left(x \cdot 3 + -0.41379310344827586\right) \cdot y
Herbie found 5 alternatives:
| Alternative | Accuracy | Speedup |
|---|
Results
| Original | 99.7% |
|---|---|
| Target | 99.7% |
| Herbie | 99.7% |
Initial program 99.8%
Simplified99.8%
[Start]99.8% | \[ \left(\left(x - \frac{16}{116}\right) \cdot 3\right) \cdot y
\] |
|---|---|
*-commutative [=>]99.8% | \[ \color{blue}{\left(3 \cdot \left(x - \frac{16}{116}\right)\right)} \cdot y
\] |
sub-neg [=>]99.8% | \[ \left(3 \cdot \color{blue}{\left(x + \left(-\frac{16}{116}\right)\right)}\right) \cdot y
\] |
distribute-rgt-in [=>]99.8% | \[ \color{blue}{\left(x \cdot 3 + \left(-\frac{16}{116}\right) \cdot 3\right)} \cdot y
\] |
metadata-eval [=>]99.8% | \[ \left(x \cdot 3 + \left(-\color{blue}{0.13793103448275862}\right) \cdot 3\right) \cdot y
\] |
metadata-eval [=>]99.8% | \[ \left(x \cdot 3 + \color{blue}{-0.13793103448275862} \cdot 3\right) \cdot y
\] |
metadata-eval [=>]99.8% | \[ \left(x \cdot 3 + \color{blue}{-0.41379310344827586}\right) \cdot y
\] |
Final simplification99.8%
| Alternative 1 | |
|---|---|
| Accuracy | 99.7% |
| Cost | 448 |
| Alternative 2 | |
|---|---|
| Accuracy | 97.6% |
| Cost | 585 |
| Alternative 3 | |
|---|---|
| Accuracy | 99.6% |
| Cost | 448 |
| Alternative 4 | |
|---|---|
| Accuracy | 99.6% |
| Cost | 448 |
| Alternative 5 | |
|---|---|
| Accuracy | 50.2% |
| Cost | 192 |
herbie shell --seed 2023263
(FPCore (x y)
:name "Data.Colour.CIE:cieLAB from colour-2.3.3, A"
:precision binary64
:herbie-target
(* y (- (* x 3.0) 0.41379310344827586))
(* (* (- x (/ 16.0 116.0)) 3.0) y))