Average Error: 1.5 → 0.1
Time: 9.8s
Precision: 64
Internal Precision: 128
\[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
\[\begin{array}{l} \mathbf{if}\;x \le -1.5293515526480282 \cdot 10^{+26}:\\ \;\;\;\;\left|\frac{4 + x}{y} - x \cdot \left(z \cdot \frac{1}{y}\right)\right|\\ \mathbf{elif}\;x \le 45940670698724.875:\\ \;\;\;\;\left|\frac{4 + x}{y} - \frac{z \cdot x}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\left(\frac{x}{y} + \frac{4}{y}\right) - \frac{x}{\frac{y}{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.5293515526480282e+26

    1. Initial program 0.1

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

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

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

    if -1.5293515526480282e+26 < x < 45940670698724.875

    1. Initial program 2.3

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

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

    if 45940670698724.875 < x

    1. Initial program 0.1

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

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

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

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

Reproduce

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

Details

Time bar (total: 9.4s)Debug log

sample76.0ms

Algorithm
intervals

simplify47.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune11.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 1.5b

localize51.0ms

Local error

Found 3 expressions with local error:

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

rewrite22.0ms

Algorithm
rewrite-expression-head
Counts
3 → 42
Calls

3 calls. Slowest were:

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

series62.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

32.0ms
(- (/ (+ x 4) y) (* (/ x y) z))
16.0ms
(* (/ x y) z)
14.0ms
(/ (+ x 4) y)

simplify459.0ms

Counts
20 → 51
Calls

20 calls. Slowest were:

103.0ms
(- (* (+ x 4) y) (* y (* x z)))
87.0ms
(- (+ (/ x y) (* 4 (/ 1 y))) (/ (* x z) y))
55.0ms
(- (+ (/ x y) (* 4 (/ 1 y))) (/ (* x z) y))

prune573.0ms

Pruning

5 alts after pruning (5 fresh and 0 done)

Merged error: 0.0b

localize10.0ms

Local error

Found 3 expressions with local error:

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

rewrite33.0ms

Algorithm
rewrite-expression-head
Counts
3 → 44
Calls

3 calls. Slowest were:

27.0ms
(- (+ (/ x y) (/ 4 y)) (* (/ x y) z))
3.0ms
(+ (/ x y) (/ 4 y))
2.0ms
(* (/ x y) z)

series98.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

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

simplify1.6s

Counts
27 → 53
Calls

27 calls. Slowest were:

310.0ms
(- (* (+ (pow (/ x y) 3) (pow (/ 4 y) 3)) y) (* (+ (* (/ x y) (/ x y)) (- (* (/ 4 y) (/ 4 y)) (* (/ x y) (/ 4 y)))) (* x z)))
290.0ms
(* (+ (* (/ x y) (/ x y)) (- (* (/ 4 y) (/ 4 y)) (* (/ x y) (/ 4 y)))) y)
256.0ms
(- (* (- (* (/ x y) (/ x y)) (* (/ 4 y) (/ 4 y))) y) (* (- (/ x y) (/ 4 y)) (* x z)))

prune973.0ms

Pruning

5 alts after pruning (4 fresh and 1 done)

Merged error: 0b

localize22.0ms

Local error

Found 3 expressions with local error:

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

rewrite28.0ms

Algorithm
rewrite-expression-head
Counts
3 → 49
Calls

3 calls. Slowest were:

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

series84.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

38.0ms
(- (+ (/ x y) (/ 4 y)) (/ x (/ y z)))
26.0ms
(+ (/ x y) (/ 4 y))
20.0ms
(/ x (/ y z))

simplify1.6s

Counts
32 → 58
Calls

32 calls. Slowest were:

336.0ms
(- (* (+ (* x y) (* y 4)) (/ y z)) (* (* y y) x))
283.0ms
(- (* (+ (pow (/ x y) 3) (pow (/ 4 y) 3)) (/ y z)) (* (+ (* (/ x y) (/ x y)) (- (* (/ 4 y) (/ 4 y)) (* (/ x y) (/ 4 y)))) x))
180.0ms
(- (* (- (* (/ x y) (/ x y)) (* (/ 4 y) (/ 4 y))) (/ y z)) (* (- (/ x y) (/ 4 y)) x))

prune571.0ms

Pruning

5 alts after pruning (3 fresh and 2 done)

Merged error: 0b

localize12.0ms

Local error

Found 3 expressions with local error:

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

rewrite10.0ms

Algorithm
rewrite-expression-head
Counts
3 → 43
Calls

3 calls. Slowest were:

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

series79.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

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

simplify586.0ms

Counts
22 → 52
Calls

22 calls. Slowest were:

102.0ms
(- (* (+ x 4) y) (* y (* x z)))
82.0ms
(- (+ (/ x y) (* 4 (/ 1 y))) (/ (* x z) y))
72.0ms
(- (+ (/ x y) (* 4 (/ 1 y))) (/ (* x z) y))

prune499.0ms

Pruning

5 alts after pruning (2 fresh and 3 done)

Merged error: 0b

regimes218.0ms

Accuracy

93.4% (0.1b remaining)

Error of 0.1b against oracle of 0.0b and baseline of 1.5b

bsearch179.0ms

end0.0ms

sample1.5s

Algorithm
intervals