Hello,

> ...an irrational number is defined to be any number not
> representable as the ratio of two integers.

I know that definition, but isn't an infinite number of decimal (or 
binary) places what you end up with as a result?

I accept that 1/3 is not irrational - I am guilty of using the term 
inaccurately - but it is still one of those values that cannot be 
represented exactly in a limited precision number system such as that 
on the QL, and other computers - allegedly :)

I would normally stick to integers or inverse powers of 2 in FOR loops 
too.
I all my years of commercial (business) software development and most 
of my own hobby programming I've never needed to use floating point 
data types.  At work, the main language we used had variable length 
decimal fields of up to 80 digits and the sums were done by special 
hardware.  To get decimal places we just multiplied everything by the 
required power of 10 and then printed the . in the right (or sometimes 
wrong!) place in the reports.

I would have liked to have 32-bit integer variables in SBASIC.  The 
Acorn Atom I believe had 32-bit integers (but no floats unless you 
bought the add-on ROM).

Ian. 



> -----Original Message-----
> From: mlaverne 
> Sent: 21 June 2001 07:08
> To: ql-users
> Cc: mlaverne
> Subject: RE: [ql-users] NEXT in FOR-loop
> 
> 
> At 15:36 18/06/2001 +0100, you wrote:
> >> ... But this is quite annoying :
> >
> >Yes :-), but whenever you use irrational numbers (cannot be 
> represented 
> >exactly in a limited precision number system) ...
> 
> Correction: an irrational number is defined to be any number not
> representable as the ratio of two integers.  Example, SQRT(2), as the
> Pythagoreans found to their chagrin, many centuries ago.
> 
> By your definition, 1/3 is irrational (it's not) because no finite
> sequence of 3's (post decimal point) represents it exactly.
> 
> >
> >Ian.
> >
> >> -----Original Message-----
> >> From: CMOUR 
> >> Sent: 18 June 2001 14:45
> >> To: ql-users
> >> Cc: CMOUR
> >> Subject: RE: [ql-users] NEXT in FOR-loop
> >> 
> >> 
> >> Thank's a lot for all the answers. But this is quite annoying 
> >> : especially
> >> because behavior is not the same for PRINT and INT. Better if 
> >> PRINT returns
> >> something like 2.99999 (in fact SMS loves exponential form 
> I personaly
>       >> hate). I'm not sure but I think even FDEC$(n, 9, 8) 
> returns 3.00000.
> >> 
> >> Claude
> >> 
> >> -----Message d'origine-----
> >> De : ZN [mailto:[EMAIL PROTECTED]]
> >> Envoyé : lundi 18 juin 2001 15:36
> >> À : [EMAIL PROTECTED]
> >> Objet : Re: [ql-users] NEXT in FOR-loop
> >> 
> >> 
> >> >> As I see a question about FOR/NEXT loops, I have mine:
> >> >> the subsequent peice of code gives me an unexpected result
> >> >> FOR n = 2.95 to 3.05 STEP 0.01 : print n, INT(n)
> >> >> Why ?
> >> 
> 
> 
> 


Visit our website at http://www.ubswarburg.com

This message contains confidential information and is intended only 
for the individual named.  If you are not the named addressee you 
should not disseminate, distribute or copy this e-mail.  Please 
notify the sender immediately by e-mail if you have received this 
e-mail by mistake and delete this e-mail from your system.

E-mail transmission cannot be guaranteed to be secure or error-free 
as information could be intercepted, corrupted, lost, destroyed, 
arrive late or incomplete, or contain viruses.  The sender therefore 
does not accept liability for any errors or omissions in the contents 
of this message which arise as a result of e-mail transmission.  If 
verification is required please request a hard-copy version.  This 
message is provided for informational purposes and should not be 
construed as a solicitation or offer to buy or sell any securities or 
related financial instruments.

Reply via email to