?

Average Accuracy: 41.0% → 100.0%
Time: 3.3s
Precision: binary64
Cost: 12992

?

\[\sqrt{\left(x \cdot x + y \cdot y\right) + z \cdot z} \]
\[\mathsf{hypot}\left(\mathsf{hypot}\left(x, y\right), z\right) \]
(FPCore (x y z) :precision binary64 (sqrt (+ (+ (* x x) (* y y)) (* z z))))
(FPCore (x y z) :precision binary64 (hypot (hypot x y) z))
double code(double x, double y, double z) {
	return sqrt((((x * x) + (y * y)) + (z * z)));
}
double code(double x, double y, double z) {
	return hypot(hypot(x, y), z);
}
public static double code(double x, double y, double z) {
	return Math.sqrt((((x * x) + (y * y)) + (z * z)));
}
public static double code(double x, double y, double z) {
	return Math.hypot(Math.hypot(x, y), z);
}
def code(x, y, z):
	return math.sqrt((((x * x) + (y * y)) + (z * z)))
def code(x, y, z):
	return math.hypot(math.hypot(x, y), z)
function code(x, y, z)
	return sqrt(Float64(Float64(Float64(x * x) + Float64(y * y)) + Float64(z * z)))
end
function code(x, y, z)
	return hypot(hypot(x, y), z)
end
function tmp = code(x, y, z)
	tmp = sqrt((((x * x) + (y * y)) + (z * z)));
end
function tmp = code(x, y, z)
	tmp = hypot(hypot(x, y), z);
end
code[x_, y_, z_] := N[Sqrt[N[(N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(z * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
code[x_, y_, z_] := N[Sqrt[N[Sqrt[x ^ 2 + y ^ 2], $MachinePrecision] ^ 2 + z ^ 2], $MachinePrecision]
\sqrt{\left(x \cdot x + y \cdot y\right) + z \cdot z}
\mathsf{hypot}\left(\mathsf{hypot}\left(x, y\right), z\right)

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original41.0%
Target61.2%
Herbie100.0%
\[\begin{array}{l} \mathbf{if}\;z < -6.396479394109776 \cdot 10^{+136}:\\ \;\;\;\;-z\\ \mathbf{elif}\;z < 7.320293694404182 \cdot 10^{+117}:\\ \;\;\;\;\sqrt{\left(z \cdot z + x \cdot x\right) + y \cdot y}\\ \mathbf{else}:\\ \;\;\;\;z\\ \end{array} \]

Derivation?

  1. Initial program 41.0%

    \[\sqrt{\left(x \cdot x + y \cdot y\right) + z \cdot z} \]
  2. Applied egg-rr100.0%

    \[\leadsto \color{blue}{\mathsf{hypot}\left(\mathsf{hypot}\left(x, y\right), z\right)} \]
    Proof

    [Start]41.0

    \[ \sqrt{\left(x \cdot x + y \cdot y\right) + z \cdot z} \]

    add-sqr-sqrt [=>]41.0

    \[ \sqrt{\color{blue}{\sqrt{x \cdot x + y \cdot y} \cdot \sqrt{x \cdot x + y \cdot y}} + z \cdot z} \]

    hypot-def [=>]56.0

    \[ \color{blue}{\mathsf{hypot}\left(\sqrt{x \cdot x + y \cdot y}, z\right)} \]

    hypot-def [=>]100.0

    \[ \mathsf{hypot}\left(\color{blue}{\mathsf{hypot}\left(x, y\right)}, z\right) \]
  3. Final simplification100.0%

    \[\leadsto \mathsf{hypot}\left(\mathsf{hypot}\left(x, y\right), z\right) \]

Alternatives

Alternative 1
Accuracy35.2%
Cost7368
\[\begin{array}{l} \mathbf{if}\;x \leq -4 \cdot 10^{+127}:\\ \;\;\;\;-x\\ \mathbf{elif}\;x \leq -2.7 \cdot 10^{-93}:\\ \;\;\;\;\sqrt{\left(x \cdot x + y \cdot y\right) + z \cdot z}\\ \mathbf{else}:\\ \;\;\;\;z\\ \end{array} \]
Alternative 2
Accuracy29.8%
Cost260
\[\begin{array}{l} \mathbf{if}\;x \leq -7.5 \cdot 10^{+74}:\\ \;\;\;\;-x\\ \mathbf{else}:\\ \;\;\;\;z\\ \end{array} \]
Alternative 3
Accuracy18.9%
Cost64
\[z \]

Error

Reproduce?

herbie shell --seed 2023138 
(FPCore (x y z)
  :name "FRP.Yampa.Vector3:vector3Rho from Yampa-0.10.2"
  :precision binary64

  :herbie-target
  (if (< z -6.396479394109776e+136) (- z) (if (< z 7.320293694404182e+117) (sqrt (+ (+ (* z z) (* x x)) (* y y))) z))

  (sqrt (+ (+ (* x x) (* y y)) (* z z))))