Commit Graph

95 Commits (9c7655d286f171956462acf4777228cc84aa53a4)

Author SHA1 Message Date
Jon Harper 3760c965af core.math, bignum/f, shift subnormals before rounding. Fixes #1782 2017-01-23 10:12:20 -08:00
John Benediktsson bd630d1464 math.integers: use must-fail instead of ignore-errors. 2016-07-10 20:28:28 -07:00
Doug Coleman c133c16377 core: Trim using lists from -tests and clean up a few irregularities. 2016-03-30 18:43:41 -07:00
Doug Coleman 00338f62f3 factor: put inline on same line as ; for experimentation 2015-08-10 12:55:27 -05:00
Jon Harper 53efceb0ad math.integers, comment and simplify bignum/f
change the "while" that could only execute once to "when"
change the f/loop word name to "mantissa-and-guard" since it's what it
computes
change the check against 2^53 to be explicit
2015-07-26 12:33:56 -07:00
Jon Harper 5424ad5586 math.integers, bignum/f, improve performance.
This changes avoids looping many times if the denominator is a power of
2. After this change, the implementation matches the linked sbcl
algorithm.  This was probably a mistake done when porting the algorithm.
Basically, as an optimization, all trailing zeros are removed from the
base2 representation of the denominator to have smaller bignums to
divide. But the previous factor implementation didn't take this into
account when making the initial guess of the shift of the numerator to
obtain a result in the range [2^54-1,2^53]. The loop would then correct
the initial guess by a factor of 2 at each iteration, so it would run as
many iteration as the denominator base2 power reduction, instead of only
a few times. For pathological cases, the speed up is huge (10^4):
1 1000 2^ bignum/f
2015-07-26 12:33:55 -07:00
Jon Harper cc6d90a096 math.integers, fix bignum/f for results in ]0x1.0p-1022,0x0.4p-1022] 2015-07-26 12:33:55 -07:00
John Benediktsson 89e3cc511e math: moving >fraction to math. 2015-07-19 16:57:45 -07:00
Doug Coleman 43d6f1d3e2 factor: Retrying on the unit tests. Also normalize some syntax with FUNCTION:. 2015-07-02 17:28:17 -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 69ee8b9190 core, basis: Don't use the IN: foo.private feature and undocument it.
It only works well when you are loading code dynamically.
2015-06-30 08:51:07 -07:00
John Benediktsson 7dfe023854 math.integers: add some more tests for bit?. 2015-06-17 20:23:21 -07:00
John Benediktsson 621b50a8e5 cpu: enable bit-test intrinsic for fixnum-bit?. 2015-06-17 19:11:10 -07:00
John Benediktsson db9cfeeae2 math.integers: simplify fixnum-bit?. 2015-06-17 18:42:11 -07:00
John Benediktsson ed786070e2 math.integers: fixnum-bit? should not use fixnum-shift-fast. 2015-06-17 08:22:00 -07:00
John Benediktsson d60d098c11 math.integers: speedup to fixnum-bit?. 2015-06-07 11:08:57 -07:00
John Benediktsson eeaa91d6c1 vm: using bignum>fixnum-strict in integer>fixnum-strict. 2014-06-07 09:46:05 -07:00
John Benediktsson 57f9d78892 improve help by linking to types directly. 2014-05-23 20:20:15 -07:00
John Benediktsson 5487480126 core: cleanup USING lists. 2013-03-05 10:34:47 -08:00
John Benediktsson 6d679cf3a2 math.integers: the fixnum-log2 intrinsic didn't work due to inlining. 2013-02-27 17:08:36 -08:00
John Benediktsson 7ba77673a8 math.integers: faster fixnum-log2. 2013-02-27 16:01:34 -08:00
John Benediktsson 34aab78998 math.integers: fix docs for fixnum comparisons. 2012-09-21 10:05:33 -07:00
John Benediktsson eaed0db99a Revert "math: speed up integer>fixnum operations."
This reverts commit b467db9a9a.
2012-09-16 07:46:22 -07:00
John Benediktsson 6ea9c0fc02 math: speed up integer>fixnum operations. 2012-09-15 08:52:06 -07:00
John Benediktsson 159f5d6344 math.integers: fix docs for >integer. 2012-09-15 08:51:19 -07:00
John Benediktsson 089bdb1268 math.integers: inline fixnum-log2. 2012-09-10 17:20:12 -07:00
John Benediktsson 20100d7853 math.integers: faster fixnum-bit?. 2012-08-30 22:40:22 -07:00
Doug Coleman cd9dd9d752 core: Throw an error when assigning a bignum to a fixnum tuple slot if the bignum doesn't fit. Fixes #594. 2012-08-03 14:59:59 -07:00
Doug Coleman 6994b0eed8 math.integers: Bignum hashcode* -- call bignum>fixnum to avoid a dispatch. 2012-07-23 09:38:12 -07:00
Doug Coleman fb4e3ad9bc compiler: Fix bitand on ratios, floats. Fix shift on ratios, floats. Add integer>fixnum. Fixes #500. 2012-07-23 09:31:12 -07:00
Joe Groff 98fc1e28bd math.integers: make bignum/f round to even on tie
Fixes #372
2011-11-26 17:44:29 -08:00
Joe Groff 0f5b551790 math.integers: pass tests even if number-base set 2011-11-26 17:37:17 -08:00
Joe Groff 269fe9ea1a math.integers: test round-to-even-on-tie behavior 2011-11-26 16:03:43 -08:00
Joe Groff 90f34d092c math: neg? needs to be defined for all reals 2011-11-26 15:37:58 -08:00
Joe Groff 4e8a1d0bb4 math: add neg? word
Do the right thing with integers or floats
2011-11-23 19:51:05 -08:00
Joe Groff 943596575a use radix literals 2011-11-23 19:03:40 -08:00
Doug Coleman 4ebe5218c7 Update Windows for word renames, fix lint errors 2011-10-24 21:50:02 -07:00
John Benediktsson 5a943b32c4 Remove stack effects from HELP: declarations. 2011-10-20 19:36:11 -07:00
John Benediktsson afc07c0e05 io.binary: make le> and be> faster (20% and 75%, respectively).
Removed primitive byte-array>bignum and digit_stream_to_bignum from vm/.
2011-10-11 21:13:30 -07:00
Slava Pestov bb4529bff2 math.integers: fix underflow and overflow behavior 2010-12-18 16:00:17 -08:00
Slava Pestov f27080498d Remove bignum>float VM primitive, and use bignum/f to implement >float on bignums instead, for a slight accuracy gain. Also, bignum/f now has a more efficient post-scaling algorithm to break the circular dependency on bignum>float 2010-11-24 22:41:15 -08:00
Slava Pestov 0c840a7965 math.integers: bignum/f rounding was wrong (reported by Joe Groff) 2010-11-13 16:02:12 -08:00
Slava Pestov 65dcd56b0b math.integers: fix 0 0 bignum/f (reported by Joe Groff) 2010-11-12 19:49:18 -08:00
Slava Pestov 1c9a95122a math.integers: remove a -rot usage 2010-02-10 15:44:49 +13:00
Daniel Ehrenberg 52f2ac2bb9 Tests for propagation additions; making fixnum-bit? inline 2010-01-25 20:15:17 -06:00
Daniel Ehrenberg d3590ea210 Merge branch 'master' of git://factorcode.org/git/factor
Conflicts:

	basis/compiler/tree/propagation/transforms/transforms.factor
2010-01-20 00:15:55 -06:00
Daniel Ehrenberg aa1651032d Adding compiler transforms in propagation 2010-01-20 00:10:49 -06: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