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 thou

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 TonyTebby
Lau writes > > 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,

Re: [ql-users] Sbasic and numbers

2003-03-16 Thread TonyTebby
o think up work for other people to do - I am enjoying 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
Lau writes: > 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

Re: [ql-users] Sbasic and numbers

2003-03-15 Thread Lau
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

Re: [ql-users] Sbasic and numbers

2003-03-15 Thread P Witte
Dave Walker writes: > > 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 programm

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 ea

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

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 add/s

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

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

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 dif

Re: [ql-users] Sbasic and numbers

2003-03-14 Thread François Van Emelen
Hi Per, Thanks for your reply. Regards, François Van Emelen P Witte wrote: François Van Emelen writes: 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? Even

Re: [ql-users] Sbasic and numbers

2003-03-14 Thread François Van Emelen
Hi, Thank you for your reply. Regards, François Van Emelen Marcel Kilgus wrote: 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". Ag

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 > > François Van Emelen writes: > > > Tha

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.

Re: [ql-users] Sbasic and numbers

2003-03-13 Thread P Witte
François 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 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 François Van Emelen
Hi Per, >P Witte wrote: 100 DEFine FuNction Add$(n1$, n2$) 280 RETurn r$ 290 END DEFine 300 : 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 want

Re: [ql-users] Sbasic and numbers

2003-03-13 Thread Marcel Kilgus
Claude Mourier 00 wrote: > Would it be difficult,in the same domain, to implement large (64 > bits) integers arithmetic on SMSQ ? (Marcel ?) You mean in SBasic? I wouldn't dare making any changes to SBasic except probably small bug fixes. Just providing routines (e.g. vectored ones) for 64 bit a

Re: [ql-users] Sbasic and numbers

2003-03-13 Thread Tony Firshman
On Thu, 13 Mar 2003 at 14:47:39, Jerome Grimbert wrote: (ref: <[EMAIL PROTECTED]>) } >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 additio

Re: [ql-users] Sbasic and numbers

2003-03-13 Thread Jerome Grimbert
} >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. Well, account

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 t

RE: [ql-users] Sbasic and numbers

2003-03-13 Thread Claude Mourier 00
arcel ?) 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 François Van Emelen writes: > > It is not too difficult to write your own fixed > > or floating p

Re: [ql-users] Sbasic and numbers

2003-03-13 Thread P Witte
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", by Czes > > Kosniowski (out of print) might provide a suitable start

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-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

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 fi

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! 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 t

Re: [ql-users] Sbasic and numbers

2003-03-12 Thread François Van Emelen
Norman Dunbar wrote: Morning François, 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 Norman Dunbar
Morning François, Per wrote : >> >> you cant change the world, change yourself!" might usefully be applied to >> >> the problem. you replied : >> Or in this situation; if more serious work is involved, avoid Qdos/Smsq ;-) I'm afraid it isn't any better in the mainframe, Unix server or PC wor

Re: [ql-users] Sbasic and numbers

2003-03-12 Thread François 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 Sinclai

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 atom

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 P Witte
François Van Emelen writes: <> > Why I don't use PRINT_USING, well because it has the same limits as > FDEC$,ie 9 digits, which is not enough to display (for example) the > annual amount of euros the European Community spends for Education: > 776.4 million euros with should be displayed as '77640

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 '.' IN

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 Claude Mourier 00
mailto:[EMAIL 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$. > S

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 calc

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 y

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 use

Re: [ql-users] Sbasic and numbers

2003-03-11 Thread Tony Firshman
On Tue, 11 Mar 2003 at 03:36:31, Lau wrote: (ref: <[EMAIL PROTECTED]>) > >Tony Firshman wrote: >> On Mon, 10 Mar 2003 at 17:44:27, Claude Mourier 00 wrote: >> (ref: <[EMAIL PROTECTED]>) >> Lau ought to chip in here with the definitive statement. >> >>> > >Goad me into speaking, huh? he he - i

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, bu

Re: [ql-users] Sbasic and numbers

2003-03-10 Thread Lau
Tony Firshman wrote: 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,

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

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 M

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 QDO

RE: [ql-users] Sbasic and numbers

2003-03-10 Thread Claude Mourier 00
2003 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 re

Re: [ql-users] Sbasic and numbers

2003-03-10 Thread John Taylor
OTECTED]> > Subject: [ql-users] Sbasic and numbers > Resent-From: [EMAIL PROTECTED] > Resent-Date: Mon, 10 Mar 2003 12:43:38 GMT > > > Hi all, > > How can I force Sbasic to display correct and readable numeric values? > Here is an example of what I mean. > > 160

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

[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 dis