On 2017-08-09 11:36, hh via use-livecode wrote:
Mark wrote:
but I'm annoyed that the IDE doesn't give me an overflow warning if I try
to perform an operation on a number that's bigger than 0xFFFFFFFF.
Instead, it just happily trims it down to an unsigned integer and proceeds
to give me a wrong result.

Hey Mark.
Don't complain because *you* are easily able to work around your
"not-reading-the-dictionary" ;-))

From the baseconvert entry of the dictionary:
baseConvert(number, originalBase, destinationBase)
The number must be an integer between zero and 4,294,967,295 (2^32 - 1).

The engine hasn't ever done range checks on integers - mainly because numbers are doubles so (in most ases) you just lose accuracy / precision as the numbers get larger. In this case it *could* because it is actually using integers.

Although, perhaps, baseConvert should be a purely string->string operation - I think that can be done relatively easily without ever having to convert to an integer. This would mean you would be able to base-convert any sized number, although you wouldn't necessarily be able to perform non-precision losing arithmetic operations on the result.

Warmest Regards,


Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

use-livecode mailing list
Please visit this url to subscribe, unsubscribe and manage your subscription 

Reply via email to