Average Error: 1.5 → 1.5
Time: 20.0s
Precision: 64
Internal Precision: 128
\[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
\[\left|\left(\frac{x}{y} + \frac{4}{y}\right) - z \cdot \frac{x}{y}\right|\]

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. Initial program 1.5

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

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

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

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

Reproduce

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

Details

Time bar (total: 17.5s)Debug log

start99.0ms

Algorithm
intervals

setup59.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.1b

localize25.0ms

Local error

Found 3 expressions with local error:

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

rewrite12.0ms

Algorithm
rewrite-expression-head
Counts
3 → 56
Calls

3 calls. Slowest were:

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

series53.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

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

simplify1.8s

Counts
31 → 65
Calls

31 calls. Slowest were:

478.0ms
(fma (sqrt (/ (+ x 4) y)) (sqrt (/ (+ x 4) y)) (- (* z (/ x y))))
206.0ms
(- (* (+ x 4) y) (* y (* x z)))
194.0ms
(fma (+ x 4) (/ 1 y) (- (* z (/ x y))))

prune705.0ms

Pruning

4 alts after pruning (4 fresh and 0 done)

Merged error: 0.0b

localize21.0ms

Local error

Found 3 expressions with local error:

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

rewrite63.0ms

Algorithm
rewrite-expression-head
Counts
3 → 64
Calls

3 calls. Slowest were:

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

series82.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

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

simplify3.0s

Counts
42 → 73
Calls

42 calls. Slowest were:

532.0ms
(fma (/ 1 y) (+ x 4) (- (* z (/ x y))))
388.0ms
(* (+ (* (/ x y) (/ x y)) (- (* (/ 4 y) (/ 4 y)) (* (/ x y) (/ 4 y)))) y)
335.0ms
(- (* (+ (* x y) (* y 4)) y) (* (* y y) (* x z)))

prune933.0ms

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0.0b

localize10.0ms

Local error

Found 4 expressions with local error:

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

rewrite11.0ms

Algorithm
rewrite-expression-head
Counts
4 → 79
Calls

4 calls. Slowest were:

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

series113.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

46.0ms
(- (/ 1 (/ y (+ x 4))) (* (/ x y) z))
24.0ms
(* (/ x y) z)
23.0ms
(/ y (+ x 4))
20.0ms
(/ 1 (/ y (+ x 4)))

simplify3.9s

Counts
44 → 91
Calls

44 calls. Slowest were:

596.0ms
(fma (sqrt (/ 1 (/ y (+ x 4)))) (sqrt (/ 1 (/ y (+ x 4)))) (- (* z (/ x y))))
386.0ms
(- (+ (* 1/64 (* (pow x 2) y)) (* 1/4 y)) (* 1/16 (* x y)))
384.0ms
(fma (/ 1 y) (+ x 4) (- (* z (/ x y))))

prune1.1s

Pruning

4 alts after pruning (2 fresh and 2 done)

Merged error: 0.0b

localize17.0ms

Local error

Found 3 expressions with local error:

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

rewrite9.0ms

Algorithm
rewrite-expression-head
Counts
3 → 75
Calls

3 calls. Slowest were:

6.0ms
(- (/ (+ 4 x) y) (/ z (/ y x)))
2.0ms
(/ (+ 4 x) y)
0.0ms
(/ z (/ y x))

series63.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

33.0ms
(- (/ (+ 4 x) y) (/ z (/ y x)))
16.0ms
(/ z (/ y x))
13.0ms
(/ (+ 4 x) y)

simplify4.4s

Counts
66 → 84
Calls

66 calls. Slowest were:

307.0ms
(fma 1 (/ (+ 4 x) y) (- (* (/ 1 (/ y x)) z)))
267.0ms
(fma (* (cbrt (/ (+ 4 x) y)) (cbrt (/ (+ 4 x) y))) (cbrt (/ (+ 4 x) y)) (- (* (/ 1 (/ y x)) z)))
260.0ms
(fma (- (/ 1 (/ y x))) z (* (/ 1 (/ y x)) z))

prune892.0ms

Pruning

5 alts after pruning (2 fresh and 3 done)

Merged error: 0.0b

regimes130.0ms

Accuracy

0% (1.5b remaining)

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

bsearch1.0ms