Re: [ql-users] Sbasic and numbers

2003-03-16 Thread TonyTebby
myself! Tony Tebby - Original Message - From: Dave Walker [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: samedi 15 mars 2003 00:06 Subject: Re: [ql-users] Sbasic and numbers

Re: [ql-users] Sbasic and numbers

2003-03-16 Thread P Witte
TonyTebby writes: No need for fancy modifications - the SBASIC arithmetic routines already check the types of the variables involved in calculations and do different operations for integers and floats. All you need to do is detect string{+-*/}string and do string arithmetic with string

Re: [ql-users] Sbasic and numbers

2003-03-16 Thread Lau
PS. Out of interest, I thought I'd see how long my calculator takes to calculate pi. On my P1.7, it does it to 31567 digits in just under a minute (58.33s), and (leaving it running overnight) it took 10 hours, 10 minutes and 50 seconds to do it to its maximum precision of 315643 digits. I

Re: [ql-users] Sbasic and numbers

2003-03-14 Thread Franois Van Emelen
Hi Per, Thanks for your reply. Regards, Franois Van Emelen P Witte wrote: Franois Van Emelen writes: snip Use a string variable in DBAS instead of a float and use the sort of routines I described to do the calculations. Didnt someone write an IEEE fp (64 or 80 bit) emulation package for the QL?

Re: [ql-users] Sbasic and numbers

2003-03-14 Thread wlenerz
On 14 Mar 2003 at 7:35, Dave Walker wrote: The hardest part will be to get agreement on the SB interface needed to support what is wanted. Probably the best would be to have functions to which pass the numbers as strings to/from the package (eg result$=HP_ADD (number1$,number2$)). The

Re: [ql-users] Sbasic and numbers

2003-03-14 Thread Tony Firshman
On Thu, 13 Mar 2003 at 23:55:51, P Witte wrote: (ref: [EMAIL PROTECTED]) Tony Firshman writes: Monetary calculations normally only require the four basic operations, add, subtract, multiply and divide. Surely two only - addition and subtraction? Multiplication and division are shorthand for

Re: [ql-users] Sbasic and numbers

2003-03-14 Thread Dave Walker
. Dave - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, March 14, 2003 8:35 AM Subject: Re: [ql-users] Sbasic and numbers On 14 Mar 2003 at 7:35, Dave Walker wrote: The hardest part will be to get agreement on the SB interface needed to support

Re: [ql-users] Sbasic and numbers

2003-03-14 Thread P Witte
Tony Firshman writes: I once had an old mechanical calculating machine, given to me by my grandfather to play with when the bank he worked for upgraded to electro-mechanical ones. I later used it for my homework, the only kid at school with access to a calculator, (something I had to keep

Re: [ql-users] Sbasic and numbers

2003-03-14 Thread P Witte
Dave Walker writes: If there really is a need for these extra precision routines to be available from SB, then maybe it would be worth writing SB wrappers for the maths support routines used by c68? These include support for IEEE 32,64 and 80 bit, and also for 64 bit integers with

Re: [ql-users] Sbasic and numbers

2003-03-14 Thread Dave Walker
2) Internal coercion within the package, eg result$ = HP_ADD(fp64$, fp80$) or even result$ = HP_ADD(int64$, qdosfp) This would probably be the way to go. Less likely to get user error that way. As the strings would be opaque data from the programmers perspective it would be easy to

Re: [ql-users] Sbasic and numbers

2003-03-13 Thread P Witte
Franois Van Emelen writes: It is not too difficult to write your own fixed or floating point routines in Basic using basic school maths, but they would be relatively slow. (The book Mathematics on the Sinclair QL, by Czes Kosniowski (out of print) might provide a suitable starting

RE: [ql-users] Sbasic and numbers

2003-03-13 Thread Claude Mourier 00
?) Claude -Message d'origine- De : P Witte [mailto:[EMAIL PROTECTED] Envoy : jeudi 13 mars 2003 11:21 : [EMAIL PROTECTED] Objet : Re: [ql-users] Sbasic and numbers Franois Van Emelen writes: It is not too difficult to write your own fixed or floating point routines in Basic using

Re: [ql-users] Sbasic and numbers

2003-03-13 Thread Tony Firshman
On Thu, 13 Mar 2003 at 10:20:57, P Witte wrote: (ref: [EMAIL PROTECTED]) François Van Emelen writes: It is not too difficult to write your own fixed or floating point routines in Basic using basic school maths, but they would be relatively slow. (The book Mathematics on the Sinclair QL,

Re: [ql-users] Sbasic and numbers

2003-03-13 Thread Marcel Kilgus
François Van Emelen wrote: And here comes my original question again: Is there a way to get the original value. No. As I already said, FP does not have enough precision. A FP value just cannot hold 12345678.55. Again: never store currency values as a FP value. A FP value could by the way

Re: [ql-users] Sbasic and numbers

2003-03-13 Thread P Witte
Tony Firshman writes: Monetary calculations normally only require the four basic operations, add, subtract, multiply and divide. Surely two only - addition and subtraction? Multiplication and division are shorthand for addition/subtraction in my book. ... or am I being too simplistic. It all

Re: [ql-users] Sbasic and numbers

2003-03-13 Thread P Witte
Franois Van Emelen writes: Thank you for your 'ADD$' function, but it doesn't solve my problem. I'll rephrase my question with a concrete example: A DBAS-file is open. One of the fields is of type 3 (floating point) The user wants to update that field. That could be done with something

Re: [ql-users] Sbasic and numbers

2003-03-13 Thread Dave Walker
is wanted. Dave - Original Message - From: P Witte [EMAIL PROTECTED] To: [EMAIL PROTECTED] [EMAIL PROTECTED] Sent: Friday, March 14, 2003 12:11 AM Subject: Re: [ql-users] Sbasic and numbers Franois Van Emelen writes: Thank you for your 'ADD$' function, but it doesn't solve my problem

Re: [ql-users] Sbasic and numbers

2003-03-12 Thread Franois Van Emelen
P Witte wrote: Yes, the Psion suite has its own fp routines (more precision (14 (16) digits) but less magnitude). It is not too difficult to write your own fixed or floating point routines in Basic using basic school maths, but they would be relatively slow. (The book Mathematics on the

Re: [ql-users] Sbasic and numbers

2003-03-12 Thread Franois Van Emelen
Norman Dunbar wrote: Morning Franois, snip QDOSMSQ's main problem , as you have found, is not so much the range of numbers that can be represented, but the way that the software displays it. I'm sure some of the procedure wriuters amongst us, who understand these floating point things (I don't

Re: [ql-users] Sbasic and numbers

2003-03-12 Thread wlenerz
QDOSMSQ's main problem , as you have found, is not so much the range of numbers that can be represented, but the way that the software displays it. I'm sure some of the procedure wriuters amongst us, who understand these floating point things (I don't !), could write a routine to take in

Re: [ql-users] Sbasic and numbers

2003-03-12 Thread Geogwilt
In a message dated 11/03/03 03:40:54 GMT Standard Time, [EMAIL PROTECTED] writes: As a final digression, I've always bemoaned the fact that floating point is only allowed a twelve bit exponent. It could have gone for 15 bits, which would have reduced the overall code and increased the speed!

RE: [ql-users] Sbasic and numbers

2003-03-12 Thread Claude Mourier 00
3 or 6 bytes ? -Message d'origine-De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]Envoy: mercredi 12 mars 2003 16:00: [EMAIL PROTECTED]Objet: Re: [ql-users] Sbasic and numbersIn a message dated 11/03/03 03:40:54 GMT Standard Time, [EMAIL PROTECTED] writes: As a final

RE: [ql-users] Sbasic and numbers

2003-03-12 Thread Norman Dunbar
Mourier 00 [mailto:[EMAIL PROTECTED]Sent: Wednesday, March 12, 2003 3:03 PMTo: '[EMAIL PROTECTED]'Subject: RE: [ql-users] Sbasic and numbers 3 or 6 bytes ? -Message d'origine-De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]Envoyé: mercredi 12 mars 2003 16:00À: [EMAIL PROTECTED

Re: [ql-users] Sbasic and numbers

2003-03-12 Thread wlenerz
On 12 Mar 2003 at 10:00, [EMAIL PROTECTED] wrote: (...) . Otherwise Qdos is just the old fashioned 3-byte 32 bit mantissa, 12 bit exponent. Hmmm 32 bits + 12 bits in 3 bytes? Interesting. (just teasing!) Wolfgang

Re: [ql-users] Sbasic and numbers

2003-03-11 Thread François Van Emelen
John Taylor wrote: Francois It is a long time since I had this problem but I found out very early in my QL days that if you tried to print a decimal figure with a leading zero it would display it exponotional. eg. .01 = 1.1E-2 This also applied to numbers with more than six decimal places. I

Re: [ql-users] Sbasic and numbers

2003-03-11 Thread François Van Emelen
Claude Mourier 00 wrote: Marcel gives already the right (and only ?) answer : always use integer representation for number then convert them with IDEC$/FDEC$. Sad method as this slow down a lot the process. Claude Sorry for the delay, but I couldn't reply earlier; UPC (cable company) was down

Re: [ql-users] Sbasic and numbers

2003-03-11 Thread François Van Emelen
[EMAIL PROTECTED] wrote: On 10 Mar 2003 at 13:36, François Van Emelen wrote: Hi all, How can I force Sbasic to display correct and readable numeric values? Here is an example of what I mean. (rest cut) Why not use print_using? Mind you, as Marcel pointed out, this does not get rid of the

RE: [ql-users] Sbasic and numbers

2003-03-11 Thread Claude Mourier 00
PROTECTED] Envoyé : mardi 11 mars 2003 12:27 À : [EMAIL PROTECTED] Objet : Re: [ql-users] Sbasic and numbers Claude Mourier 00 wrote: Marcel gives already the right (and only ?) answer : always use integer representation for number then convert them with IDEC$/FDEC$. Sad method as this slow down

Re: [ql-users] Sbasic and numbers

2003-03-11 Thread Malcolm Lear
Hi François This routine is slow, but may do the job. Cheers Malcolm 100 DEFine FuNction convert(a) 110 a$=a 120 ep='E-' INSTR a$ 130 IF ep 140 e=a$(ep+2 TO) 150 IF '.' INSTR a$ THEN a$=a$(1)a$(3 TO ep-1):ELSE a$=a$(1 TO ep-1) 160 a$='.'FILL$('0',e-1)a$ 170 END IF 180 RETurn a$ 190 END

Re: [ql-users] Sbasic and numbers

2003-03-11 Thread François Van Emelen
Hi Malcolm, Thanks for the 'convert' function. I certainly will try it. Regards François Van Emelen Malcolm Lear wrote: Hi François This routine is slow, but may do the job. Cheers Malcolm 100 DEFine FuNction convert(a) 110 a$=a 120 ep='E-' INSTR a$ 130 IF ep 140 e=a$(ep+2 TO) 150 IF '.'

Re: [ql-users] Sbasic and numbers

2003-03-11 Thread Phoebus Dokos
On Tue, 9 Mar 2004 17:31:54 +, Tony Firshman [EMAIL PROTECTED] wrote: Tony your date is set in 2004... Are you experiencing Time warp? :-) Phoebus -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/

Re: [ql-users] Sbasic and numbers

2003-03-11 Thread Tony Firshman
On Tue, 11 Mar 2003 at 16:14:30, Phoebus Dokos wrote: (ref: [EMAIL PROTECTED]) On Tue, 9 Mar 2004 17:31:54 +, Tony Firshman [EMAIL PROTECTED] wrote: Tony your date is set in 2004... Are you experiencing Time warp? :-) It is a pain. My local time is fine (synchronised to the atomic clock)

[ql-users] Sbasic and numbers

2003-03-10 Thread François Van Emelen
Hi all, How can I force Sbasic to display correct and readable numeric values? Here is an example of what I mean. 160 v10=.123 170 v11=.011 180 r10=v10-v11 190 print v10,v11,r10 200 rem v10 returns .123 readable=yes, correct=yes 210 rem v11 returns 1.1E-2 readable=no, correct=? , should

Re: [ql-users] Sbasic and numbers

2003-03-10 Thread Marcel Kilgus
François Van Emelen wrote: 210 rem v11 returns 1.1E-2 readable=no, correct=? , should display .011 1.1E-2 means 1.1 * 10^(-2) = 1.1 * 0.01 = 0.011 This is by the pretty similar to the way the number is saved internally. 240 v20=12345678.123 250 v21=12345678.011 260 r20=v20-v21

Re: [ql-users] Sbasic and numbers

2003-03-10 Thread John Taylor
in the correct place. If I am honest I should say I have forgotten how I did it. From: François Van Emelen [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] Date: Mon, 10 Mar 2003 13:36:38 +0100 To: QL users list [EMAIL PROTECTED], François Van Emelen [EMAIL PROTECTED] Subject: [ql-users] Sbasic

RE: [ql-users] Sbasic and numbers

2003-03-10 Thread Claude Mourier 00
13:37 À : QL users list; François Van Emelen Objet : [ql-users] Sbasic and numbers Hi all, How can I force Sbasic to display correct and readable numeric values? Here is an example of what I mean. 160 v10=.123 170 v11=.011 180 r10=v10-v11 190 print v10,v11,r10 200 rem v10 returns

Re: [ql-users] Sbasic and numbers

2003-03-10 Thread Tony Firshman
On Mon, 10 Mar 2003 at 15:45:29, Claude Mourier 00 wrote: (ref: [EMAIL PROTECTED]) Marcel gives already the right (and only ?) answer : always use integer representation for number then convert them with IDEC$/FDEC$. Sad method as this slow down a lot the process. This is no good for QDOS -

RE: [ql-users] Sbasic and numbers

2003-03-10 Thread Claude Mourier 00
? I never notice a problem as far as there is no more than 9 digits envolved ... except it's slow -Message d'origine- De : Tony Firshman [mailto:[EMAIL PROTECTED] Envoye : lundi 10 mars 2003 17:32 A : [EMAIL PROTECTED] Objet : Re: [ql-users] Sbasic and numbers On Mon, 10 Mar 2003

Re: [ql-users] Sbasic and numbers

2003-03-10 Thread Tony Firshman
On Mon, 10 Mar 2003 at 17:44:27, Claude Mourier 00 wrote: (ref: [EMAIL PROTECTED]) De : Tony Firshman [mailto:[EMAIL PROTECTED] Envoye : lundi 10 mars 2003 17:32 A : [EMAIL PROTECTED] Objet : Re: [ql-users] Sbasic and numbers On Mon, 10 Mar 2003 at 15:45:29, Claude Mourier 00 wrote: (ref

Re: [ql-users] Sbasic and numbers

2003-03-10 Thread wlenerz
On 10 Mar 2003 at 13:36, François Van Emelen wrote: Hi all, How can I force Sbasic to display correct and readable numeric values? Here is an example of what I mean. (rest cut) Why not use print_using? Mind you, as Marcel pointed out, this does not get rid of the calculation errors, but it