By way of a complete diversion, I did produce a *very* high precision package for the QL. All in assembler, very optimised, and/but requiring the precision (in multiples of 16 bit) to be stated in advance (anything from 64 bit up to a ludicrous number of digits). Not IEEE, but close, and easily converted. It took the form of a library that operated on a stack (very similarly to the QL's FP stack and its operations) and a front end to that.
I later converted the whole thing to Delphi, allowing up to 315,643 digit precision, which you can find on my web site. Converting the Pascal to C wouldn't be a huge task, and I might just do that anyway.
The reason I mention it is that it gets to be very inefficient doing every operation as a separate *BASIC call - the call overhead itself will be as great as the computation time (for precisions less that about 256 bit, IIRC).
Certainly it's a bad idea to convert to/from decimal! That typically takes longer than the calculation itself.
Doing the whole thing in decimal strings is not such a bad idea. If anyone is familiar with the "bc" calculator (Linux/*nix), that does it that way, and I used some of its ideas for my calculator. There's already a QL package (via DP) that does this (quickly enough for moderate precision data).
PS. Amongst the tests I did on my calculator's accuracy were verifying that IEEE 64 bit operations on an Intel co-processor actually were correct (!) and matching my computation of pi (two inbuilt special methods and 4*arctan(1)) against various programs that just calculate pi (up to 32K digits). Ie. the code is pretty much stable and correct.
--
Lau
http://www.bergbland.info
Get a domain from http://oneandone.co.uk/xml/init?k_id=5165217 and I'll get the commission!
- Re: [ql-users] Sbasic and n... François Van Emelen
- Re: [ql-users] Sbasic a... Marcel Kilgus
- Re: [ql-users] Sbasic a... Fran�ois Van Emelen
- Re: [ql-users] Sbasic a... P Witte
- Re: [ql-users] Sbasic a... Dave Walker
- Re: [ql-users] Sbasic a... wlenerz
- Re: [ql-users] Sbasic a... Dave Walker
- Re: [ql-users] Sbasic a... P Witte
- Re: [ql-users] Sbasic a... Dave Walker
- Re: [ql-users] Sbasic a... P Witte
- Re: [ql-users] Sbasic a... Lau
- Re: [ql-users] Sbasic a... P Witte
- Re: [ql-users] Sbasic a... TonyTebby
- Re: [ql-users] Sbasic a... Lau
- Re: [ql-users] Sbasic a... TonyTebby
- Re: [ql-users] Sbasic a... P Witte
- Re: [ql-users] Sbasic a... François Van Emelen
- Re: [ql-users] Sbasic and numbers Malcolm Lear
- Re: [ql-users] Sbasic and numbers Fran�ois Van Emelen
- RE: [ql-users] Sbasic and numbers Claude Mourier 00
- Re: [ql-users] Sbasic and numbers Tony Firshman
