Average Error: 1.7 → 2.1
Time: 9.7s
Precision: 64
Internal Precision: 128
\[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
\[\begin{array}{l} \mathbf{if}\;\frac{4 + x}{y} - \frac{x}{y} \cdot z \le 1.052154923565608 \cdot 10^{+109}:\\ \;\;\;\;\left|\left(\left(4 + x\right) - x \cdot z\right) \cdot \frac{1}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\sqrt{\frac{4 + x}{y} - \frac{x}{y} \cdot z} \cdot \sqrt{\frac{4 + x}{y} - \frac{x}{y} \cdot 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 2 regimes
  2. if (- (/ (+ x 4) y) (* (/ x y) z)) < 1.052154923565608e+109

    1. Initial program 2.1

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

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

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

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

    if 1.052154923565608e+109 < (- (/ (+ x 4) y) (* (/ x y) z))

    1. Initial program 0.1

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt0.5

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

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

Reproduce

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

Details

Time bar (total: 9.0s)Debug log

sample69.0ms

Algorithm
intervals

simplify39.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune12.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 1.9b

localize34.0ms

Local error

Found 2 expressions with local error:

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

rewrite17.0ms

Algorithm
rewrite-expression-head
Counts
2 → 27
Calls

2 calls. Slowest were:

12.0ms
(- (/ (+ x 4) y) (* (/ x y) z))
5.0ms
(* (/ x y) z)

series65.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

44.0ms
(- (/ (+ x 4) y) (* (/ x y) z))
21.0ms
(* (/ x y) z)

simplify788.0ms

Counts
13 → 33
Calls

13 calls. Slowest were:

460.0ms
(- (* (+ x 4) y) (* y (* x z)))
86.0ms
(- (+ (/ x y) (* 4 (/ 1 y))) (/ (* x z) y))
84.0ms
(- (+ (/ x y) (* 4 (/ 1 y))) (/ (* x z) y))

prune340.0ms

Pruning

6 alts after pruning (5 fresh and 1 done)

Merged error: 0.0b

localize11.0ms

Local error

Found 1 expressions with local error:

1.9b
(/ (- (+ x 4) (* x z)) y)

rewrite8.0ms

Algorithm
rewrite-expression-head
Counts
1 → 16
Calls

1 calls. Slowest were:

8.0ms
(/ (- (+ x 4) (* x z)) y)

series38.0ms

Counts
1 → 3
Calls

1 calls. Slowest were:

38.0ms
(/ (- (+ x 4) (* x z)) y)

simplify532.0ms

Counts
8 → 19
Calls

8 calls. Slowest were:

158.0ms
(- (pow (+ x 4) 3) (pow (* x z) 3))
117.0ms
(- (* (+ x 4) (+ x 4)) (* (* x z) (* x z)))
87.0ms
(- (+ (/ x y) (* 4 (/ 1 y))) (/ (* x z) y))

prune170.0ms

Pruning

6 alts after pruning (5 fresh and 1 done)

Merged error: 0b

localize7.0ms

Local error

Found 1 expressions with local error:

2.0b
(* (- (+ x 4) (* x z)) (/ 1 y))

rewrite10.0ms

Algorithm
rewrite-expression-head
Counts
1 → 24
Calls

1 calls. Slowest were:

10.0ms
(* (- (+ x 4) (* x z)) (/ 1 y))

series37.0ms

Counts
1 → 3
Calls

1 calls. Slowest were:

37.0ms
(* (- (+ x 4) (* x z)) (/ 1 y))

simplify2.3s

Counts
18 → 27
Calls

18 calls. Slowest were:

416.0ms
(* (- (* (+ x 4) (+ x 4)) (* (* x z) (* x z))) (/ 1 y))
340.0ms
(* (+ (* (+ x 4) (+ x 4)) (+ (* (* x z) (* x z)) (* (+ x 4) (* x z)))) y)
291.0ms
(* (- (pow (+ x 4) 3) (pow (* x z) 3)) (/ 1 y))

prune267.0ms

Pruning

6 alts after pruning (4 fresh and 2 done)

Merged error: 0b

localize33.0ms

Local error

Found 3 expressions with local error:

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

rewrite50.0ms

Algorithm
rewrite-expression-head
Counts
3 → 49
Calls

3 calls. Slowest were:

41.0ms
(- (+ (/ x y) (/ 4 y)) (/ x (/ y z)))
7.0ms
(+ (/ x y) (/ 4 y))
1.0ms
(/ x (/ y z))

series95.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

40.0ms
(- (+ (/ x y) (/ 4 y)) (/ x (/ y z)))
29.0ms
(+ (/ x y) (/ 4 y))
26.0ms
(/ x (/ y z))

simplify1.5s

Counts
32 → 58
Calls

32 calls. Slowest were:

260.0ms
(- (* (+ (pow (/ x y) 3) (pow (/ 4 y) 3)) (/ y z)) (* (+ (* (/ x y) (/ x y)) (- (* (/ 4 y) (/ 4 y)) (* (/ x y) (/ 4 y)))) x))
256.0ms
(- (* (+ (* x y) (* y 4)) (/ y z)) (* (* y y) x))
217.0ms
(- (* (- (* (/ x y) (/ x y)) (* (/ 4 y) (/ 4 y))) (/ y z)) (* (- (/ x y) (/ 4 y)) x))

prune562.0ms

Pruning

5 alts after pruning (3 fresh and 2 done)

Merged error: 0b

regimes228.0ms

Accuracy

37.6% (2.0b remaining)

Error of 2.1b against oracle of 0.0b and baseline of 3.3b

bsearch8.0ms

end0.0ms

sample1.7s

Algorithm
intervals