Average Error: 30.5 → 0.4
Time: 1.8s
Precision: binary64
\[\sqrt{2 \cdot \left(x \cdot x\right)} \]
\[\left|{2}^{0.25} \cdot \left(x \cdot {2}^{0.25}\right)\right| \]
(FPCore (x) :precision binary64 (sqrt (* 2.0 (* x x))))
(FPCore (x) :precision binary64 (fabs (* (pow 2.0 0.25) (* x (pow 2.0 0.25)))))
double code(double x) {
	return sqrt((2.0 * (x * x)));
}
double code(double x) {
	return fabs((pow(2.0, 0.25) * (x * pow(2.0, 0.25))));
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = sqrt((2.0d0 * (x * x)))
end function
real(8) function code(x)
    real(8), intent (in) :: x
    code = abs(((2.0d0 ** 0.25d0) * (x * (2.0d0 ** 0.25d0))))
end function
public static double code(double x) {
	return Math.sqrt((2.0 * (x * x)));
}
public static double code(double x) {
	return Math.abs((Math.pow(2.0, 0.25) * (x * Math.pow(2.0, 0.25))));
}
def code(x):
	return math.sqrt((2.0 * (x * x)))
def code(x):
	return math.fabs((math.pow(2.0, 0.25) * (x * math.pow(2.0, 0.25))))
function code(x)
	return sqrt(Float64(2.0 * Float64(x * x)))
end
function code(x)
	return abs(Float64((2.0 ^ 0.25) * Float64(x * (2.0 ^ 0.25))))
end
function tmp = code(x)
	tmp = sqrt((2.0 * (x * x)));
end
function tmp = code(x)
	tmp = abs(((2.0 ^ 0.25) * (x * (2.0 ^ 0.25))));
end
code[x_] := N[Sqrt[N[(2.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
code[x_] := N[Abs[N[(N[Power[2.0, 0.25], $MachinePrecision] * N[(x * N[Power[2.0, 0.25], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\sqrt{2 \cdot \left(x \cdot x\right)}
\left|{2}^{0.25} \cdot \left(x \cdot {2}^{0.25}\right)\right|

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 30.5

    \[\sqrt{2 \cdot \left(x \cdot x\right)} \]
  2. Applied egg-rr0.4

    \[\leadsto \color{blue}{\left|x \cdot \sqrt{2}\right|} \]
  3. Applied egg-rr1.4

    \[\leadsto \left|\color{blue}{{\left(\sqrt[3]{x \cdot \sqrt{2}}\right)}^{3}}\right| \]
  4. Applied egg-rr0.4

    \[\leadsto \left|\color{blue}{\left(x \cdot {2}^{0.25}\right) \cdot {2}^{0.25}}\right| \]
  5. Final simplification0.4

    \[\leadsto \left|{2}^{0.25} \cdot \left(x \cdot {2}^{0.25}\right)\right| \]

Reproduce

herbie shell --seed 2022210 
(FPCore (x)
  :name "sqrt C"
  :precision binary64
  (sqrt (* 2.0 (* x x))))