Average Error: 0.0 → 0.0
Time: 2.0s
Precision: binary64
\[\left(\frac{\sqrt{2}}{4} \cdot \sqrt{1 - 3 \cdot \left(v \cdot v\right)}\right) \cdot \left(1 - v \cdot v\right) \]
\[\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{2} \cdot \left(\sqrt{\mathsf{fma}\left(v, v \cdot -3, 1\right)} \cdot \left(-0.25 \cdot \mathsf{fma}\left(v, v, -1\right)\right)\right)\right)\right) \]
\left(\frac{\sqrt{2}}{4} \cdot \sqrt{1 - 3 \cdot \left(v \cdot v\right)}\right) \cdot \left(1 - v \cdot v\right)
\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{2} \cdot \left(\sqrt{\mathsf{fma}\left(v, v \cdot -3, 1\right)} \cdot \left(-0.25 \cdot \mathsf{fma}\left(v, v, -1\right)\right)\right)\right)\right)
(FPCore (v)
 :precision binary64
 (* (* (/ (sqrt 2.0) 4.0) (sqrt (- 1.0 (* 3.0 (* v v))))) (- 1.0 (* v v))))
(FPCore (v)
 :precision binary64
 (expm1
  (log1p
   (* (sqrt 2.0) (* (sqrt (fma v (* v -3.0) 1.0)) (* -0.25 (fma v v -1.0)))))))
double code(double v) {
	return ((sqrt(2.0) / 4.0) * sqrt(1.0 - (3.0 * (v * v)))) * (1.0 - (v * v));
}
double code(double v) {
	return expm1(log1p(sqrt(2.0) * (sqrt(fma(v, (v * -3.0), 1.0)) * (-0.25 * fma(v, v, -1.0)))));
}

Error

Bits error versus v

Derivation

  1. Initial program 0.0

    \[\left(\frac{\sqrt{2}}{4} \cdot \sqrt{1 - 3 \cdot \left(v \cdot v\right)}\right) \cdot \left(1 - v \cdot v\right) \]
  2. Simplified0.0

    \[\leadsto \color{blue}{\sqrt{2} \cdot \left(\sqrt{\mathsf{fma}\left(v, v \cdot -3, 1\right)} \cdot \left(-0.25 \cdot \mathsf{fma}\left(v, v, -1\right)\right)\right)} \]
  3. Applied expm1-log1p-u_binary640.0

    \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{2} \cdot \left(\sqrt{\mathsf{fma}\left(v, v \cdot -3, 1\right)} \cdot \left(-0.25 \cdot \mathsf{fma}\left(v, v, -1\right)\right)\right)\right)\right)} \]
  4. Final simplification0.0

    \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{2} \cdot \left(\sqrt{\mathsf{fma}\left(v, v \cdot -3, 1\right)} \cdot \left(-0.25 \cdot \mathsf{fma}\left(v, v, -1\right)\right)\right)\right)\right) \]

Reproduce

herbie shell --seed 2022103 
(FPCore (v)
  :name "Falkner and Boettcher, Appendix B, 2"
  :precision binary64
  (* (* (/ (sqrt 2.0) 4.0) (sqrt (- 1.0 (* 3.0 (* v v))))) (- 1.0 (* v v))))