Average Error: 1.6 → 0.1
Time: 12.5s
Precision: 64
Internal Precision: 128
\[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
\[\begin{array}{l} \mathbf{if}\;x \le -9749406881751794.0:\\ \;\;\;\;\left|\frac{4 + x}{y} - \frac{x}{\frac{y}{z}}\right|\\ \mathbf{elif}\;x \le 653141293.4019859:\\ \;\;\;\;\left|\frac{-16 + x \cdot x}{y \cdot \left(x - 4\right)} - \frac{z \cdot x}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\left(\frac{4}{y} + \frac{x}{y}\right) - \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 3 regimes
  2. if x < -9749406881751794.0

    1. Initial program 0.1

      \[\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|\]

    if -9749406881751794.0 < x < 653141293.4019859

    1. Initial program 2.5

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

      \[\leadsto \left|\frac{x + 4}{y} - \color{blue}{\frac{x \cdot z}{y}}\right|\]
    3. Using strategy rm
    4. Applied flip-+0.1

      \[\leadsto \left|\frac{\color{blue}{\frac{x \cdot x - 4 \cdot 4}{x - 4}}}{y} - \frac{x \cdot z}{y}\right|\]
    5. Applied associate-/l/0.1

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

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

    if 653141293.4019859 < x

    1. Initial program 0.1

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -9749406881751794.0:\\ \;\;\;\;\left|\frac{4 + x}{y} - \frac{x}{\frac{y}{z}}\right|\\ \mathbf{elif}\;x \le 653141293.4019859:\\ \;\;\;\;\left|\frac{-16 + x \cdot x}{y \cdot \left(x - 4\right)} - \frac{z \cdot x}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\left(\frac{4}{y} + \frac{x}{y}\right) - \frac{x}{y} \cdot z\right|\\ \end{array}\]

Reproduce

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

Details

Time bar (total: 9.0s)Debug log

start76.0ms

Algorithm
intervals

setup66.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.1b

localize18.0ms

Local error

Found 3 expressions with local error:

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

rewrite14.0ms

Algorithm
rewrite-expression-head
Counts
3 → 42
Calls

3 calls. Slowest were:

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

series62.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

34.0ms
(- (/ (+ x 4) y) (* (/ x y) z))
15.0ms
(* (/ x y) z)
14.0ms
(/ (+ x 4) y)

simplify418.0ms

Counts
20 → 51
Calls

20 calls. Slowest were:

104.0ms
(- (* (+ x 4) y) (* y (* x z)))
82.0ms
(- (+ (/ x y) (* 4 (/ 1 y))) (/ (* x z) y))
62.0ms
(- (+ (/ x y) (* 4 (/ 1 y))) (/ (* x z) y))

prune489.0ms

Pruning

5 alts after pruning (5 fresh and 0 done)

Merged error: 0.0b

localize11.0ms

Local error

Found 3 expressions with local error:

5.0b
(/ (* 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 z) y)
2.0ms
(/ (+ x 4) y)

series62.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

35.0ms
(- (/ (+ x 4) y) (/ (* x z) y))
14.0ms
(/ (+ x 4) y)
13.0ms
(/ (* x z) y)

simplify550.0ms

Counts
22 → 52
Calls

22 calls. Slowest were:

120.0ms
(- (* (+ x 4) y) (* y (* x z)))
76.0ms
(- (+ (/ x y) (* 4 (/ 1 y))) (/ (* x z) y))
68.0ms
(- (+ (/ x y) (* 4 (/ 1 y))) (/ (* x z) y))

prune525.0ms

Pruning

4 alts after pruning (4 fresh and 0 done)

Merged error: 0.0b

localize10.0ms

Local error

Found 3 expressions with local error:

4.2b
(* (/ 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 → 44
Calls

3 calls. Slowest were:

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

series67.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

28.0ms
(- (+ (/ x y) (/ 4 y)) (* (/ x y) z))
24.0ms
(+ (/ x y) (/ 4 y))
14.0ms
(* (/ x y) z)

simplify1.5s

Counts
27 → 53
Calls

27 calls. Slowest were:

379.0ms
(- (* (+ (pow (/ x y) 3) (pow (/ 4 y) 3)) y) (* (+ (* (/ x y) (/ x y)) (- (* (/ 4 y) (/ 4 y)) (* (/ x y) (/ 4 y)))) (* x z)))
238.0ms
(- (* (+ (* x y) (* y 4)) y) (* (* y y) (* x z)))
219.0ms
(* (+ (* (/ x y) (/ x y)) (- (* (/ 4 y) (/ 4 y)) (* (/ x y) (/ 4 y)))) y)

prune584.0ms

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0.0b

localize33.0ms

Local error

Found 4 expressions with local error:

10.2b
(cbrt (/ x y))
10.2b
(cbrt (/ x y))
10.2b
(cbrt (/ x y))
0.7b
(* (* (cbrt (/ x y)) (cbrt (/ x y))) (* (cbrt (/ x y)) z))

rewrite32.0ms

Algorithm
rewrite-expression-head
Counts
4 → 62
Calls

4 calls. Slowest were:

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

series252.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

85.0ms
(cbrt (/ x y))
78.0ms
(cbrt (/ x y))
73.0ms
(cbrt (/ x y))
15.0ms
(* (* (cbrt (/ x y)) (cbrt (/ x y))) (* (cbrt (/ x y)) z))

simplify2.8s

Counts
44 → 74
Calls

44 calls. Slowest were:

692.0ms
(* (* (/ x y) (/ x y)) (* (* (* (cbrt (/ x y)) z) (* (cbrt (/ x y)) z)) (* (cbrt (/ x y)) z)))
434.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)))
253.0ms
(exp (* 1/3 (- (log (/ -1 y)) (log (/ -1 x)))))

prune1.0s

Pruning

4 alts after pruning (2 fresh and 2 done)

Merged error: 0.0b

regimes197.0ms

Accuracy

93.4% (0.1b remaining)

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

bsearch201.0ms