Average Error: 21.8 → 0.1
Time: 2.7m
Precision: 64
Internal Precision: 1152
\[\left(\left(x - 1.0\right) \cdot \log y + \left(z - 1.0\right) \cdot \log \left(1.0 - y\right)\right) - t\]
\[\left(\left(x - 1.0\right) \cdot \log y + \left(z - 1.0\right) \cdot \left(\log 1.0 - \left(\frac{1}{2} \cdot \frac{{y}^{2}}{{1.0}^{2}} + 1.0 \cdot y\right)\right)\right) - t\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original21.8
Target21.8
Herbie0.1
\[\left(\left(x - 1.0\right) \cdot \log y + \left(z - 1.0\right) \cdot \log \left(1.0 - y\right)\right) - t\]

Derivation

  1. Initial program 21.8

    \[\left(\left(x - 1.0\right) \cdot \log y + \left(z - 1.0\right) \cdot \log \left(1.0 - y\right)\right) - t\]
  2. Taylor expanded around 0 0.1

    \[\leadsto \left(\left(x - 1.0\right) \cdot \log y + \left(z - 1.0\right) \cdot \color{blue}{\left(\log 1.0 - \left(\frac{1}{2} \cdot \frac{{y}^{2}}{{1.0}^{2}} + 1.0 \cdot y\right)\right)}\right) - t\]
  3. Removed slow pow expressions.

Runtime

Time bar (total: 2.7m)Debug log

herbie shell --seed '#(1567391828 2030694642 2833800258 828025724 3004380912 3532991858)' +o setup:early-exit
(FPCore (x y z t)
  :name "Statistics.Distribution.Beta:$cdensity from math-functions-0.1.5.2"

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

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