Unexpected calculation results

No argument there

I don’t think that will be a good idea. Using allways 64 bit integer will have an impact in performance for 32 bit apps and also a little more memory ussage. And maybe not worth it since 99.9% of the time 32 bit integers are enought for most users.

What can be more interesting is to include the left part pf the expression in the inference process. If now the compiler promotes all the values to that of the most precise type in the expression, like in my example (using one Int64 makes the compiler treat all the operation as Int64 or in the original example, having one double makes the compiler use doubles).

So, if the left side could be included in this process we could have the more expected and intuitive behavior, make the operation with Int64 values if any of the values OR the left part is a Int64 (or double).

Sorry, that is a nonsense argument. That might have been true 20 or 30 years ago, but nowadays the computer spends most of its time waiting for you, and if you don’t have the memory for a few 64bit integers (that is just 4 BYTE more per 32 bit integer) then you have bigger problems.

Seriously? 32 bit integer overflows caused planes to crash - but as it just affects less than 0.1% of the planes it’s not worth it??? :man_facepalming:

I wouldn’t expect anyone to notice the difference.

And Xojo may just limit it to expanding to Int64 on integer multiply.

Well, a int64 operation in a 32bit OS takes at least double CPU time than a in32 operation. For normal use is insignificant, but for those making lot of calculations or real time procesing, it will take at least twice the time/cpu.

you can get an overflow also with an adition… having some operands behave 32bits and others 64 can be even less unexpected/intuitive

Funny. This time you could have used the 99% argument that you wrongly applied before - because THIS time 99% of users won’t notice a speed hit but WILL profit from far far fewer integer overflow errors, plus will get the same result on 32 and 64 bit systems.

Please try to be at least a bit consistent …

1 Like