Bignum Library

These are some new blocks for dealing for bignums. You can use them and suggest new ones here.

Update 1.0.1

Technically, real numbers are also complex numbers, just as integers are also rational numbers and rational numbers are also real numbers:

This is why we talk about "the Scheme numeric tower"; each layer includes the one above it:

Sorry about my terrible Photoshop skills...

That definition is not the most useful but ok.

Hmm. Do you think an integer isn't a rational number, or are you making a special case for complex numbers?

I am assuming that complex numbers are ones that are not on the integer line on the number plain. where x = real y = imaginary. if the complex part of a number is 0, then it is not considered a complex by my block, because everything being complex is not useful, at least from my perspective.

Ah. Would you feel differently about it if you knew about numbers that aren't complex but are part of a larger collection, such as cardinal numbers, quaternions, Conway numbers, vectors, etc.? (These other kinds of numbers don't form a tower; that is, each kind of number isn't a subset of the next bigger kind.)

hmmm... not really sure, but are all those supported in ?

Vectors are. (That's what hyperblocks do.) Not the others. Very large collections of numbers (such as those that include infinities) don't really lend themselves to practical computations.

One of the big ideas in the Scheme numeric tower is that what programming languages tell users should be mathematically correct. So, for example, to say, as most programming languages do, that 3.0 isn't an integer is just plain wrong. (Or, conversely, to tell them that 3 isn't a real number.) If your language wants to tell you whether something is stored inside the computer in fixed point notation or in floating point notation, then it should say that, and not misuse the words "integer" and "real" respectively.

Similarly, 3 is a complex number, however it's represented and used computationally.

that's what I'm saying

Right, that's fine, but still, you don't want to tell users things that are mathematically untrue. So, for example, is 3+0i a real number? Yes, it is, even though represented in complex format.

So, yes, complex? and number? give the same answer for any input, because any number that's representable in our system at all is complex. You can have a non-real? function, and I agree that that might be useful, but to be in the spirit of the Scheme numeric tower, everything we assert to users should be mathematically correct. And that means talking about the underlying numbers, not about how they're represented in the computer.

But we do have exact? and inexact? which are related to representations. They tell you whether the numeric value in hand is exactly correct. To a first approximation, that distinguishes floating point from integer or exact rational representation, although if we are using the distance from the Earth to the sun in a project and we say it's 93000000 miles, we should really say #i93000000 so that this value, and any value computed using it, will be marked as inexact.