Average Error: 0.1 → 0.1
Time: 4.9s
Precision: binary64
Cost: 320
\[\frac{841}{108} \cdot x + \frac{4}{29} \]
\[7.787037037037037 \cdot x + 0.13793103448275862 \]
(FPCore (x) :precision binary64 (+ (* (/ 841.0 108.0) x) (/ 4.0 29.0)))
(FPCore (x)
 :precision binary64
 (+ (* 7.787037037037037 x) 0.13793103448275862))
double code(double x) {
	return ((841.0 / 108.0) * x) + (4.0 / 29.0);
}
double code(double x) {
	return (7.787037037037037 * x) + 0.13793103448275862;
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = ((841.0d0 / 108.0d0) * x) + (4.0d0 / 29.0d0)
end function
real(8) function code(x)
    real(8), intent (in) :: x
    code = (7.787037037037037d0 * x) + 0.13793103448275862d0
end function
public static double code(double x) {
	return ((841.0 / 108.0) * x) + (4.0 / 29.0);
}
public static double code(double x) {
	return (7.787037037037037 * x) + 0.13793103448275862;
}
def code(x):
	return ((841.0 / 108.0) * x) + (4.0 / 29.0)
def code(x):
	return (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 Float64(Float64(7.787037037037037 * x) + 0.13793103448275862)
end
function tmp = code(x)
	tmp = ((841.0 / 108.0) * x) + (4.0 / 29.0);
end
function tmp = code(x)
	tmp = (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[(N[(7.787037037037037 * x), $MachinePrecision] + 0.13793103448275862), $MachinePrecision]
\frac{841}{108} \cdot x + \frac{4}{29}
7.787037037037037 \cdot x + 0.13793103448275862

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

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))): 2 points increase in error, 2 points decrease in error
  3. Applied egg-rr0.1

    \[\leadsto \color{blue}{7.787037037037037 \cdot x + 0.13793103448275862} \]
  4. Final simplification0.1

    \[\leadsto 7.787037037037037 \cdot x + 0.13793103448275862 \]

Alternatives

Alternative 1
Error1.5
Cost456
\[\begin{array}{l} \mathbf{if}\;x \leq -0.050911373029014544:\\ \;\;\;\;\frac{x}{0.12841854934601665}\\ \mathbf{elif}\;x \leq 9.346374982514411 \cdot 10^{-7}:\\ \;\;\;\;0.13793103448275862\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{0.12841854934601665}\\ \end{array} \]
Alternative 2
Error1.4
Cost456
\[\begin{array}{l} \mathbf{if}\;x \leq -0.050911373029014544:\\ \;\;\;\;7.787037037037037 \cdot x\\ \mathbf{elif}\;x \leq 9.346374982514411 \cdot 10^{-7}:\\ \;\;\;\;0.13793103448275862\\ \mathbf{else}:\\ \;\;\;\;7.787037037037037 \cdot x\\ \end{array} \]
Alternative 3
Error31.4
Cost64
\[0.13793103448275862 \]

Error

Reproduce

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