Average Error: 0.1 → 0.1
Time: 4.6s
Precision: binary64
Cost: 6592
\[\frac{841}{108} \cdot x + \frac{4}{29} \]
\[\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)

Error

Derivation

  1. Initial program 0.1

    \[\frac{841}{108} \cdot x + \frac{4}{29} \]
  2. Simplified0.1

    \[\leadsto \color{blue}{\mathsf{fma}\left(7.787037037037037, x, 0.13793103448275862\right)} \]
    Proof
    (fma.f64 841/108 x 4/29): 0 points increase in error, 0 points decrease in error
    (fma.f64 (Rewrite<= metadata-eval (/.f64 841 108)) x 4/29): 0 points increase in error, 0 points decrease in error
    (fma.f64 (/.f64 841 108) x (Rewrite<= metadata-eval (/.f64 4 29))): 0 points increase in error, 0 points decrease in error
    (Rewrite<= fma-def_binary64 (+.f64 (*.f64 (/.f64 841 108) x) (/.f64 4 29))): 1 points increase in error, 0 points decrease in error
  3. Final simplification0.1

    \[\leadsto \mathsf{fma}\left(7.787037037037037, x, 0.13793103448275862\right) \]

Alternatives

Alternative 1
Error1.6
Cost456
\[\begin{array}{l} \mathbf{if}\;x \leq -0.6582595272765548:\\ \;\;\;\;7.787037037037037 \cdot x\\ \mathbf{elif}\;x \leq 4.332061406564082 \cdot 10^{-17}:\\ \;\;\;\;0.13793103448275862\\ \mathbf{else}:\\ \;\;\;\;7.787037037037037 \cdot x\\ \end{array} \]
Alternative 2
Error0.1
Cost320
\[0.13793103448275862 + 7.787037037037037 \cdot x \]
Alternative 3
Error32.1
Cost64
\[0.13793103448275862 \]

Error

Reproduce

herbie shell --seed 2022295 
(FPCore (x)
  :name "Data.Colour.CIE:cieLABView from colour-2.3.3, A"
  :precision binary64
  (+ (* (/ 841.0 108.0) x) (/ 4.0 29.0)))