Average Error: 1.3 → 0.2
Time: 15.1s
Precision: 64
Internal Precision: 128
\[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
\[\begin{array}{l} \mathbf{if}\;x \le -2.1690543199597533 \cdot 10^{+36} \lor \neg \left(x \le 3.2828098054217477 \cdot 10^{-87}\right):\\ \;\;\;\;\left|\frac{4 + x}{y} - \frac{x}{\frac{y}{z}}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{\left(4 + x\right) - z \cdot x}{y}\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 < -2.1690543199597533e+36 or 3.2828098054217477e-87 < x

    1. Initial program 0.4

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

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

    if -2.1690543199597533e+36 < x < 3.2828098054217477e-87

    1. Initial program 2.0

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -2.1690543199597533 \cdot 10^{+36} \lor \neg \left(x \le 3.2828098054217477 \cdot 10^{-87}\right):\\ \;\;\;\;\left|\frac{4 + x}{y} - \frac{x}{\frac{y}{z}}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{\left(4 + x\right) - z \cdot x}{y}\right|\\ \end{array}\]

Reproduce

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

Details

Time bar (total: 11.0s)Debug log

start98.0ms

Algorithm
intervals

setup85.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.1b

localize22.0ms

Local error

Found 3 expressions with local error:

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

rewrite11.0ms

Algorithm
rewrite-expression-head
Counts
3 → 42
Calls

3 calls. Slowest were:

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

series61.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

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

simplify496.0ms

Counts
20 → 51
Calls

20 calls. Slowest were:

112.0ms
(- (* (+ x 4) y) (* y (* x z)))
87.0ms
(- (+ (/ x y) (* 4 (/ 1 y))) (/ (* x z) y))
59.0ms
(- (+ (/ x y) (* 4 (/ 1 y))) (/ (* x z) y))

prune636.0ms

Pruning

7 alts after pruning (7 fresh and 0 done)

Merged error: 0.0b

localize28.0ms

Local error

Found 4 expressions with local error:

11.4b
(cbrt (* (/ x y) z))
11.4b
(cbrt (* (/ x y) z))
11.4b
(cbrt (* (/ x y) z))
3.6b
(* (/ x y) z)

rewrite12.0ms

Algorithm
rewrite-expression-head
Counts
4 → 43
Calls

4 calls. Slowest were:

4.0ms
(* (/ x y) z)
3.0ms
(cbrt (* (/ x y) z))
2.0ms
(cbrt (* (/ x y) z))

series353.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

115.0ms
(cbrt (* (/ x y) z))
108.0ms
(cbrt (* (/ x y) z))
106.0ms
(cbrt (* (/ x y) z))
23.0ms
(* (/ x y) z)

simplify2.0s

Counts
21 → 55
Calls

21 calls. Slowest were:

360.0ms
(exp (* 1/3 (- (log (/ 1 y)) (+ (log (/ 1 z)) (log (/ 1 x))))))
356.0ms
(exp (* 1/3 (- (log (/ 1 y)) (+ (log (/ 1 z)) (log (/ 1 x))))))
312.0ms
(exp (* 1/3 (- (log (/ 1 y)) (+ (log (/ 1 z)) (log (/ 1 x))))))

prune845.0ms

Pruning

8 alts after pruning (7 fresh and 1 done)

Merged error: 0.0b

localize21.0ms

Local error

Found 4 expressions with local error:

11.4b
(cbrt (* (/ x y) z))
11.4b
(cbrt (* (/ x y) z))
10.4b
(cbrt (/ x y))
3.6b
(* (/ x y) z)

rewrite11.0ms

Algorithm
rewrite-expression-head
Counts
4 → 46
Calls

4 calls. Slowest were:

4.0ms
(* (/ x y) z)
2.0ms
(cbrt (* (/ x y) z))
2.0ms
(cbrt (* (/ x y) z))

series337.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

127.0ms
(cbrt (* (/ x y) z))
122.0ms
(cbrt (* (/ x y) z))
74.0ms
(cbrt (/ x y))
14.0ms
(* (/ x y) z)

simplify1.6s

Counts
24 → 58
Calls

24 calls. Slowest were:

294.0ms
(exp (* 1/3 (- (log (/ 1 y)) (+ (log (/ 1 z)) (log (/ 1 x))))))
275.0ms
(exp (* 1/3 (- (log (/ 1 y)) (+ (log (/ 1 z)) (log (/ 1 x))))))
202.0ms
(exp (* 1/3 (- (log (/ 1 y)) (log (/ 1 x)))))

prune1.0s

Pruning

7 alts after pruning (5 fresh and 2 done)

Merged error: 0.0b

localize24.0ms

Local error

Found 4 expressions with local error:

11.4b
(cbrt (* (/ x y) z))
10.4b
(cbrt (/ x y))
10.4b
(cbrt (/ x y))
3.6b
(* (/ x y) z)

rewrite9.0ms

Algorithm
rewrite-expression-head
Counts
4 → 49
Calls

4 calls. Slowest were:

4.0ms
(* (/ x y) z)
2.0ms
(cbrt (* (/ x y) z))
1.0ms
(cbrt (/ x y))

series309.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

105.0ms
(cbrt (* (/ x y) z))
97.0ms
(cbrt (/ x y))
82.0ms
(cbrt (/ x y))
24.0ms
(* (/ x y) z)

simplify1.4s

Counts
27 → 61
Calls

27 calls. Slowest were:

343.0ms
(exp (* 1/3 (- (log (/ 1 y)) (+ (log (/ 1 z)) (log (/ 1 x))))))
216.0ms
(exp (* 1/3 (- (log (/ 1 y)) (log (/ 1 x)))))
171.0ms
(exp (* 1/3 (- (log (/ 1 y)) (log (/ 1 x)))))

prune1.0s

Pruning

7 alts after pruning (4 fresh and 3 done)

Merged error: 0.0b

regimes387.0ms

Accuracy

87.5% (0.2b remaining)

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

bsearch165.0ms