?

Average Error: 0.1 → 0.1
Time: 12.8s
Precision: binary64
Cost: 7424

?

\[0 \leq x \land x \leq 10^{+18}\]
\[x \cdot \left(\frac{15}{8} - \left(\sqrt{\frac{3}{8}} \cdot {x}^{2}\right) \cdot \left(\sqrt{\frac{25}{6}} - \sqrt{\frac{3}{8}} \cdot {x}^{2}\right)\right) \]
\[x \cdot 1.875 - \left(x \cdot x\right) \cdot \left({x}^{3} \cdot -0.375 + x \cdot 1.25\right) \]
(FPCore (x)
 :precision binary64
 (*
  x
  (-
   (/ 15.0 8.0)
   (*
    (* (sqrt (/ 3.0 8.0)) (pow x 2.0))
    (- (sqrt (/ 25.0 6.0)) (* (sqrt (/ 3.0 8.0)) (pow x 2.0)))))))
(FPCore (x)
 :precision binary64
 (- (* x 1.875) (* (* x x) (+ (* (pow x 3.0) -0.375) (* x 1.25)))))
double code(double x) {
	return x * ((15.0 / 8.0) - ((sqrt((3.0 / 8.0)) * pow(x, 2.0)) * (sqrt((25.0 / 6.0)) - (sqrt((3.0 / 8.0)) * pow(x, 2.0)))));
}
double code(double x) {
	return (x * 1.875) - ((x * x) * ((pow(x, 3.0) * -0.375) + (x * 1.25)));
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = x * ((15.0d0 / 8.0d0) - ((sqrt((3.0d0 / 8.0d0)) * (x ** 2.0d0)) * (sqrt((25.0d0 / 6.0d0)) - (sqrt((3.0d0 / 8.0d0)) * (x ** 2.0d0)))))
end function
real(8) function code(x)
    real(8), intent (in) :: x
    code = (x * 1.875d0) - ((x * x) * (((x ** 3.0d0) * (-0.375d0)) + (x * 1.25d0)))
end function
public static double code(double x) {
	return x * ((15.0 / 8.0) - ((Math.sqrt((3.0 / 8.0)) * Math.pow(x, 2.0)) * (Math.sqrt((25.0 / 6.0)) - (Math.sqrt((3.0 / 8.0)) * Math.pow(x, 2.0)))));
}
public static double code(double x) {
	return (x * 1.875) - ((x * x) * ((Math.pow(x, 3.0) * -0.375) + (x * 1.25)));
}
def code(x):
	return x * ((15.0 / 8.0) - ((math.sqrt((3.0 / 8.0)) * math.pow(x, 2.0)) * (math.sqrt((25.0 / 6.0)) - (math.sqrt((3.0 / 8.0)) * math.pow(x, 2.0)))))
def code(x):
	return (x * 1.875) - ((x * x) * ((math.pow(x, 3.0) * -0.375) + (x * 1.25)))
function code(x)
	return Float64(x * Float64(Float64(15.0 / 8.0) - Float64(Float64(sqrt(Float64(3.0 / 8.0)) * (x ^ 2.0)) * Float64(sqrt(Float64(25.0 / 6.0)) - Float64(sqrt(Float64(3.0 / 8.0)) * (x ^ 2.0))))))
end
function code(x)
	return Float64(Float64(x * 1.875) - Float64(Float64(x * x) * Float64(Float64((x ^ 3.0) * -0.375) + Float64(x * 1.25))))
end
function tmp = code(x)
	tmp = x * ((15.0 / 8.0) - ((sqrt((3.0 / 8.0)) * (x ^ 2.0)) * (sqrt((25.0 / 6.0)) - (sqrt((3.0 / 8.0)) * (x ^ 2.0)))));
end
function tmp = code(x)
	tmp = (x * 1.875) - ((x * x) * (((x ^ 3.0) * -0.375) + (x * 1.25)));
end
code[x_] := N[(x * N[(N[(15.0 / 8.0), $MachinePrecision] - N[(N[(N[Sqrt[N[(3.0 / 8.0), $MachinePrecision]], $MachinePrecision] * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(25.0 / 6.0), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[N[(3.0 / 8.0), $MachinePrecision]], $MachinePrecision] * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_] := N[(N[(x * 1.875), $MachinePrecision] - N[(N[(x * x), $MachinePrecision] * N[(N[(N[Power[x, 3.0], $MachinePrecision] * -0.375), $MachinePrecision] + N[(x * 1.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x \cdot \left(\frac{15}{8} - \left(\sqrt{\frac{3}{8}} \cdot {x}^{2}\right) \cdot \left(\sqrt{\frac{25}{6}} - \sqrt{\frac{3}{8}} \cdot {x}^{2}\right)\right)
x \cdot 1.875 - \left(x \cdot x\right) \cdot \left({x}^{3} \cdot -0.375 + x \cdot 1.25\right)

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 0.1

    \[x \cdot \left(\frac{15}{8} - \left(\sqrt{\frac{3}{8}} \cdot {x}^{2}\right) \cdot \left(\sqrt{\frac{25}{6}} - \sqrt{\frac{3}{8}} \cdot {x}^{2}\right)\right) \]
  2. Simplified0.1

    \[\leadsto \color{blue}{x \cdot 1.875 - \mathsf{fma}\left(\sqrt{0.375}, \sqrt{4.166666666666667}, \left(x \cdot x\right) \cdot -0.375\right) \cdot {x}^{3}} \]
    Proof

    [Start]0.1

    \[ x \cdot \left(\frac{15}{8} - \left(\sqrt{\frac{3}{8}} \cdot {x}^{2}\right) \cdot \left(\sqrt{\frac{25}{6}} - \sqrt{\frac{3}{8}} \cdot {x}^{2}\right)\right) \]

    distribute-lft-out-- [<=]0.1

    \[ \color{blue}{x \cdot \frac{15}{8} - x \cdot \left(\left(\sqrt{\frac{3}{8}} \cdot {x}^{2}\right) \cdot \left(\sqrt{\frac{25}{6}} - \sqrt{\frac{3}{8}} \cdot {x}^{2}\right)\right)} \]

    metadata-eval [=>]0.1

    \[ x \cdot \color{blue}{1.875} - x \cdot \left(\left(\sqrt{\frac{3}{8}} \cdot {x}^{2}\right) \cdot \left(\sqrt{\frac{25}{6}} - \sqrt{\frac{3}{8}} \cdot {x}^{2}\right)\right) \]

    *-commutative [<=]0.1

    \[ x \cdot 1.875 - \color{blue}{\left(\left(\sqrt{\frac{3}{8}} \cdot {x}^{2}\right) \cdot \left(\sqrt{\frac{25}{6}} - \sqrt{\frac{3}{8}} \cdot {x}^{2}\right)\right) \cdot x} \]

    *-commutative [=>]0.1

    \[ x \cdot 1.875 - \left(\color{blue}{\left({x}^{2} \cdot \sqrt{\frac{3}{8}}\right)} \cdot \left(\sqrt{\frac{25}{6}} - \sqrt{\frac{3}{8}} \cdot {x}^{2}\right)\right) \cdot x \]

    associate-*l* [=>]0.1

    \[ x \cdot 1.875 - \color{blue}{\left({x}^{2} \cdot \left(\sqrt{\frac{3}{8}} \cdot \left(\sqrt{\frac{25}{6}} - \sqrt{\frac{3}{8}} \cdot {x}^{2}\right)\right)\right)} \cdot x \]

    *-commutative [=>]0.1

    \[ x \cdot 1.875 - \color{blue}{\left(\left(\sqrt{\frac{3}{8}} \cdot \left(\sqrt{\frac{25}{6}} - \sqrt{\frac{3}{8}} \cdot {x}^{2}\right)\right) \cdot {x}^{2}\right)} \cdot x \]

    associate-*l* [=>]0.1

    \[ x \cdot 1.875 - \color{blue}{\left(\sqrt{\frac{3}{8}} \cdot \left(\sqrt{\frac{25}{6}} - \sqrt{\frac{3}{8}} \cdot {x}^{2}\right)\right) \cdot \left({x}^{2} \cdot x\right)} \]
  3. Applied egg-rr0.1

    \[\leadsto x \cdot 1.875 - \color{blue}{\left({x}^{3} \cdot \left(\left(x \cdot x\right) \cdot -0.375\right) + {x}^{3} \cdot 1.25\right)} \]
  4. Applied egg-rr0.1

    \[\leadsto x \cdot 1.875 - \color{blue}{\left(x \cdot x\right) \cdot \left({x}^{3} \cdot -0.375 + 1.25 \cdot x\right)} \]
  5. Final simplification0.1

    \[\leadsto x \cdot 1.875 - \left(x \cdot x\right) \cdot \left({x}^{3} \cdot -0.375 + x \cdot 1.25\right) \]

Alternatives

Alternative 1
Error0.1
Cost7360
\[x \cdot 1.875 - \left(x \cdot x\right) \cdot \left(x \cdot \mathsf{fma}\left(x, x \cdot -0.375, 1.25\right)\right) \]
Alternative 2
Error0.1
Cost7296
\[x \cdot 1.875 + {x}^{3} \cdot \left(-1.25 + \left(x \cdot x\right) \cdot 0.375\right) \]
Alternative 3
Error0.1
Cost7296
\[x \cdot 1.875 + {x}^{3} \cdot \left(-1.25 + x \cdot \left(x \cdot 0.375\right)\right) \]
Alternative 4
Error0.1
Cost960
\[x \cdot \left(1.875 + \left(x \cdot x\right) \cdot \left(-1.25 - \left(x \cdot x\right) \cdot -0.375\right)\right) \]
Alternative 5
Error3.9
Cost192
\[x \cdot 1.875 \]

Error

Reproduce?

herbie shell --seed 1 
(FPCore (x)
  :name "x*(15/8-((sqrt(3/8)*x^2)*(sqrt(25/6)-(sqrt(3/8)*x^2))))"
  :precision binary64
  :pre (and (<= 0.0 x) (<= x 1e+18))
  (* x (- (/ 15.0 8.0) (* (* (sqrt (/ 3.0 8.0)) (pow x 2.0)) (- (sqrt (/ 25.0 6.0)) (* (sqrt (/ 3.0 8.0)) (pow x 2.0)))))))