Average Error: 8.1 → 0.9
Time: 50.5s
Precision: 64
Internal Precision: 128
\[\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right)\]
\[\begin{array}{l} \mathbf{if}\;F \le -6.18268963321998 \cdot 10^{-135}:\\ \;\;\;\;\pi \cdot \ell - \frac{\frac{1}{\cos \left(\pi \cdot \ell\right) \cdot {F}^{2}}}{\frac{1}{\sin \left(\pi \cdot \ell\right)}}\\ \mathbf{elif}\;F \le 1.4051220143244441 \cdot 10^{-87}:\\ \;\;\;\;\pi \cdot \ell - \frac{1}{(\left(\left(\pi \cdot \frac{-1}{3}\right) \cdot \left(F \cdot F\right)\right) \cdot \ell + \left(\frac{\frac{F}{\pi}}{\frac{\ell}{F}}\right))_*}\\ \mathbf{else}:\\ \;\;\;\;(\left(\tan \left(\pi \cdot \ell\right)\right) \cdot \left(\frac{\frac{-1}{F}}{F}\right) + \left(\pi \cdot \ell\right))_*\\ \end{array}\]

Error

Bits error versus F

Bits error versus l

Derivation

  1. Split input into 3 regimes
  2. if F < -6.18268963321998e-135

    1. Initial program 0.7

      \[\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right)\]
    2. Initial simplification0.7

      \[\leadsto (\left(\tan \left(\pi \cdot \ell\right)\right) \cdot \left(\frac{-1}{F \cdot F}\right) + \left(\pi \cdot \ell\right))_*\]
    3. Taylor expanded around -inf 0.7

      \[\leadsto \color{blue}{\pi \cdot \ell - \frac{\sin \left(\pi \cdot \ell\right)}{{F}^{2} \cdot \cos \left(\pi \cdot \ell\right)}}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity0.7

      \[\leadsto \pi \cdot \ell - \frac{\color{blue}{1 \cdot \sin \left(\pi \cdot \ell\right)}}{{F}^{2} \cdot \cos \left(\pi \cdot \ell\right)}\]
    6. Applied associate-/l*0.7

      \[\leadsto \pi \cdot \ell - \color{blue}{\frac{1}{\frac{{F}^{2} \cdot \cos \left(\pi \cdot \ell\right)}{\sin \left(\pi \cdot \ell\right)}}}\]
    7. Using strategy rm
    8. Applied div-inv0.7

      \[\leadsto \pi \cdot \ell - \frac{1}{\color{blue}{\left({F}^{2} \cdot \cos \left(\pi \cdot \ell\right)\right) \cdot \frac{1}{\sin \left(\pi \cdot \ell\right)}}}\]
    9. Applied associate-/r*0.7

      \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\frac{1}{{F}^{2} \cdot \cos \left(\pi \cdot \ell\right)}}{\frac{1}{\sin \left(\pi \cdot \ell\right)}}}\]

    if -6.18268963321998e-135 < F < 1.4051220143244441e-87

    1. Initial program 36.9

      \[\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right)\]
    2. Initial simplification36.9

      \[\leadsto (\left(\tan \left(\pi \cdot \ell\right)\right) \cdot \left(\frac{-1}{F \cdot F}\right) + \left(\pi \cdot \ell\right))_*\]
    3. Taylor expanded around -inf 35.0

      \[\leadsto \color{blue}{\pi \cdot \ell - \frac{\sin \left(\pi \cdot \ell\right)}{{F}^{2} \cdot \cos \left(\pi \cdot \ell\right)}}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity35.0

      \[\leadsto \pi \cdot \ell - \frac{\color{blue}{1 \cdot \sin \left(\pi \cdot \ell\right)}}{{F}^{2} \cdot \cos \left(\pi \cdot \ell\right)}\]
    6. Applied associate-/l*35.0

      \[\leadsto \pi \cdot \ell - \color{blue}{\frac{1}{\frac{{F}^{2} \cdot \cos \left(\pi \cdot \ell\right)}{\sin \left(\pi \cdot \ell\right)}}}\]
    7. Taylor expanded around 0 36.9

      \[\leadsto \pi \cdot \ell - \frac{1}{\color{blue}{\frac{{F}^{2}}{\pi \cdot \ell} - \frac{1}{3} \cdot \left({F}^{2} \cdot \left(\pi \cdot \ell\right)\right)}}\]
    8. Simplified1.7

      \[\leadsto \pi \cdot \ell - \frac{1}{\color{blue}{(\left(\left(\frac{-1}{3} \cdot \pi\right) \cdot \left(F \cdot F\right)\right) \cdot \ell + \left(\frac{\frac{F}{\pi}}{\frac{\ell}{F}}\right))_*}}\]

    if 1.4051220143244441e-87 < F

    1. Initial program 0.6

      \[\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right)\]
    2. Initial simplification0.6

      \[\leadsto (\left(\tan \left(\pi \cdot \ell\right)\right) \cdot \left(\frac{-1}{F \cdot F}\right) + \left(\pi \cdot \ell\right))_*\]
    3. Using strategy rm
    4. Applied associate-/r*0.6

      \[\leadsto (\left(\tan \left(\pi \cdot \ell\right)\right) \cdot \color{blue}{\left(\frac{\frac{-1}{F}}{F}\right)} + \left(\pi \cdot \ell\right))_*\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \le -6.18268963321998 \cdot 10^{-135}:\\ \;\;\;\;\pi \cdot \ell - \frac{\frac{1}{\cos \left(\pi \cdot \ell\right) \cdot {F}^{2}}}{\frac{1}{\sin \left(\pi \cdot \ell\right)}}\\ \mathbf{elif}\;F \le 1.4051220143244441 \cdot 10^{-87}:\\ \;\;\;\;\pi \cdot \ell - \frac{1}{(\left(\left(\pi \cdot \frac{-1}{3}\right) \cdot \left(F \cdot F\right)\right) \cdot \ell + \left(\frac{\frac{F}{\pi}}{\frac{\ell}{F}}\right))_*}\\ \mathbf{else}:\\ \;\;\;\;(\left(\tan \left(\pi \cdot \ell\right)\right) \cdot \left(\frac{\frac{-1}{F}}{F}\right) + \left(\pi \cdot \ell\right))_*\\ \end{array}\]

Reproduce

herbie shell --seed 2018360 +o rules:numerics
(FPCore (F l)
  :name "VandenBroeck and Keller, Equation (6)"
  (- (* PI l) (* (/ 1 (* F F)) (tan (* PI l)))))

Details

Time bar (total: 15.6s)Debug log

start1.6s

Algorithm
intervals

setup213.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 7.5b

localize29.0ms

Local error

Found 4 expressions with local error:

6.6b
(fma (tan (* PI l)) (/ -1 (* F F)) (* PI l))
5.4b
(tan (* PI l))
0.6b
(/ -1 (* F F))
0.3b
(* PI l)

rewrite11.0ms

Algorithm
rewrite-expression-head
Counts
4 → 43
Calls

4 calls. Slowest were:

4.0ms
(tan (* PI l))
3.0ms
(fma (tan (* PI l)) (/ -1 (* F F)) (* PI l))
1.0ms
(/ -1 (* F F))

series234.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

141.0ms
(fma (tan (* PI l)) (/ -1 (* F F)) (* PI l))
51.0ms
(tan (* PI l))
30.0ms
(* PI l)
11.0ms
(/ -1 (* F F))

simplify883.0ms

Counts
12 → 55
Calls

12 calls. Slowest were:

461.0ms
(- (* PI l) (+ (/ (* PI l) (pow F 2)) (* 1/3 (/ (* (pow PI 3) (pow l 3)) (pow F 2)))))
305.0ms
(+ (* 2/15 (* (pow PI 5) (pow l 5))) (+ (* 1/3 (* (pow PI 3) (pow l 3))) (* PI l)))
50.0ms
(- (* PI l) (/ (sin (* PI l)) (* (pow F 2) (cos (* PI l)))))

prune679.0ms

Pruning

12 alts after pruning (12 fresh and 0 done)

Merged error: 7.0b

localize23.0ms

Local error

Found 4 expressions with local error:

6.3b
(/ (sin (* PI l)) (* (pow F 2) (cos (* PI l))))
5.3b
(sin (* PI l))
5.2b
(cos (* PI l))
0.3b
(* PI l)

rewrite12.0ms

Algorithm
rewrite-expression-head
Counts
4 → 52
Calls

4 calls. Slowest were:

8.0ms
(/ (sin (* PI l)) (* (pow F 2) (cos (* PI l))))
2.0ms
(sin (* PI l))
2.0ms
(cos (* PI l))

series169.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

96.0ms
(/ (sin (* PI l)) (* (pow F 2) (cos (* PI l))))
46.0ms
(* PI l)
15.0ms
(sin (* PI l))
11.0ms
(cos (* PI l))

simplify1.2s

Counts
26 → 64
Calls

26 calls. Slowest were:

382.0ms
(- (+ (* 1/24 (* (pow PI 4) (pow l 4))) 1) (* 1/2 (* (pow PI 2) (pow l 2))))
199.0ms
(- (+ (* 1/120 (* (pow PI 5) (pow l 5))) (* PI l)) (* 1/6 (* (pow PI 3) (pow l 3))))
133.0ms
(- (log (sin (* PI l))) (+ (log (pow F 2)) (log (cos (* PI l)))))

prune936.0ms

Pruning

18 alts after pruning (18 fresh and 0 done)

Merged error: 5.0b

localize20.0ms

Local error

Found 4 expressions with local error:

6.3b
(/ (* (pow F 2) (cos (* PI l))) (sin (* PI l)))
5.3b
(sin (* PI l))
5.2b
(cos (* PI l))
0.3b
(/ 1 (/ (* (pow F 2) (cos (* PI l))) (sin (* PI l))))

rewrite30.0ms

Algorithm
rewrite-expression-head
Counts
4 → 68
Calls

4 calls. Slowest were:

17.0ms
(/ (* (pow F 2) (cos (* PI l))) (sin (* PI l)))
5.0ms
(/ 1 (/ (* (pow F 2) (cos (* PI l))) (sin (* PI l))))
3.0ms
(sin (* PI l))

series250.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

125.0ms
(/ (* (pow F 2) (cos (* PI l))) (sin (* PI l)))
99.0ms
(/ 1 (/ (* (pow F 2) (cos (* PI l))) (sin (* PI l))))
16.0ms
(sin (* PI l))
11.0ms
(cos (* PI l))

simplify2.7s

Counts
36 → 80
Calls

36 calls. Slowest were:

917.0ms
(/ (* (* (* (pow F 2) (cos (* PI l))) (* (pow F 2) (cos (* PI l)))) (* (pow F 2) (cos (* PI l)))) (* (* (sin (* PI l)) (sin (* PI l))) (sin (* PI l))))
406.0ms
(+ (/ (* PI l) (pow F 2)) (* 1/3 (/ (* (pow PI 3) (pow l 3)) (pow F 2))))
318.0ms
(- (/ (pow F 2) (* PI l)) (* 1/3 (* (pow F 2) (* PI l))))

prune1.3s

Pruning

14 alts after pruning (14 fresh and 0 done)

Merged error: 0.8b

localize22.0ms

Local error

Found 4 expressions with local error:

6.3b
(/ (sin (* PI l)) (* (pow F 2) (cos (* (* (cbrt (* PI l)) (cbrt (* PI l))) (cbrt (* PI l))))))
5.3b
(sin (* PI l))
5.2b
(cos (* (* (cbrt (* PI l)) (cbrt (* PI l))) (cbrt (* PI l))))
0.6b
(cbrt (* PI l))

rewrite87.0ms

Algorithm
rewrite-expression-head
Counts
4 → 53
Calls

4 calls. Slowest were:

47.0ms
(/ (sin (* PI l)) (* (pow F 2) (cos (* (* (cbrt (* PI l)) (cbrt (* PI l))) (cbrt (* PI l))))))
35.0ms
(cos (* (* (cbrt (* PI l)) (cbrt (* PI l))) (cbrt (* PI l))))
3.0ms
(sin (* PI l))

series549.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

377.0ms
(cbrt (* PI l))
118.0ms
(/ (sin (* PI l)) (* (pow F 2) (cos (* (* (cbrt (* PI l)) (cbrt (* PI l))) (cbrt (* PI l))))))
28.0ms
(cos (* (* (cbrt (* PI l)) (cbrt (* PI l))) (cbrt (* PI l))))
25.0ms
(sin (* PI l))

simplify1.3s

Counts
27 → 65
Calls

27 calls. Slowest were:

365.0ms
(- (+ (* 1/24 (* (pow PI 4) (pow l 4))) 1) (* 1/2 (* (pow PI 2) (pow l 2))))
178.0ms
(- (+ (* 1/120 (* (pow PI 5) (pow l 5))) (* PI l)) (* 1/6 (* (pow PI 3) (pow l 3))))
141.0ms
(- (log (sin (* PI l))) (+ (log (pow F 2)) (log (cos (* (* (cbrt (* PI l)) (cbrt (* PI l))) (cbrt (* PI l)))))))

prune1.0s

Pruning

16 alts after pruning (16 fresh and 0 done)

Merged error: 0.8b

regimes832.0ms

Accuracy

95.4% (0.3b remaining)

Error of 0.9b against oracle of 0.5b and baseline of 7.7b

bsearch1.5s