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

Error

Bits error versus x

Bits error versus y

Bits error versus z

Derivation

  1. Initial program 1.7

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

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

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

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

Reproduce

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

Details

Time bar (total: 9.5s)Debug log

sample77.0ms

Algorithm
intervals

simplify48.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
48.0ms
(fabs (- (/ (+ x 4) y) (* (/ x y) z)))

prune12.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 1.0b

localize41.0ms

Local error

Found 3 expressions with local error:

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

rewrite13.0ms

Algorithm
rewrite-expression-head
Rules
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
add-log-exp
div-inv
prod-diff
associate-*l*
fma-neg
associate-/l*
log1p-expm1-u
add-exp-log
associate-*l/
add-cbrt-cube
pow1
expm1-log1p-u
associate-/l/
sub-div
flip--
flip-+
frac-sub
*-commutative
diff-log
flip3--
flip3-+
frac-2neg
sub-neg
clear-num
Counts
3 → 56
Calls
3 calls:
Slowest
7.0ms
(- (/ (+ x 4) y) (* (/ x y) z))
3.0ms
(* (/ x y) z)
3.0ms
(/ (+ x 4) y)

series80.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
45.0ms
(- (/ (+ x 4) y) (* (/ x y) z))
20.0ms
(/ (+ x 4) y)
15.0ms
(* (/ x y) z)

simplify1.2s

Counts
31 → 65
Calls
31 calls:
Slowest
225.0ms
(fma (+ x 4) (/ 1 y) (- (* z (/ x y))))
156.0ms
(- (* (+ x 4) y) (* y (* x z)))
122.0ms
(- (+ (/ x y) (* 4 (/ 1 y))) (/ (* x z) y))
107.0ms
(- (+ (/ x y) (* 4 (/ 1 y))) (/ (* x z) y))
66.0ms
(- (+ (/ x y) (* 4 (/ 1 y))) (/ (* x z) y))

prune714.0ms

Pruning

4 alts after pruning (4 fresh and 0 done)

Merged error: 0b

localize27.0ms

Local error

Found 2 expressions with local error:

1.0b
(fma z (- (/ x y)) (+ (/ x y) (/ 4 y)))
0.0b
(+ (/ x y) (/ 4 y))

rewrite9.0ms

Algorithm
rewrite-expression-head
Rules
*-un-lft-identity
add-log-exp
fma-def
div-inv
add-cube-cbrt
add-sqr-sqrt
log1p-expm1-u
add-exp-log
add-cbrt-cube
pow1
expm1-log1p-u
distribute-lft-out
fma-udef
flip-+
frac-add
distribute-rgt-out
flip3-+
sum-log
+-commutative
Counts
2 → 30
Calls
2 calls:
Slowest
8.0ms
(+ (/ x y) (/ 4 y))
0.0ms
(fma z (- (/ x y)) (+ (/ x y) (/ 4 y)))

series61.0ms

Counts
2 → 6
Calls
2 calls:
Slowest
44.0ms
(fma z (- (/ x y)) (+ (/ x y) (/ 4 y)))
18.0ms
(+ (/ x y) (/ 4 y))

simplify409.0ms

Counts
14 → 36
Calls
14 calls:
Slowest
123.0ms
(- (+ (/ x y) (* 4 (/ 1 y))) (/ (* x z) y))
90.0ms
(- (+ (/ x y) (* 4 (/ 1 y))) (/ (* x z) y))
83.0ms
(- (+ (/ x y) (* 4 (/ 1 y))) (/ (* x z) y))
31.0ms
(+ (/ x y) (* 4 (/ 1 y)))
19.0ms
(+ (/ x y) (* 4 (/ 1 y)))

prune353.0ms

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0b

localize33.0ms

Local error

Found 4 expressions with local error:

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

rewrite30.0ms

Algorithm
rewrite-expression-head
Rules
15×cbrt-div
12×cbrt-prod
add-exp-log
associate-*l/
pow1
add-cube-cbrt
add-cbrt-cube
*-un-lft-identity
add-sqr-sqrt
frac-times
add-log-exp
log1p-expm1-u
expm1-log1p-u
div-inv
cbrt-unprod
associate-*r/
prod-exp
pow-prod-down
pow1/3
*-commutative
associate-*l*
associate-*r*
Counts
4 → 70
Calls
4 calls:
Slowest
26.0ms
(* (* (cbrt (/ x y)) (cbrt (/ x y))) (* (cbrt (/ x y)) z))
1.0ms
(cbrt (/ x y))
1.0ms
(cbrt (/ x y))
1.0ms
(cbrt (/ x y))

series231.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
80.0ms
(cbrt (/ x y))
72.0ms
(cbrt (/ x y))
64.0ms
(cbrt (/ x y))
15.0ms
(* (* (cbrt (/ x y)) (cbrt (/ x y))) (* (cbrt (/ x y)) z))

simplify2.7s

Counts
44 → 82
Calls
44 calls:
Slowest
571.0ms
(exp (* 1/3 (- (log (/ 1 y)) (log (/ 1 x)))))
428.0ms
(* (* (/ x y) (/ x y)) (* (* (* (cbrt (/ x y)) z) (* (cbrt (/ x y)) z)) (* (cbrt (/ x y)) z)))
336.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)))
208.0ms
(exp (* 1/3 (- (log (/ 1 y)) (log (/ 1 x)))))
207.0ms
(exp (* 1/3 (- (log (/ -1 y)) (log (/ -1 x)))))

prune887.0ms

Pruning

4 alts after pruning (2 fresh and 2 done)

Merged error: 0b

localize12.0ms

Local error

Found 1 expressions with local error:

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

rewrite8.0ms

Algorithm
rewrite-expression-head
Rules
associate-/l*
associate-/l/
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
add-log-exp
flip--
div-inv
log1p-expm1-u
add-exp-log
div-sub
add-cbrt-cube
flip3--
frac-2neg
clear-num
pow1
expm1-log1p-u
Counts
1 → 18
Calls
1 calls:
Slowest
8.0ms
(/ (- (+ x 4) (* x z)) y)

series27.0ms

Counts
1 → 3
Calls
1 calls:
Slowest
27.0ms
(/ (- (+ x 4) (* x z)) y)

simplify647.0ms

Counts
8 → 21
Calls
8 calls:
Slowest
169.0ms
(- (pow (+ x 4) 3) (pow (* x z) 3))
159.0ms
(- (* (+ x 4) (+ x 4)) (* (* x z) (* x z)))
84.0ms
(- (+ (/ x y) (* 4 (/ 1 y))) (/ (* x z) y))
83.0ms
(- (+ (/ x y) (* 4 (/ 1 y))) (/ (* x z) y))
79.0ms
(- (+ (/ x y) (* 4 (/ 1 y))) (/ (* x z) y))

prune205.0ms

Pruning

4 alts after pruning (1 fresh and 3 done)

Merged error: 0b

regimes125.0ms

Accuracy

0% (1.6b remaining)

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

bsearch2.0ms

end0.0ms

sample1.6s

Algorithm
intervals