On 2017-08-09 19:15, Bob Sneidar via use-livecode wrote:
OIC. I was under the impression that the C math libraries deal with
numbers of high precision better than Livecode does, perhaps
themselves generating errors on overflow. Maybe that is not the case.
C itself does no error checking/bounds checking at all. It is only
relatively recently that compiler intrinsics have been available on all
platforms we support which would allow an overflow check to be done
efficiently (access to the carry flag).
Now, that would be fine if we used integers - which we don't - we use
Of course, the IEEE standard has long had in it the 'exceptions' model
for detecting overflow/inexactness and such - however using *that* to
efficiently do anything is nigh-on impossible universally. Performance
of using the FP exceptions (even non-signalling) is highly variable
across processor models and OS combinations.
Ideally LiveCode would use decimal arithmetic everywhere from the
outside at least (with a fixed controllable precision - number of digits
after the decimal point - for anything 'inexact'), and internally use
infinite precision integers when there is nothing after the decimal
point. That's more an engineering problem in terms of ensuring that in
moving to such a model, performance of numeric operations (in general)
does not decrease too much (there would be an overhead, its just trying
to minimise it which causes all the hard work).
Generally C math libraries are infinite precision or nothing - although
IBM has some nifty IEEE Decimal emulation code out in the wild blending
that with other numeric representations is still not an easy task.
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