News for hackers. Stuff that matters.
Re:Common Lisp: Numbers by gjm11 on Friday June 14, 2019 @02:24PM (#20185368)
Unfortunately, most infinite-precision real-number implementations (including the one here, I bet, but I haven't checked) will not recognize that you're dividing something by itself. So you'll get a super-inefficient implementation of the number 1 :-).

[EDITED to add:] I checked; the implementation here indeed won't recognize that you're dividing something by itself. For the avoidance of doubt, nor do I think trying to recognize such things would be an improvement.

(Also, if you ask for e.g. the digit immediately preceding the decimal point, you will wait for ever because no amount of precision will enable the implementation to tell whether your number is just less than 1 or 1 or just over. So don't ask it for that, ask it for a very close approximation and draw your own conclusions.)

Re:Common Lisp: Numbers by reikonomusha on Friday June 14, 2019 @03:52PM (#20186159)
The notion of "by itself" is dubious in this context at best. You can only check up to finite precision that two numbers are equal. For something more, you need computer algebra, which is a tall order.

Even if you have computer algebra, math says it's not possible to check that arbitrary expressions are equal. It's an undecidable problem. So with that, I don't fault a computable reals package not being able to detect that x == y in an expression x/y.

Re:Common Lisp: Numbers by gjm11 on Friday June 14, 2019 @06:30PM (#20187188)
You can imagine an infinite-precision-real package that checks whether numerator and denominator are the exact same object and optimizes that case away.

(And I wonder idly from time to time about making one that does know a bit about some particularly nice classes of number -- e.g., algebraic numbers -- and does all the things you'd like it to as long as you stay within such a class. Obviously as soon as you ask it for sqrt(2)+pi all that would go out the window.)

Re:Common Lisp: Numbers by jjnoakes on Friday June 14, 2019 @02:26PM (#20185387)
Also note that dividing something by itself is not necessarily 1.
Re:Common Lisp: Numbers by jgalt212 on Friday June 14, 2019 @03:18PM (#20185870)
I dunno, I think 0/0 is 1, but I cannot be sure.

https://www.wolframalpha.com/input/?i=lim+x%2Fx+as+x-%3E0

Re:Common Lisp: Numbers by jolmg on Friday June 14, 2019 @03:30PM (#20185974)
You can say 0/0 is 1, but it's also 2 and 3 and every other number, since x*0=0 for any x. That's why it's undefined.
Re:Common Lisp: Numbers by all2 on Friday June 14, 2019 @06:22PM (#20187136)
Could we define it as a one to many function that maps from 0/0 to the set of all Complex numbers?

If 0/0 = Q, then

0 = 0 × Q. So, we get to define this operation. If we treat 0 as an integer, then we could treat Q (a set) like a 1 x inf. matrix and we have scalar multiplication.

But

0 × Q = [0]' × Q

So 0 can be an infinite set of 0. This is cyclical, I know. This cyclical nature leads to an interesting effect if we also define integer division. Try this around 0 in Q.

We could also define the × as an inner (dot) product, or as a cross product.

This is fun!

Re:Common Lisp: Numbers by ngcc_hk on Friday June 14, 2019 @09:45PM (#20187956)
Is there a number set larger than a complex number? If so you can’t map to any concrete thing as it is really anything.

And I guess it is easy to define one more dimension of number.