Average Error: 13.3 → 13.3
Time: 1.1s
Precision: binary64
\[\mathsf{copysign}\left(\sqrt{\frac{\mathsf{hypot}\left(a, b\right) - a}{2}}, b\right)\]
\[\mathsf{copysign}\left(\sqrt{\frac{\mathsf{hypot}\left(a, b\right) - a}{2}}, b\right)\]
\mathsf{copysign}\left(\sqrt{\frac{\mathsf{hypot}\left(a, b\right) - a}{2}}, b\right)
\mathsf{copysign}\left(\sqrt{\frac{\mathsf{hypot}\left(a, b\right) - a}{2}}, b\right)
double code(double a, double b) {
	return ((double) copysign(((double) sqrt(((double) (((double) (((double) hypot(a, b)) - a)) / 2.0)))), b));
}
double code(double a, double b) {
	return ((double) copysign(((double) sqrt(((double) (((double) (((double) hypot(a, b)) - a)) / 2.0)))), b));
}

Error

Bits error versus a

Bits error versus b

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 13.3

    \[\mathsf{copysign}\left(\sqrt{\frac{\mathsf{hypot}\left(a, b\right) - a}{2}}, b\right)\]
  2. Final simplification13.3

    \[\leadsto \mathsf{copysign}\left(\sqrt{\frac{\mathsf{hypot}\left(a, b\right) - a}{2}}, b\right)\]

Reproduce

herbie shell --seed 2020153 
(FPCore (a b)
  :name "(copysign (sqrt (/ (- (hypot a b) a) 2)) b)"
  :precision binary64
  (copysign (sqrt (/ (- (hypot a b) a) 2.0)) b))