Average Error: 9.6 → 0.3
Time: 10.1s
Precision: binary64
\[\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t \]
\[\left(\log y \cdot x + z \cdot \left({y}^{3} \cdot -0.3333333333333333 - \mathsf{fma}\left(0.5, y \cdot y, y\right)\right)\right) - t \]
\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t
\left(\log y \cdot x + z \cdot \left({y}^{3} \cdot -0.3333333333333333 - \mathsf{fma}\left(0.5, y \cdot y, y\right)\right)\right) - t
(FPCore (x y z t)
 :precision binary64
 (- (+ (* x (log y)) (* z (log (- 1.0 y)))) t))
(FPCore (x y z t)
 :precision binary64
 (-
  (+
   (* (log y) x)
   (* z (- (* (pow y 3.0) -0.3333333333333333) (fma 0.5 (* y y) y))))
  t))
double code(double x, double y, double z, double t) {
	return ((x * log(y)) + (z * log((1.0 - y)))) - t;
}
double code(double x, double y, double z, double t) {
	return ((log(y) * x) + (z * ((pow(y, 3.0) * -0.3333333333333333) - fma(0.5, (y * y), y)))) - t;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original9.6
Target0.3
Herbie0.3
\[\left(-z\right) \cdot \left(\left(0.5 \cdot \left(y \cdot y\right) + y\right) + \frac{0.3333333333333333}{1 \cdot \left(1 \cdot 1\right)} \cdot \left(y \cdot \left(y \cdot y\right)\right)\right) - \left(t - x \cdot \log y\right) \]

Derivation

  1. Initial program 9.6

    \[\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t \]
  2. Simplified0.1

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, \log y, z \cdot \mathsf{log1p}\left(-y\right)\right) - t} \]
  3. Taylor expanded in y around 0 0.3

    \[\leadsto \color{blue}{\left(\log y \cdot x - \left(0.5 \cdot \left({y}^{2} \cdot z\right) + \left(y \cdot z + 0.3333333333333333 \cdot \left({y}^{3} \cdot z\right)\right)\right)\right)} - t \]
  4. Simplified0.3

    \[\leadsto \color{blue}{\left(\log y \cdot x - z \cdot \left(0.5 \cdot \left(y \cdot y\right) + \left(y + 0.3333333333333333 \cdot {y}^{3}\right)\right)\right)} - t \]
  5. Applied sub-neg_binary640.3

    \[\leadsto \color{blue}{\left(\log y \cdot x + \left(-z \cdot \left(0.5 \cdot \left(y \cdot y\right) + \left(y + 0.3333333333333333 \cdot {y}^{3}\right)\right)\right)\right)} - t \]
  6. Simplified0.3

    \[\leadsto \left(\log y \cdot x + \color{blue}{z \cdot \left({y}^{3} \cdot -0.3333333333333333 - \mathsf{fma}\left(0.5, y \cdot y, y\right)\right)}\right) - t \]
  7. Final simplification0.3

    \[\leadsto \left(\log y \cdot x + z \cdot \left({y}^{3} \cdot -0.3333333333333333 - \mathsf{fma}\left(0.5, y \cdot y, y\right)\right)\right) - t \]

Reproduce

herbie shell --seed 2022125 
(FPCore (x y z t)
  :name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, B"
  :precision binary64

  :herbie-target
  (- (* (- z) (+ (+ (* 0.5 (* y y)) y) (* (/ 0.3333333333333333 (* 1.0 (* 1.0 1.0))) (* y (* y y))))) (- t (* x (log y))))

  (- (+ (* x (log y)) (* z (log (- 1.0 y)))) t))