Commit Graph

35 Commits (14b1418f6a0c76397d0030c548408c56b4031163)

Author SHA1 Message Date
John Benediktsson e256a4ba18 math.intervals: workaround possible compiler bug by widening interval-bitor.
IN: scratchpad [
                   { byte-array } declare
                   [ 0 alien-unsigned-4 32 shift ]
                   [ 4 alien-unsigned-4 ] bi bitor
                   64 >signed
               ] optimized.

! working
[
    dup >R 0 alien-unsigned-4 32 fixnum-shift
    R> 4 alien-unsigned-4 over tag 0 eq?
    [ fixnum-bitor ] [ fixnum>bignum bignum-bitor ] if
    18446744073709551615 >R >bignum R> bignum-bitand
    dup 63 bignum-bit? [ 18446744073709551616 bignum- ] [ ] if
]

! broken
[
    dup >R 0 alien-unsigned-4 32 fixnum-shift
    R> 4 alien-unsigned-4 over tag 0 eq?
    [ fixnum-bitor ] [ fixnum>bignum bignum-bitor ] if
    dup 63 bignum-bit? [ 18446744073709551616 bignum- ] [ ] if
]

The second case correctly eliminates the bitand but incorrectly assumes
that the item on the stack (which is an integer -- either a fixnum or a
bignum), was converted to a bignum.
2019-10-31 10:45:54 -07:00
John Benediktsson bccdb5419b math.intervals: improve interval-bitand. 2019-10-31 10:27:17 -07:00
John Benediktsson 20c4e2feaa math.intervals: remove extra non-interval tests. 2019-10-30 09:47:04 -07:00
timor 30f2d6e78f math.intervals.tests: clean up literal syntax 2019-10-30 09:44:39 -07:00
timor 449224878f math.intervals: more exact interval-bitxor operation
- fixed: `interval-bitxor` caused bit-growth
- improved: `interval-bitxor` more exact case for negative intervals
2019-10-30 09:44:23 -07:00
timor 713cfa79f8 math.intervals: more exact interval-bitor operation
Addresses #2170

- fixed: `interval-bitor` caused bit-growth
- improved: `interval-bitor` more exact about lower bounds

The added utility words could be used as a basis to make the other bitwise
interval operations more exact also.
2019-10-30 09:43:44 -07:00
timor 14d75bbbcb math.intervals: Consistent handling of special intervals
Make both `empty-interval` and `full-interval` singletons, use generic functions
and methods where they are special-cased.

All words which work with interval points should also now work with the special
intervals.
2019-09-09 14:09:57 -07:00
Doug Coleman e189954ecc core: Rename iota to <iota> so we can have TUPLE: iota ... ; instead of TUPLE: iota-tuple ... ; 2017-06-02 11:57:05 -05:00
Doug Coleman 892c62e1dc factor: second stab at [ ] [ ] unit-test -> { } [ ] unit-test 2015-07-03 09:39:59 -07:00
Doug Coleman 59f3b1ea57 Revert "factor: rename [ ] [ ] unit-test -> { } [ ] unit-test using a refactoring tool!"
Needs a bit more work.

This reverts commit 7e54cc2824.
2015-07-02 13:47:06 -07:00
Doug Coleman 7e54cc2824 factor: rename [ ] [ ] unit-test -> { } [ ] unit-test using a refactoring tool! 2015-07-02 11:36:08 -07:00
Doug Coleman 51c033a1f6 Fix all failures in the linux64 build email 2011-10-24 19:33:09 -07:00
Doug Coleman 4c71d71907 random is generic now -- iota random -> random 2010-01-14 12:48:57 -06:00
Slava Pestov df4fb4a3ee Removing integers-as-sequences 2010-01-15 07:15:33 +13:00
Joe Groff 61d579360d remove non-primitive-related uses of tuck from basis 2009-11-05 17:03:24 -06:00
Slava Pestov 2bb6293217 compiler: add fixnum-min/max intrinsics; ~10% speedup on benchmark.yuv-to-rgb 2009-08-28 19:02:59 -05:00
Slava Pestov f82627e736 math.intervals: comment out questionable unit tests 2009-08-22 19:39:32 -05:00
Slava Pestov 81b72cb5c5 Add some unit tests 2009-08-22 17:15:10 -05:00
Slava Pestov 2bc38bf019 math.intervals: tighter interval arithmetic for intervals with infinities 2009-08-19 02:32:18 -05:00
Doug Coleman 7c92ab1ea5 move if-zero etc to math, remove 1-/1+ from math 2009-08-14 14:27:23 -05:00
Slava Pestov 4ecf5a904a More accurate wrap-interval in compiler.tree.propagation.info fixes test regression; constructing an interval with endpoints at infinity now outputs full-interval 2009-08-12 03:25:53 -05:00
Slava Pestov 7bfbb0c5ac math.intervals: fix interval-rem 2009-08-11 16:49:28 -05:00
Slava Pestov 1cb0f3370b math.vectors.specialization: first attempt at some call site splitting for vector ops. Specialized array types generate customized variants of all vector words, if input types are known at compile time, a call to the specialized version is inserted 2009-08-09 03:07:33 -05:00
Slava Pestov 61ea749bb6 More accurate interval-mod and interval-rem 2009-08-08 22:01:12 -05:00
Slava Pestov 3353a777f7 Fixing some unit test failures 2009-04-22 07:05:00 -05:00
Doug Coleman 364ea217ef fix more compiler errors 2009-04-17 14:44:08 -05:00
Slava Pestov 34792a9f23 Remove >r/r> 2008-12-17 19:17:37 -06:00
Slava Pestov 43335d9c36 Intervals now use a special singleton for the full interval to eliminate FP math in the common case; fix a bug in value-info<= 2008-11-11 08:30:14 -06:00
Slava Pestov 751426f283 Remove dead code from math.intervals; we no longer need the operations to support f anymore 2008-11-06 11:57:31 -06:00
Doug Coleman ccdcacfd04 remove unit tests 2008-10-05 16:41:51 -05:00
Doug Coleman ce7cf81224 add more unit tests 2008-10-04 12:45:10 -05:00
Slava Pestov c19f2257f4 Fix permission bits 2008-10-02 08:34:49 -05:00
Slava Pestov 110a5e5162 Change equality semantics 2008-09-02 02:02:05 -05:00
Slava Pestov 6f4af849e5 Fix problem in interval* and interval/ with zero 2008-08-26 00:19:40 -05:00
Slava Pestov d66f887736 Create basis vocab root 2008-07-28 22:03:13 -05:00