Average Error: 1.5 → 0.9
Time: 14.8s
Precision: 64
Internal Precision: 576
\[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
\[\begin{array}{l} \mathbf{if}\;y \le 1.0856501516718203 \cdot 10^{+18}:\\ \;\;\;\;\left|(z \cdot \left(-\frac{x}{y}\right) + \left(\frac{x}{y} + \frac{4}{y}\right))_*\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{4 + x}{y} - \frac{x}{\frac{y}{z}}\right|\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Derivation

  1. Split input into 2 regimes
  2. if y < 1.0856501516718203e+18

    1. Initial program 1.2

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
    2. Taylor expanded around -inf 2.4

      \[\leadsto \left|\color{blue}{\left(\frac{x}{y} + 4 \cdot \frac{1}{y}\right) - \frac{x \cdot z}{y}}\right|\]
    3. Simplified1.2

      \[\leadsto \left|\color{blue}{(z \cdot \left(-\frac{x}{y}\right) + \left(\frac{x}{y} + \frac{4}{y}\right))_*}\right|\]

    if 1.0856501516718203e+18 < y

    1. Initial program 2.3

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
    2. Initial simplification0.1

      \[\leadsto \left|\frac{4 + x}{y} - \frac{x}{\frac{y}{z}}\right|\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le 1.0856501516718203 \cdot 10^{+18}:\\ \;\;\;\;\left|(z \cdot \left(-\frac{x}{y}\right) + \left(\frac{x}{y} + \frac{4}{y}\right))_*\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{4 + x}{y} - \frac{x}{\frac{y}{z}}\right|\\ \end{array}\]

Runtime

Time bar (total: 14.8s)Debug logProfile

BaselineHerbieOracleSpan%
Regimes1.50.90.01.542.7%
herbie shell --seed 2018285 +o rules:numerics
(FPCore (x y z)
  :name "fabs fraction 1"
  (fabs (- (/ (+ x 4) y) (* (/ x y) z))))