3 ms·
Uses base 10 and stops short of divide. Still, good exercise to go through.
by JonChesterfield 2y ago
Uses base 10 and stops short of divide. Still, good exercise to go through.
- Aardwolf 2y agoI once implemented factorial in a for-fun from-scratch BigNum library (with techniques to speed it up such as collecting prime factors together and multiplying in the order from smallest to largest), and I noticed that computing the factorial of a number like 100000 was faster, than converting the result to decimal for displaying the result So avoiding that conversion can be a use case for using base 10 directly. But there are other use cases where you want it to be binary, the base conversion problem will always be there (unless humanity collectively decides to abandon base 10 and move on to base 16)
- JonChesterfield 2y agoBignum tends to work in base word-size or word-size/2 depending on how good your arch is at overflowing arithmetic. Except for PHP iirc which does actually use base 10 represented in strings.
- WorldMaker 2y agoThere's a lot of interesting arguments that once you get into big numbers you should do big rationals instead of just big decimal division. You can easily include big rationals in an article like this because it just holding two big numbers together (a numerator and a denominator), but the jump to reasoning with rational notation can be a surprising challenge and there's forever the temptation of still wanting to get decimals back out (so you can't entirely ignore decimal division) because most of us don't like to use rational notation/fractions regularly.