?

Average Accuracy: 78.6% → 98.0%
Time: 15.3s
Precision: binary64
Cost: 27076

?

\[10^{-150} < \left|x\right| \land \left|x\right| < 10^{+150}\]
\[\sqrt{0.5 \cdot \left(1 + \frac{x}{\sqrt{\left(4 \cdot p\right) \cdot p + x \cdot x}}\right)} \]
\[\begin{array}{l} \mathbf{if}\;\frac{x}{\sqrt{p \cdot \left(4 \cdot p\right) + x \cdot x}} \leq -0.9999999998:\\ \;\;\;\;\left|\frac{1.5}{\frac{{x}^{3}}{{p}^{3}}} - \frac{p}{x}\right|\\ \mathbf{else}:\\ \;\;\;\;\sqrt{0.5 \cdot \left(1 + \frac{x}{\mathsf{hypot}\left(p \cdot 2, x\right)}\right)}\\ \end{array} \]
(FPCore (p x)
 :precision binary64
 (sqrt (* 0.5 (+ 1.0 (/ x (sqrt (+ (* (* 4.0 p) p) (* x x))))))))
(FPCore (p x)
 :precision binary64
 (if (<= (/ x (sqrt (+ (* p (* 4.0 p)) (* x x)))) -0.9999999998)
   (fabs (- (/ 1.5 (/ (pow x 3.0) (pow p 3.0))) (/ p x)))
   (sqrt (* 0.5 (+ 1.0 (/ x (hypot (* p 2.0) x)))))))
double code(double p, double x) {
	return sqrt((0.5 * (1.0 + (x / sqrt((((4.0 * p) * p) + (x * x)))))));
}
double code(double p, double x) {
	double tmp;
	if ((x / sqrt(((p * (4.0 * p)) + (x * x)))) <= -0.9999999998) {
		tmp = fabs(((1.5 / (pow(x, 3.0) / pow(p, 3.0))) - (p / x)));
	} else {
		tmp = sqrt((0.5 * (1.0 + (x / hypot((p * 2.0), x)))));
	}
	return tmp;
}
public static double code(double p, double x) {
	return Math.sqrt((0.5 * (1.0 + (x / Math.sqrt((((4.0 * p) * p) + (x * x)))))));
}
public static double code(double p, double x) {
	double tmp;
	if ((x / Math.sqrt(((p * (4.0 * p)) + (x * x)))) <= -0.9999999998) {
		tmp = Math.abs(((1.5 / (Math.pow(x, 3.0) / Math.pow(p, 3.0))) - (p / x)));
	} else {
		tmp = Math.sqrt((0.5 * (1.0 + (x / Math.hypot((p * 2.0), x)))));
	}
	return tmp;
}
def code(p, x):
	return math.sqrt((0.5 * (1.0 + (x / math.sqrt((((4.0 * p) * p) + (x * x)))))))
def code(p, x):
	tmp = 0
	if (x / math.sqrt(((p * (4.0 * p)) + (x * x)))) <= -0.9999999998:
		tmp = math.fabs(((1.5 / (math.pow(x, 3.0) / math.pow(p, 3.0))) - (p / x)))
	else:
		tmp = math.sqrt((0.5 * (1.0 + (x / math.hypot((p * 2.0), x)))))
	return tmp
function code(p, x)
	return sqrt(Float64(0.5 * Float64(1.0 + Float64(x / sqrt(Float64(Float64(Float64(4.0 * p) * p) + Float64(x * x)))))))
end
function code(p, x)
	tmp = 0.0
	if (Float64(x / sqrt(Float64(Float64(p * Float64(4.0 * p)) + Float64(x * x)))) <= -0.9999999998)
		tmp = abs(Float64(Float64(1.5 / Float64((x ^ 3.0) / (p ^ 3.0))) - Float64(p / x)));
	else
		tmp = sqrt(Float64(0.5 * Float64(1.0 + Float64(x / hypot(Float64(p * 2.0), x)))));
	end
	return tmp
end
function tmp = code(p, x)
	tmp = sqrt((0.5 * (1.0 + (x / sqrt((((4.0 * p) * p) + (x * x)))))));
end
function tmp_2 = code(p, x)
	tmp = 0.0;
	if ((x / sqrt(((p * (4.0 * p)) + (x * x)))) <= -0.9999999998)
		tmp = abs(((1.5 / ((x ^ 3.0) / (p ^ 3.0))) - (p / x)));
	else
		tmp = sqrt((0.5 * (1.0 + (x / hypot((p * 2.0), x)))));
	end
	tmp_2 = tmp;
end
code[p_, x_] := N[Sqrt[N[(0.5 * N[(1.0 + N[(x / N[Sqrt[N[(N[(N[(4.0 * p), $MachinePrecision] * p), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
code[p_, x_] := If[LessEqual[N[(x / N[Sqrt[N[(N[(p * N[(4.0 * p), $MachinePrecision]), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -0.9999999998], N[Abs[N[(N[(1.5 / N[(N[Power[x, 3.0], $MachinePrecision] / N[Power[p, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(p / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Sqrt[N[(0.5 * N[(1.0 + N[(x / N[Sqrt[N[(p * 2.0), $MachinePrecision] ^ 2 + x ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\sqrt{0.5 \cdot \left(1 + \frac{x}{\sqrt{\left(4 \cdot p\right) \cdot p + x \cdot x}}\right)}
\begin{array}{l}
\mathbf{if}\;\frac{x}{\sqrt{p \cdot \left(4 \cdot p\right) + x \cdot x}} \leq -0.9999999998:\\
\;\;\;\;\left|\frac{1.5}{\frac{{x}^{3}}{{p}^{3}}} - \frac{p}{x}\right|\\

\mathbf{else}:\\
\;\;\;\;\sqrt{0.5 \cdot \left(1 + \frac{x}{\mathsf{hypot}\left(p \cdot 2, x\right)}\right)}\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original78.6%
Target78.6%
Herbie98.0%
\[\sqrt{0.5 + \frac{\mathsf{copysign}\left(0.5, x\right)}{\mathsf{hypot}\left(1, \frac{2 \cdot p}{x}\right)}} \]

Derivation?

  1. Split input into 2 regimes
  2. if (/.f64 x (sqrt.f64 (+.f64 (*.f64 (*.f64 4 p) p) (*.f64 x x)))) < -0.9999999998

    1. Initial program 15.7%

      \[\sqrt{0.5 \cdot \left(1 + \frac{x}{\sqrt{\left(4 \cdot p\right) \cdot p + x \cdot x}}\right)} \]
    2. Applied egg-rr15.7%

      \[\leadsto \sqrt{0.5 \cdot \left(1 + \frac{x}{\color{blue}{\mathsf{hypot}\left(2 \cdot p, x\right)}}\right)} \]
      Proof

      [Start]15.7

      \[ \sqrt{0.5 \cdot \left(1 + \frac{x}{\sqrt{\left(4 \cdot p\right) \cdot p + x \cdot x}}\right)} \]

      add-sqr-sqrt [=>]15.7

      \[ \sqrt{0.5 \cdot \left(1 + \frac{x}{\sqrt{\color{blue}{\sqrt{\left(4 \cdot p\right) \cdot p} \cdot \sqrt{\left(4 \cdot p\right) \cdot p}} + x \cdot x}}\right)} \]

      hypot-def [=>]15.7

      \[ \sqrt{0.5 \cdot \left(1 + \frac{x}{\color{blue}{\mathsf{hypot}\left(\sqrt{\left(4 \cdot p\right) \cdot p}, x\right)}}\right)} \]

      associate-*l* [=>]15.7

      \[ \sqrt{0.5 \cdot \left(1 + \frac{x}{\mathsf{hypot}\left(\sqrt{\color{blue}{4 \cdot \left(p \cdot p\right)}}, x\right)}\right)} \]

      sqrt-prod [=>]15.7

      \[ \sqrt{0.5 \cdot \left(1 + \frac{x}{\mathsf{hypot}\left(\color{blue}{\sqrt{4} \cdot \sqrt{p \cdot p}}, x\right)}\right)} \]

      metadata-eval [=>]15.7

      \[ \sqrt{0.5 \cdot \left(1 + \frac{x}{\mathsf{hypot}\left(\color{blue}{2} \cdot \sqrt{p \cdot p}, x\right)}\right)} \]

      sqrt-unprod [<=]8.3

      \[ \sqrt{0.5 \cdot \left(1 + \frac{x}{\mathsf{hypot}\left(2 \cdot \color{blue}{\left(\sqrt{p} \cdot \sqrt{p}\right)}, x\right)}\right)} \]

      add-sqr-sqrt [<=]15.7

      \[ \sqrt{0.5 \cdot \left(1 + \frac{x}{\mathsf{hypot}\left(2 \cdot \color{blue}{p}, x\right)}\right)} \]
    3. Applied egg-rr13.8%

      \[\leadsto \color{blue}{{\left({\left(0.5 + x \cdot \frac{0.5}{\mathsf{hypot}\left(2 \cdot p, x\right)}\right)}^{1.5}\right)}^{0.3333333333333333}} \]
      Proof

      [Start]15.7

      \[ \sqrt{0.5 \cdot \left(1 + \frac{x}{\mathsf{hypot}\left(2 \cdot p, x\right)}\right)} \]

      add-cbrt-cube [=>]15.7

      \[ \color{blue}{\sqrt[3]{\left(\sqrt{0.5 \cdot \left(1 + \frac{x}{\mathsf{hypot}\left(2 \cdot p, x\right)}\right)} \cdot \sqrt{0.5 \cdot \left(1 + \frac{x}{\mathsf{hypot}\left(2 \cdot p, x\right)}\right)}\right) \cdot \sqrt{0.5 \cdot \left(1 + \frac{x}{\mathsf{hypot}\left(2 \cdot p, x\right)}\right)}}} \]

      pow1/3 [=>]15.7

      \[ \color{blue}{{\left(\left(\sqrt{0.5 \cdot \left(1 + \frac{x}{\mathsf{hypot}\left(2 \cdot p, x\right)}\right)} \cdot \sqrt{0.5 \cdot \left(1 + \frac{x}{\mathsf{hypot}\left(2 \cdot p, x\right)}\right)}\right) \cdot \sqrt{0.5 \cdot \left(1 + \frac{x}{\mathsf{hypot}\left(2 \cdot p, x\right)}\right)}\right)}^{0.3333333333333333}} \]
    4. Simplified13.8%

      \[\leadsto \color{blue}{\sqrt[3]{{\left(0.5 + x \cdot \frac{0.5}{\mathsf{hypot}\left(p \cdot 2, x\right)}\right)}^{1.5}}} \]
      Proof

      [Start]13.8

      \[ {\left({\left(0.5 + x \cdot \frac{0.5}{\mathsf{hypot}\left(2 \cdot p, x\right)}\right)}^{1.5}\right)}^{0.3333333333333333} \]

      unpow1/3 [=>]13.8

      \[ \color{blue}{\sqrt[3]{{\left(0.5 + x \cdot \frac{0.5}{\mathsf{hypot}\left(2 \cdot p, x\right)}\right)}^{1.5}}} \]

      *-commutative [=>]13.8

      \[ \sqrt[3]{{\left(0.5 + x \cdot \frac{0.5}{\mathsf{hypot}\left(\color{blue}{p \cdot 2}, x\right)}\right)}^{1.5}} \]
    5. Taylor expanded in x around -inf 42.5%

      \[\leadsto \color{blue}{-1 \cdot \frac{p}{x} + -0.25 \cdot \frac{-2 \cdot {p}^{4} + -4 \cdot {p}^{4}}{p \cdot {x}^{3}}} \]
    6. Simplified52.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-1, \frac{p}{x}, -0.25 \cdot \frac{\frac{{p}^{4} \cdot -6}{p}}{{x}^{3}}\right)} \]
      Proof

      [Start]42.5

      \[ -1 \cdot \frac{p}{x} + -0.25 \cdot \frac{-2 \cdot {p}^{4} + -4 \cdot {p}^{4}}{p \cdot {x}^{3}} \]

      fma-def [=>]42.5

      \[ \color{blue}{\mathsf{fma}\left(-1, \frac{p}{x}, -0.25 \cdot \frac{-2 \cdot {p}^{4} + -4 \cdot {p}^{4}}{p \cdot {x}^{3}}\right)} \]

      associate-/r* [=>]52.0

      \[ \mathsf{fma}\left(-1, \frac{p}{x}, -0.25 \cdot \color{blue}{\frac{\frac{-2 \cdot {p}^{4} + -4 \cdot {p}^{4}}{p}}{{x}^{3}}}\right) \]

      distribute-rgt-out [=>]52.0

      \[ \mathsf{fma}\left(-1, \frac{p}{x}, -0.25 \cdot \frac{\frac{\color{blue}{{p}^{4} \cdot \left(-2 + -4\right)}}{p}}{{x}^{3}}\right) \]

      metadata-eval [=>]52.0

      \[ \mathsf{fma}\left(-1, \frac{p}{x}, -0.25 \cdot \frac{\frac{{p}^{4} \cdot \color{blue}{-6}}{p}}{{x}^{3}}\right) \]
    7. Applied egg-rr45.1%

      \[\leadsto \color{blue}{\sqrt{{\left(\mathsf{fma}\left(-1, \frac{p}{x}, \left(\frac{-6}{p \cdot {x}^{3}} \cdot {p}^{4}\right) \cdot -0.25\right)\right)}^{2}}} \]
      Proof

      [Start]52.0

      \[ \mathsf{fma}\left(-1, \frac{p}{x}, -0.25 \cdot \frac{\frac{{p}^{4} \cdot -6}{p}}{{x}^{3}}\right) \]

      add-sqr-sqrt [=>]49.6

      \[ \color{blue}{\sqrt{\mathsf{fma}\left(-1, \frac{p}{x}, -0.25 \cdot \frac{\frac{{p}^{4} \cdot -6}{p}}{{x}^{3}}\right)} \cdot \sqrt{\mathsf{fma}\left(-1, \frac{p}{x}, -0.25 \cdot \frac{\frac{{p}^{4} \cdot -6}{p}}{{x}^{3}}\right)}} \]

      sqrt-unprod [=>]55.5

      \[ \color{blue}{\sqrt{\mathsf{fma}\left(-1, \frac{p}{x}, -0.25 \cdot \frac{\frac{{p}^{4} \cdot -6}{p}}{{x}^{3}}\right) \cdot \mathsf{fma}\left(-1, \frac{p}{x}, -0.25 \cdot \frac{\frac{{p}^{4} \cdot -6}{p}}{{x}^{3}}\right)}} \]

      pow2 [=>]55.5

      \[ \sqrt{\color{blue}{{\left(\mathsf{fma}\left(-1, \frac{p}{x}, -0.25 \cdot \frac{\frac{{p}^{4} \cdot -6}{p}}{{x}^{3}}\right)\right)}^{2}}} \]

      *-commutative [=>]55.5

      \[ \sqrt{{\left(\mathsf{fma}\left(-1, \frac{p}{x}, \color{blue}{\frac{\frac{{p}^{4} \cdot -6}{p}}{{x}^{3}} \cdot -0.25}\right)\right)}^{2}} \]

      associate-/l/ [=>]45.9

      \[ \sqrt{{\left(\mathsf{fma}\left(-1, \frac{p}{x}, \color{blue}{\frac{{p}^{4} \cdot -6}{{x}^{3} \cdot p}} \cdot -0.25\right)\right)}^{2}} \]

      *-commutative [=>]45.9

      \[ \sqrt{{\left(\mathsf{fma}\left(-1, \frac{p}{x}, \frac{\color{blue}{-6 \cdot {p}^{4}}}{{x}^{3} \cdot p} \cdot -0.25\right)\right)}^{2}} \]

      associate-/l* [=>]46.0

      \[ \sqrt{{\left(\mathsf{fma}\left(-1, \frac{p}{x}, \color{blue}{\frac{-6}{\frac{{x}^{3} \cdot p}{{p}^{4}}}} \cdot -0.25\right)\right)}^{2}} \]

      associate-/r/ [=>]45.1

      \[ \sqrt{{\left(\mathsf{fma}\left(-1, \frac{p}{x}, \color{blue}{\left(\frac{-6}{{x}^{3} \cdot p} \cdot {p}^{4}\right)} \cdot -0.25\right)\right)}^{2}} \]

      *-commutative [=>]45.1

      \[ \sqrt{{\left(\mathsf{fma}\left(-1, \frac{p}{x}, \left(\frac{-6}{\color{blue}{p \cdot {x}^{3}}} \cdot {p}^{4}\right) \cdot -0.25\right)\right)}^{2}} \]
    8. Simplified92.2%

      \[\leadsto \color{blue}{\left|\frac{1.5}{\frac{{x}^{3}}{{p}^{3}}} - \frac{p}{x}\right|} \]
      Proof

      [Start]45.1

      \[ \sqrt{{\left(\mathsf{fma}\left(-1, \frac{p}{x}, \left(\frac{-6}{p \cdot {x}^{3}} \cdot {p}^{4}\right) \cdot -0.25\right)\right)}^{2}} \]

      unpow2 [=>]45.1

      \[ \sqrt{\color{blue}{\mathsf{fma}\left(-1, \frac{p}{x}, \left(\frac{-6}{p \cdot {x}^{3}} \cdot {p}^{4}\right) \cdot -0.25\right) \cdot \mathsf{fma}\left(-1, \frac{p}{x}, \left(\frac{-6}{p \cdot {x}^{3}} \cdot {p}^{4}\right) \cdot -0.25\right)}} \]

      rem-sqrt-square [=>]71.6

      \[ \color{blue}{\left|\mathsf{fma}\left(-1, \frac{p}{x}, \left(\frac{-6}{p \cdot {x}^{3}} \cdot {p}^{4}\right) \cdot -0.25\right)\right|} \]

      fma-udef [=>]71.6

      \[ \left|\color{blue}{-1 \cdot \frac{p}{x} + \left(\frac{-6}{p \cdot {x}^{3}} \cdot {p}^{4}\right) \cdot -0.25}\right| \]

      +-commutative [=>]71.6

      \[ \left|\color{blue}{\left(\frac{-6}{p \cdot {x}^{3}} \cdot {p}^{4}\right) \cdot -0.25 + -1 \cdot \frac{p}{x}}\right| \]

    if -0.9999999998 < (/.f64 x (sqrt.f64 (+.f64 (*.f64 (*.f64 4 p) p) (*.f64 x x))))

    1. Initial program 99.9%

      \[\sqrt{0.5 \cdot \left(1 + \frac{x}{\sqrt{\left(4 \cdot p\right) \cdot p + x \cdot x}}\right)} \]
    2. Applied egg-rr99.9%

      \[\leadsto \sqrt{0.5 \cdot \left(1 + \frac{x}{\color{blue}{\mathsf{hypot}\left(2 \cdot p, x\right)}}\right)} \]
      Proof

      [Start]99.9

      \[ \sqrt{0.5 \cdot \left(1 + \frac{x}{\sqrt{\left(4 \cdot p\right) \cdot p + x \cdot x}}\right)} \]

      add-sqr-sqrt [=>]99.9

      \[ \sqrt{0.5 \cdot \left(1 + \frac{x}{\sqrt{\color{blue}{\sqrt{\left(4 \cdot p\right) \cdot p} \cdot \sqrt{\left(4 \cdot p\right) \cdot p}} + x \cdot x}}\right)} \]

      hypot-def [=>]99.9

      \[ \sqrt{0.5 \cdot \left(1 + \frac{x}{\color{blue}{\mathsf{hypot}\left(\sqrt{\left(4 \cdot p\right) \cdot p}, x\right)}}\right)} \]

      associate-*l* [=>]99.9

      \[ \sqrt{0.5 \cdot \left(1 + \frac{x}{\mathsf{hypot}\left(\sqrt{\color{blue}{4 \cdot \left(p \cdot p\right)}}, x\right)}\right)} \]

      sqrt-prod [=>]99.9

      \[ \sqrt{0.5 \cdot \left(1 + \frac{x}{\mathsf{hypot}\left(\color{blue}{\sqrt{4} \cdot \sqrt{p \cdot p}}, x\right)}\right)} \]

      metadata-eval [=>]99.9

      \[ \sqrt{0.5 \cdot \left(1 + \frac{x}{\mathsf{hypot}\left(\color{blue}{2} \cdot \sqrt{p \cdot p}, x\right)}\right)} \]

      sqrt-unprod [<=]49.1

      \[ \sqrt{0.5 \cdot \left(1 + \frac{x}{\mathsf{hypot}\left(2 \cdot \color{blue}{\left(\sqrt{p} \cdot \sqrt{p}\right)}, x\right)}\right)} \]

      add-sqr-sqrt [<=]99.9

      \[ \sqrt{0.5 \cdot \left(1 + \frac{x}{\mathsf{hypot}\left(2 \cdot \color{blue}{p}, x\right)}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification98.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{\sqrt{p \cdot \left(4 \cdot p\right) + x \cdot x}} \leq -0.9999999998:\\ \;\;\;\;\left|\frac{1.5}{\frac{{x}^{3}}{{p}^{3}}} - \frac{p}{x}\right|\\ \mathbf{else}:\\ \;\;\;\;\sqrt{0.5 \cdot \left(1 + \frac{x}{\mathsf{hypot}\left(p \cdot 2, x\right)}\right)}\\ \end{array} \]

Alternatives

Alternative 1
Accuracy90.8%
Cost20612
\[\begin{array}{l} \mathbf{if}\;\frac{x}{\sqrt{p \cdot \left(4 \cdot p\right) + x \cdot x}} \leq -0.9:\\ \;\;\;\;\sqrt{0.5 \cdot \left(2 \cdot \left(\frac{p}{x} \cdot \frac{p}{x}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{0.5 \cdot \left(1 + \frac{x}{\mathsf{hypot}\left(p \cdot 2, x\right)}\right)}\\ \end{array} \]
Alternative 2
Accuracy67.7%
Cost7636
\[\begin{array}{l} \mathbf{if}\;p \leq -8.5 \cdot 10^{-40}:\\ \;\;\;\;\sqrt{0.5}\\ \mathbf{elif}\;p \leq -1.5 \cdot 10^{-179}:\\ \;\;\;\;\frac{p}{x}\\ \mathbf{elif}\;p \leq -4.8 \cdot 10^{-239}:\\ \;\;\;\;1\\ \mathbf{elif}\;p \leq -1.3 \cdot 10^{-265}:\\ \;\;\;\;\frac{p}{x}\\ \mathbf{elif}\;p \leq 3 \cdot 10^{-87}:\\ \;\;\;\;\mathsf{fma}\left(-0.5, \frac{p \cdot p}{x \cdot x}, 1\right)\\ \mathbf{elif}\;p \leq 2.1 \cdot 10^{-40}:\\ \;\;\;\;\frac{-p}{x}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{0.5}\\ \end{array} \]
Alternative 3
Accuracy67.8%
Cost7256
\[\begin{array}{l} \mathbf{if}\;p \leq -1.4 \cdot 10^{-43}:\\ \;\;\;\;\sqrt{0.5}\\ \mathbf{elif}\;p \leq -6.5 \cdot 10^{-176}:\\ \;\;\;\;\frac{p}{x}\\ \mathbf{elif}\;p \leq -5.6 \cdot 10^{-239}:\\ \;\;\;\;1\\ \mathbf{elif}\;p \leq -5 \cdot 10^{-265}:\\ \;\;\;\;\frac{p}{x}\\ \mathbf{elif}\;p \leq 2.9 \cdot 10^{-87}:\\ \;\;\;\;1\\ \mathbf{elif}\;p \leq 5.5 \cdot 10^{-41}:\\ \;\;\;\;\frac{-p}{x}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{0.5}\\ \end{array} \]
Alternative 4
Accuracy67.6%
Cost6860
\[\begin{array}{l} \mathbf{if}\;p \leq -1.45 \cdot 10^{-43}:\\ \;\;\;\;\sqrt{0.5}\\ \mathbf{elif}\;p \leq 2.5 \cdot 10^{-267}:\\ \;\;\;\;\frac{p}{x}\\ \mathbf{elif}\;p \leq 4.2 \cdot 10^{-37}:\\ \;\;\;\;\frac{-p}{x}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{0.5}\\ \end{array} \]
Alternative 5
Accuracy26.3%
Cost388
\[\begin{array}{l} \mathbf{if}\;p \leq 2.5 \cdot 10^{-267}:\\ \;\;\;\;\frac{p}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{-p}{x}\\ \end{array} \]
Alternative 6
Accuracy16.9%
Cost192
\[\frac{p}{x} \]

Error

Reproduce?

herbie shell --seed 2023135 
(FPCore (p x)
  :name "Given's Rotation SVD example"
  :precision binary64
  :pre (and (< 1e-150 (fabs x)) (< (fabs x) 1e+150))

  :herbie-target
  (sqrt (+ 0.5 (/ (copysign 0.5 x) (hypot 1.0 (/ (* 2.0 p) x)))))

  (sqrt (* 0.5 (+ 1.0 (/ x (sqrt (+ (* (* 4.0 p) p) (* x x))))))))