[Gambas-user] Infinities and division

Benoit Minisini benoit.minisini at gambas-basic.org
Wed Nov 30 00:10:55 CET 2022


Le 29/11/2022 à 23:59, BB a écrit :
> 
> On 30/11/22 9:01 am, Jussi Lahtinen wrote:
>>
>>     Mathematically, from the "Infinite Hotel" story,
>>
>>          infinity <> infinity.
>>
>>
>> No, in Hilbert's hotel there is only one sized infinity (countably 
>> infinite set, example natural numbers and integers).
>> It just demonstrates the counterintuitive property of it.  However 
>> there are different sizes of infinity, for example the set of real 
>> numbers is uncountably infinite. IE set of integers and set of real 
>> numbers are different in size, but set of integers and set of natural 
>> numbers are the same size.
> Oh, OK. I don't really understand it as I said.
>>
>>     But, in Gambas
>>
>>          +Inf = +Inf
>>
>>     should be true as +Inf is not really "infinity", It's a constant
>>     representing "a very big number". Otherwise, the constant is
>>     generally
>>     useless.
>>
>>
>> Yes, that is true as it is the same constant in both sides of the 
>> equation. However that does not correspond to the mathematical concept 
>> (it's not a number) of infinity.
>> And it should not be used in arithmetics, only for some conditionals 
>> if at all.
>>
>>
> No, I think we do need some arithmetics:
> 
> If ( +-Inf + X ) = +Inf = ' -> true, no matter if X is real or natural 
> but if X = +Inf?
> 
> If ( +-Inf - X ) = +-Inf ' -> true, no matter if X is real or natural 
> but if X = +-Inf?
> 
> if ( +-Inf * X ) = +-Inf '-> true, no matter if X is real or natural, 
> and possibly if X = +-Inf
> 
> if ( +-Inf / X ) '-> "Improper Infinites Error"
> 
> If ( X / +-Inf ) '-> "Improper Infinites Error"
> 
> If ( +-Inf ^ X ) '-> I dont know
> 
> if ( X ^ = +-Inf ) '-> I dont know
> 
> and there are some debatable points such as -Inf + +Inf hinted at above. 
> There may be others, Sin(+-Inf)? etc and why btw does Tan(Rad(90)) 
> return 1.63312393531954E+16 ?
> 
> I also note that CInt( +-Inf) does return a valid integer, which is fine 
> and good for my current purposes.
> 
> This topic is bigger than I thought.
> 
> regards
> 
> bruce

All you see in Gambas is actually handled by the CPU and is based on the 
IEEE 754 standard (which defines these infinities things). So I don't 
think it will change.

Regards,

-- 
Benoît Minisini.



More information about the User mailing list