| Alternative 1 | |
|---|---|
| Accuracy | 99.9% |
| Cost | 6592 |
\[\mathsf{fma}\left(7.787037037037037, x, 0.13793103448275862\right)
\]

(FPCore (x) :precision binary64 (+ (* (/ 841.0 108.0) x) (/ 4.0 29.0)))
(FPCore (x) :precision binary64 (fma 7.787037037037037 x 0.13793103448275862))
double code(double x) {
return ((841.0 / 108.0) * x) + (4.0 / 29.0);
}
double code(double x) {
return fma(7.787037037037037, x, 0.13793103448275862);
}
function code(x) return Float64(Float64(Float64(841.0 / 108.0) * x) + Float64(4.0 / 29.0)) end
function code(x) return fma(7.787037037037037, x, 0.13793103448275862) end
code[x_] := N[(N[(N[(841.0 / 108.0), $MachinePrecision] * x), $MachinePrecision] + N[(4.0 / 29.0), $MachinePrecision]), $MachinePrecision]
code[x_] := N[(7.787037037037037 * x + 0.13793103448275862), $MachinePrecision]
\frac{841}{108} \cdot x + \frac{4}{29}
\mathsf{fma}\left(7.787037037037037, x, 0.13793103448275862\right)
Herbie found 4 alternatives:
| Alternative | Accuracy | Speedup |
|---|
Initial program 99.9%
Simplified99.9%
[Start]99.9% | \[ \frac{841}{108} \cdot x + \frac{4}{29}
\] |
|---|---|
fma-def [=>]99.9% | \[ \color{blue}{\mathsf{fma}\left(\frac{841}{108}, x, \frac{4}{29}\right)}
\] |
metadata-eval [=>]99.9% | \[ \mathsf{fma}\left(\color{blue}{7.787037037037037}, x, \frac{4}{29}\right)
\] |
metadata-eval [=>]99.9% | \[ \mathsf{fma}\left(7.787037037037037, x, \color{blue}{0.13793103448275862}\right)
\] |
Final simplification99.9%
| Alternative 1 | |
|---|---|
| Accuracy | 99.9% |
| Cost | 6592 |
| Alternative 2 | |
|---|---|
| Accuracy | 97.6% |
| Cost | 456 |
| Alternative 3 | |
|---|---|
| Accuracy | 99.9% |
| Cost | 320 |
| Alternative 4 | |
|---|---|
| Accuracy | 49.4% |
| Cost | 64 |
herbie shell --seed 2023263
(FPCore (x)
:name "Data.Colour.CIE:cieLABView from colour-2.3.3, A"
:precision binary64
(+ (* (/ 841.0 108.0) x) (/ 4.0 29.0)))