Average Error: 28.2 → 28.2
Time: 2.0s
Precision: binary64
\[\frac{\left({RA}^{2} + {d}^{2}\right) - {RB}^{2}}{2 \cdot d}\]
\[\frac{\left({RA}^{2} + {d}^{2}\right) - {RB}^{2}}{2 \cdot d}\]
\frac{\left({RA}^{2} + {d}^{2}\right) - {RB}^{2}}{2 \cdot d}
\frac{\left({RA}^{2} + {d}^{2}\right) - {RB}^{2}}{2 \cdot d}
double code(double RA, double d, double RB) {
	return ((double) (((double) (((double) (((double) pow(RA, 2.0)) + ((double) pow(d, 2.0)))) - ((double) pow(RB, 2.0)))) / ((double) (2.0 * d))));
}
double code(double RA, double d, double RB) {
	return ((double) (((double) (((double) (((double) pow(RA, 2.0)) + ((double) pow(d, 2.0)))) - ((double) pow(RB, 2.0)))) / ((double) (2.0 * d))));
}

Error

Bits error versus RA

Bits error versus d

Bits error versus RB

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 28.2

    \[\frac{\left({RA}^{2} + {d}^{2}\right) - {RB}^{2}}{2 \cdot d}\]
  2. Final simplification28.2

    \[\leadsto \frac{\left({RA}^{2} + {d}^{2}\right) - {RB}^{2}}{2 \cdot d}\]

Reproduce

herbie shell --seed 2020152 
(FPCore (RA d RB)
  :name "(/ (- (+ (pow RA 2) (pow d 2)) (pow RB 2)) (* 2 d))"
  :precision binary64
  (/ (- (+ (pow RA 2.0) (pow d 2.0)) (pow RB 2.0)) (* 2.0 d)))