Skip to content

Commit 711a514

Browse files
committed
div sqrt2 regex: Skip unneeded divisibility test; length-=16
This is done for a Step 1 calculation and the "corresponding" one in Step 2, however, in the latter it is unclear why this can be done.
1 parent 30e1176 commit 711a514

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

regex for dividing by sqrt2, with molecular lookahead.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111
(?=
1212
\5
1313
(x(x*)) (?# \7 = floor{N / \4}; \8 = \7-1 )
14-
(?=\7*$)
15-
(?=(\2\3)+$) (?# \9 = \4 - 1 )
16-
\9\8*$
14+
(?=\7*$) (?# we can skip the test for divisibility by \9 because it's guaranteed that \9 <= \7 )
15+
(\2\3)\8*$ (?# \9 = \4 - 1 )
1716
)
1817
(?=
1918
.*
@@ -77,8 +76,7 @@
7776
.*(?=\23$)
7877
(?=\4*(x?(x*)))\24 (?# \24 = M % \4; \25 = \24-1, or 0 if \24==0 )
7978
(x(x*)) (?# \26 = floor{M / \4}; \27 = \26-1 )
80-
(?=\26*$)
81-
(?=\9+$)
79+
(?=\26*$) (?# we can skip the test for divisibility by \9, but I'm not sure why; TODO: figure out why this is )
8280
\9\27*$
8381
)
8482
(?=

0 commit comments

Comments
 (0)