Average Error: 14.3 → 0.3
Time: 25.9s
Precision: 64
Internal Precision: 128
\[\left(\frac{\pi}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right)\]
\[\frac{\frac{1}{\frac{2 \cdot a}{\pi}} - \frac{\pi}{b \cdot 2}}{b - a} \cdot \frac{1}{a + b}\]

Error

Bits error versus a

Bits error versus b

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 14.3

    \[\left(\frac{\pi}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right)\]
  2. Simplified9.7

    \[\leadsto \color{blue}{\frac{(\left(\frac{\pi}{2}\right) \cdot \left(\frac{-1}{b}\right) + \left(\frac{\frac{\pi}{2}}{a}\right))_*}{\left(a + b\right) \cdot \left(b - a\right)}}\]
  3. Using strategy rm
  4. Applied *-un-lft-identity9.7

    \[\leadsto \frac{\color{blue}{1 \cdot (\left(\frac{\pi}{2}\right) \cdot \left(\frac{-1}{b}\right) + \left(\frac{\frac{\pi}{2}}{a}\right))_*}}{\left(a + b\right) \cdot \left(b - a\right)}\]
  5. Applied times-frac0.3

    \[\leadsto \color{blue}{\frac{1}{a + b} \cdot \frac{(\left(\frac{\pi}{2}\right) \cdot \left(\frac{-1}{b}\right) + \left(\frac{\frac{\pi}{2}}{a}\right))_*}{b - a}}\]
  6. Simplified0.3

    \[\leadsto \frac{1}{a + b} \cdot \color{blue}{\frac{\frac{\pi}{a \cdot 2} - \frac{\pi}{2 \cdot b}}{b - a}}\]
  7. Using strategy rm
  8. Applied clear-num0.3

    \[\leadsto \frac{1}{a + b} \cdot \frac{\color{blue}{\frac{1}{\frac{a \cdot 2}{\pi}}} - \frac{\pi}{2 \cdot b}}{b - a}\]
  9. Final simplification0.3

    \[\leadsto \frac{\frac{1}{\frac{2 \cdot a}{\pi}} - \frac{\pi}{b \cdot 2}}{b - a} \cdot \frac{1}{a + b}\]

Reproduce

herbie shell --seed 2019010 +o rules:numerics
(FPCore (a b)
  :name "NMSE Section 6.1 mentioned, B"
  (* (* (/ PI 2) (/ 1 (- (* b b) (* a a)))) (- (/ 1 a) (/ 1 b))))

Details

Time bar (total: 25.3s)Debug log

sample92.0ms

Algorithm
intervals

simplify376.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
376.0ms
(* (* (/ PI 2) (/ 1 (- (* b b) (* a a)))) (- (/ 1 a) (/ 1 b)))

prune11.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 11.2b

localize32.0ms

Local error

Found 3 expressions with local error:

11.3b
(/ (fma (/ PI 2) (/ -1 b) (/ (/ PI 2) a)) (* (+ a b) (- b a)))
0.2b
(/ (/ PI 2) a)
0.2b
(fma (/ PI 2) (/ -1 b) (/ (/ PI 2) a))

rewrite9.0ms

Algorithm
rewrite-expression-head
Rules
associate-/r/
add-exp-log
add-cbrt-cube
associate-/l*
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
frac-times
add-log-exp
flip--
div-inv
log1p-expm1-u
flip-+
flip3--
times-frac
flip3-+
pow1
expm1-log1p-u
associate-*r/
associate-*l/
div-exp
frac-2neg
clear-num
cbrt-undiv
associate-/l/
fma-udef
cbrt-unprod
prod-exp
associate-/r*
Counts
3 → 58
Calls
3 calls:
Slowest
6.0ms
(/ (fma (/ PI 2) (/ -1 b) (/ (/ PI 2) a)) (* (+ a b) (- b a)))
2.0ms
(/ (/ PI 2) a)
0.0ms
(fma (/ PI 2) (/ -1 b) (/ (/ PI 2) a))

series245.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
111.0ms
(/ (fma (/ PI 2) (/ -1 b) (/ (/ PI 2) a)) (* (+ a b) (- b a)))
75.0ms
(/ (/ PI 2) a)
59.0ms
(fma (/ PI 2) (/ -1 b) (/ (/ PI 2) a))

simplify2.0s

Counts
32 → 67
Calls
32 calls:
Slowest
318.0ms
(* (+ (* a a) (- (* b b) (* a b))) (+ (* b b) (+ (* a a) (* b a))))
297.0ms
(- (log (fma (/ PI 2) (/ -1 b) (/ (/ PI 2) a))) (log (* (+ a b) (- b a))))
173.0ms
(/ (* (* (fma (/ PI 2) (/ -1 b) (/ (/ PI 2) a)) (fma (/ PI 2) (/ -1 b) (/ (/ PI 2) a))) (fma (/ PI 2) (/ -1 b) (/ (/ PI 2) a))) (* (* (* (+ a b) (+ a b)) (+ a b)) (* (* (- b a) (- b a)) (- b a))))
147.0ms
(* (- a b) (+ (* b b) (+ (* a a) (* b a))))
146.0ms
(/ (* (* (fma (/ PI 2) (/ -1 b) (/ (/ PI 2) a)) (fma (/ PI 2) (/ -1 b) (/ (/ PI 2) a))) (fma (/ PI 2) (/ -1 b) (/ (/ PI 2) a))) (* (* (* (+ a b) (- b a)) (* (+ a b) (- b a))) (* (+ a b) (- b a))))

prune1.1s

Pruning

10 alts after pruning (10 fresh and 0 done)

Merged error: 0.0b

localize44.0ms

Local error

Found 4 expressions with local error:

0.3b
(/ PI (* 2 b))
0.2b
(/ PI (* a 2))
0.2b
(/ (- (/ PI (* a 2)) (/ PI (* 2 b))) (- b a))
0.2b
(* (/ 1 (+ a b)) (/ (- (/ PI (* a 2)) (/ PI (* 2 b))) (- b a)))

rewrite41.0ms

Algorithm
rewrite-expression-head
Rules
40×*-un-lft-identity
40×add-sqr-sqrt
36×times-frac
26×add-cube-cbrt
24×associate-*r*
19×div-inv
16×add-exp-log
14×distribute-lft-out--
11×add-cbrt-cube
difference-of-squares
associate-/l*
associate-/r/
associate-*l*
pow1
associate-/r*
add-log-exp
log1p-expm1-u
prod-exp
expm1-log1p-u
associate-/l/
flip--
div-exp
flip3--
frac-2neg
clear-num
cbrt-unprod
rec-exp
cbrt-undiv
flip-+
frac-sub
*-commutative
associate-*r/
associate-*l/
pow-prod-down
div-sub
flip3-+
frac-times
Counts
4 → 123
Calls
4 calls:
Slowest
23.0ms
(/ (- (/ PI (* a 2)) (/ PI (* 2 b))) (- b a))
11.0ms
(* (/ 1 (+ a b)) (/ (- (/ PI (* a 2)) (/ PI (* 2 b))) (- b a)))
5.0ms
(/ PI (* 2 b))
1.0ms
(/ PI (* a 2))

series382.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
126.0ms
(* (/ 1 (+ a b)) (/ (- (/ PI (* a 2)) (/ PI (* 2 b))) (- b a)))
91.0ms
(/ PI (* 2 b))
91.0ms
(/ PI (* a 2))
73.0ms
(/ (- (/ PI (* a 2)) (/ PI (* 2 b))) (- b a))

simplify5.2s

Counts
101 → 135
Calls
101 calls:
Slowest
288.0ms
(- (pow (/ PI (* a 2)) 3) (pow (/ PI (* 2 b)) 3))
259.0ms
(+ (log (/ 1 (+ a b))) (log (/ (- (/ PI (* a 2)) (/ PI (* 2 b))) (- b a))))
234.0ms
(/ (* (* (- (/ PI (* a 2)) (/ PI (* 2 b))) (- (/ PI (* a 2)) (/ PI (* 2 b)))) (- (/ PI (* a 2)) (/ PI (* 2 b)))) (* (* (- b a) (- b a)) (- b a)))
182.0ms
(- (* (/ PI (* a 2)) (/ PI (* a 2))) (* (/ PI (* 2 b)) (/ PI (* 2 b))))
170.0ms
(* (* (* (/ 1 (+ a b)) (/ 1 (+ a b))) (/ 1 (+ a b))) (/ (* (* (- (/ PI (* a 2)) (/ PI (* 2 b))) (- (/ PI (* a 2)) (/ PI (* 2 b)))) (- (/ PI (* a 2)) (/ PI (* 2 b)))) (* (* (- b a) (- b a)) (- b a))))

prune1.4s

Pruning

9 alts after pruning (9 fresh and 0 done)

Merged error: 0b

localize27.0ms

Local error

Found 4 expressions with local error:

0.3b
(/ 1 (/ (* a 2) PI))
0.3b
(/ PI (* 2 b))
0.3b
(/ (* a 2) PI)
0.2b
(/ (- (/ 1 (/ (* a 2) PI)) (/ PI (* 2 b))) (- b a))

rewrite22.0ms

Algorithm
rewrite-expression-head
Rules
28×*-un-lft-identity
24×add-sqr-sqrt
18×times-frac
16×add-cube-cbrt
div-inv
distribute-lft-out--
associate-/r*
associate-/l*
add-exp-log
add-cbrt-cube
pow1
difference-of-squares
add-log-exp
log1p-expm1-u
frac-2neg
clear-num
expm1-log1p-u
associate-/l/
associate-/r/
flip--
flip3--
inv-pow
pow-flip
frac-sub
div-exp
div-sub
rec-exp
cbrt-undiv
Counts
4 → 93
Calls
4 calls:
Slowest
12.0ms
(/ (- (/ 1 (/ (* a 2) PI)) (/ PI (* 2 b))) (- b a))
4.0ms
(/ PI (* 2 b))
2.0ms
(/ (* a 2) PI)
2.0ms
(/ 1 (/ (* a 2) PI))

series289.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
88.0ms
(/ (* a 2) PI)
80.0ms
(/ 1 (/ (* a 2) PI))
67.0ms
(/ (- (/ 1 (/ (* a 2) PI)) (/ PI (* 2 b))) (- b a))
54.0ms
(/ PI (* 2 b))

simplify7.5s

Counts
67 → 105
Calls
67 calls:
Slowest
642.0ms
(- (* 1 (* 2 b)) (* (/ (* a 2) PI) PI))
629.0ms
(- (pow (/ 1 (/ (* a 2) PI)) 3) (pow (/ PI (* 2 b)) 3))
496.0ms
(/ (- (/ 1 (/ (* a 2) PI)) (/ PI (* 2 b))) (- b a))
399.0ms
(/ (- (/ 1 (/ (* a 2) PI)) (/ PI (* 2 b))) (- b a))
399.0ms
(/ (- (/ 1 (/ (* a 2) PI)) (/ PI (* 2 b))) (- b a))

prune1.3s

Pruning

9 alts after pruning (8 fresh and 1 done)

Merged error: 0b

localize19.0ms

Local error

Found 4 expressions with local error:

0.7b
(/ PI (* a b))
0.2b
(* (/ 1 (+ a b)) (* 1/2 (/ PI (* a b))))
0.0b
(/ 1 (+ a b))
0.0b
(* 1/2 (/ PI (* a b)))

rewrite8.0ms

Algorithm
rewrite-expression-head
Rules
add-exp-log
add-cube-cbrt
*-un-lft-identity
pow1
add-sqr-sqrt
associate-*l*
add-cbrt-cube
associate-*r*
add-log-exp
div-inv
log1p-expm1-u
associate-/r/
associate-*r/
associate-/r*
expm1-log1p-u
flip-+
*-commutative
prod-exp
flip3-+
frac-2neg
clear-num
rec-exp
inv-pow
pow-flip
cbrt-unprod
associate-*l/
pow-prod-down
frac-times
Counts
4 → 72
Calls
4 calls:
Slowest
5.0ms
(* (/ 1 (+ a b)) (* 1/2 (/ PI (* a b))))
1.0ms
(* 1/2 (/ PI (* a b)))
1.0ms
(/ 1 (+ a b))
0.0ms
(/ PI (* a b))

series156.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
68.0ms
(* (/ 1 (+ a b)) (* 1/2 (/ PI (* a b))))
40.0ms
(* 1/2 (/ PI (* a b)))
27.0ms
(/ 1 (+ a b))
21.0ms
(/ PI (* a b))

simplify1.8s

Counts
36 → 84
Calls
36 calls:
Slowest
379.0ms
(* 1 (* 1/2 (/ PI (* a b))))
348.0ms
(+ (log (/ 1 (+ a b))) (log (* 1/2 (/ PI (* a b)))))
226.0ms
(+ (- (log (+ a b))) (log (* 1/2 (/ PI (* a b)))))
176.0ms
(* (* (* (/ 1 (+ a b)) (/ 1 (+ a b))) (/ 1 (+ a b))) (* (* (* 1/2 (/ PI (* a b))) (* 1/2 (/ PI (* a b)))) (* 1/2 (/ PI (* a b)))))
130.0ms
(* (/ 1 (+ a b)) (* 1/2 (/ PI (* a b))))

prune646.0ms

Pruning

7 alts after pruning (6 fresh and 1 done)

Merged error: 0b

regimes114.0ms

Accuracy

0% (0.3b remaining)

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

bsearch4.0ms

end0.0ms

sample2.5s

Algorithm
intervals