Average Error: 1.5 → 0.2
Time: 12.1s
Precision: 64
Internal Precision: 128
\[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
\[\begin{array}{l} \mathbf{if}\;x \le -1.6436486530612315 \cdot 10^{+33}:\\ \;\;\;\;\left|\left(\frac{4}{y} + \frac{x}{y}\right) - \frac{x}{\frac{y}{z}}\right|\\ \mathbf{elif}\;x \le 4.530076266194952 \cdot 10^{+60}:\\ \;\;\;\;\left|\frac{\left(4 + x\right) - x \cdot z}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\left(\frac{4}{y} + \frac{x}{y}\right) - \frac{\frac{x}{y}}{\frac{1}{z}}\right|\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if x < -1.6436486530612315e+33

    1. Initial program 0.1

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
    2. Using strategy rm
    3. Applied clear-num0.3

      \[\leadsto \left|\color{blue}{\frac{1}{\frac{y}{x + 4}}} - \frac{x}{y} \cdot z\right|\]
    4. Taylor expanded around -inf 9.9

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

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

    if -1.6436486530612315e+33 < x < 4.530076266194952e+60

    1. Initial program 2.2

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
    2. Using strategy rm
    3. Applied associate-*l/0.2

      \[\leadsto \left|\frac{x + 4}{y} - \color{blue}{\frac{x \cdot z}{y}}\right|\]
    4. Applied sub-div0.2

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

    if 4.530076266194952e+60 < x

    1. Initial program 0.1

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
    2. Using strategy rm
    3. Applied clear-num0.3

      \[\leadsto \left|\color{blue}{\frac{1}{\frac{y}{x + 4}}} - \frac{x}{y} \cdot z\right|\]
    4. Taylor expanded around -inf 10.0

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

      \[\leadsto \left|\color{blue}{\left(\frac{x}{y} + \frac{4}{y}\right) - \frac{x}{\frac{y}{z}}}\right|\]
    6. Using strategy rm
    7. Applied div-inv0.2

      \[\leadsto \left|\left(\frac{x}{y} + \frac{4}{y}\right) - \frac{x}{\color{blue}{y \cdot \frac{1}{z}}}\right|\]
    8. Applied associate-/r*0.2

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -1.6436486530612315 \cdot 10^{+33}:\\ \;\;\;\;\left|\left(\frac{4}{y} + \frac{x}{y}\right) - \frac{x}{\frac{y}{z}}\right|\\ \mathbf{elif}\;x \le 4.530076266194952 \cdot 10^{+60}:\\ \;\;\;\;\left|\frac{\left(4 + x\right) - x \cdot z}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\left(\frac{4}{y} + \frac{x}{y}\right) - \frac{\frac{x}{y}}{\frac{1}{z}}\right|\\ \end{array}\]

Reproduce

herbie shell --seed 2019008 
(FPCore (x y z)
  :name "fabs fraction 1"
  (fabs (- (/ (+ x 4) y) (* (/ x y) z))))

Details

Time bar (total: 11.4s)Debug log

sample69.0ms

Algorithm
intervals

simplify41.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

41.0ms
(fabs (- (/ (+ x 4) y) (* (/ x y) z)))

prune12.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 1.5b

localize37.0ms

Local error

Found 3 expressions with local error:

4.0b
(* (/ x y) z)
0.0b
(- (/ (+ x 4) y) (* (/ x y) z))
0.0b
(/ (+ x 4) y)

rewrite21.0ms

Algorithm
rewrite-expression-head
Counts
3 → 42
Calls

3 calls. Slowest were:

11.0ms
(- (/ (+ x 4) y) (* (/ x y) z))
4.0ms
(/ (+ x 4) y)
4.0ms
(* (/ x y) z)

series92.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

40.0ms
(- (/ (+ x 4) y) (* (/ x y) z))
28.0ms
(/ (+ x 4) y)
23.0ms
(* (/ x y) z)

simplify474.0ms

Counts
20 → 51
Calls

20 calls. Slowest were:

106.0ms
(- (* (+ x 4) y) (* y (* x z)))
60.0ms
(- (+ (/ x y) (* 4 (/ 1 y))) (/ (* x z) y))
57.0ms
(- (+ (/ x y) (* 4 (/ 1 y))) (/ (* x z) y))

prune468.0ms

Pruning

5 alts after pruning (5 fresh and 0 done)

Merged error: 0.0b

localize11.0ms

Local error

Found 4 expressions with local error:

4.0b
(* (/ x y) z)
0.1b
(/ 1 (/ y (+ x 4)))
0.0b
(- (/ 1 (/ y (+ x 4))) (* (/ x y) z))
0.0b
(/ y (+ x 4))

rewrite8.0ms

Algorithm
rewrite-expression-head
Counts
4 → 61
Calls

4 calls. Slowest were:

4.0ms
(- (/ 1 (/ y (+ x 4))) (* (/ x y) z))
2.0ms
(* (/ x y) z)
1.0ms
(/ 1 (/ y (+ x 4)))

series96.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

31.0ms
(- (/ 1 (/ y (+ x 4))) (* (/ x y) z))
27.0ms
(* (/ x y) z)
23.0ms
(/ 1 (/ y (+ x 4)))
14.0ms
(/ y (+ x 4))

simplify1.5s

Counts
31 → 73
Calls

31 calls. Slowest were:

394.0ms
(/ (exp (/ 1 (/ y (+ x 4)))) (exp (* (/ x y) z)))
236.0ms
(- (+ (/ y x) (* 16 (/ y (pow x 3)))) (* 4 (/ y (pow x 2))))
187.0ms
(- (+ (/ y x) (* 16 (/ y (pow x 3)))) (* 4 (/ y (pow x 2))))

prune768.0ms

Pruning

6 alts after pruning (5 fresh and 1 done)

Merged error: 0.0b

localize33.0ms

Local error

Found 4 expressions with local error:

8.5b
(cbrt (/ x y))
8.5b
(cbrt (/ x y))
8.5b
(cbrt (/ x y))
0.6b
(* (* (cbrt (/ x y)) (cbrt (/ x y))) (* (cbrt (/ x y)) z))

rewrite33.0ms

Algorithm
rewrite-expression-head
Counts
4 → 62
Calls

4 calls. Slowest were:

29.0ms
(* (* (cbrt (/ x y)) (cbrt (/ x y))) (* (cbrt (/ x y)) z))
1.0ms
(cbrt (/ x y))
1.0ms
(cbrt (/ x y))

series264.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

93.0ms
(cbrt (/ x y))
84.0ms
(cbrt (/ x y))
71.0ms
(cbrt (/ x y))
15.0ms
(* (* (cbrt (/ x y)) (cbrt (/ x y))) (* (cbrt (/ x y)) z))

simplify1.9s

Counts
44 → 74
Calls

44 calls. Slowest were:

369.0ms
(* (* (/ x y) (/ x y)) (* (* (* (cbrt (/ x y)) z) (* (cbrt (/ x y)) z)) (* (cbrt (/ x y)) z)))
281.0ms
(* (* (* (* (cbrt (/ x y)) (cbrt (/ x y))) (* (cbrt (/ x y)) (cbrt (/ x y)))) (* (cbrt (/ x y)) (cbrt (/ x y)))) (* (* (* (cbrt (/ x y)) z) (* (cbrt (/ x y)) z)) (* (cbrt (/ x y)) z)))
205.0ms
(exp (* 1/3 (- (log (/ 1 y)) (log (/ 1 x)))))

prune921.0ms

Pruning

7 alts after pruning (5 fresh and 2 done)

Merged error: 0b

localize25.0ms

Local error

Found 3 expressions with local error:

7.6b
(/ x (/ y z))
0.0b
(- (+ (/ x y) (/ 4 y)) (/ x (/ y z)))
0.0b
(+ (/ x y) (/ 4 y))

rewrite23.0ms

Algorithm
rewrite-expression-head
Counts
3 → 49
Calls

3 calls. Slowest were:

19.0ms
(- (+ (/ x y) (/ 4 y)) (/ x (/ y z)))
3.0ms
(+ (/ x y) (/ 4 y))
0.0ms
(/ x (/ y z))

series75.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

39.0ms
(- (+ (/ x y) (/ 4 y)) (/ x (/ y z)))
22.0ms
(/ x (/ y z))
15.0ms
(+ (/ x y) (/ 4 y))

simplify1.7s

Counts
32 → 58
Calls

32 calls. Slowest were:

334.0ms
(- (* (+ (* x y) (* y 4)) (/ y z)) (* (* y y) x))
261.0ms
(- (* (+ (pow (/ x y) 3) (pow (/ 4 y) 3)) (/ y z)) (* (+ (* (/ x y) (/ x y)) (- (* (/ 4 y) (/ 4 y)) (* (/ x y) (/ 4 y)))) x))
218.0ms
(- (* (- (* (/ x y) (/ x y)) (* (/ 4 y) (/ 4 y))) (/ y z)) (* (- (/ x y) (/ 4 y)) x))

prune577.0ms

Pruning

7 alts after pruning (4 fresh and 3 done)

Merged error: 0b

regimes169.0ms

Accuracy

88.9% (0.2b remaining)

Error of 0.2b against oracle of 0.0b and baseline of 1.6b

bsearch159.0ms

end0.0ms

sample1.8s

Algorithm
intervals