aldweb

Close I. aldweb

Close II. PC Freeware

Close III. Palm Freeware

Close IV. Palm Shareware

Close V. iziBasic Palm

Close VI. Palm Knowledge

Close VII. Pocket Computer

Close VIII. miniPortail

Special !



Mobile version of
the aldweb Site

m.aldweb.com


Neither French, nor English?

Try one of these flags then:
[de] [es] [it] [pt]
Search




Weather / Spam / www

Lyon Weather


aldweb against spam


Newsletter
To receive news about this website, consider subscribing to our Newsletter.
Subscribe
Unsubscribe
298 Subscribers
Family's web sites

Webmaster - Infos
Friends News
Visits

   visitors

   visitors online

Poll
What do you think of the new design of the aldweb Site?
 
Great !
Beautiful
Average
So ugly...
Results
forum.gifForum - iziBasic - Topic #1296

Forum - Forum
iziBasic - iziBasic


Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 257

active  Topic # 1296  Proper way to Exit concole program

23/11/2005 @ 21:45
by Richard

Anonymous



I have a simple little program that asks for a number and reports if it is a prime number.

Very simple version of the program

BEGIN

D0
INPUT "? ", K$­­
PRINT K$­­
GOSUB _ISPRIME
IF P = 1 THEN
PRINT " Prime"
ELSE
PRINT " Not Prime"
END IF
LOOP K$­­ = ""

END

Should I do anything prior to reaching the END statement?

Thanks,

Richard

PS: What is the maximum Positive Integer can iziBasic handle? Thanks

Write to Richard   Post an answer  Top

[]   


Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 1
--------
24/11/2005 @ 13:32
by aldweb

Anonymous

visitor
Hello Richard,

Your source code should work very fine as is, there is nothing special to do before reaching the END statement. What did you think about? What is your reason for asking?

Numbers in iziBasic are 32 bit float IEEE 754 compatible. Typing "32 bit float IEEE 754" in any search engine like Google will give you thousands of pages to read about this standard.
Here is one that answers your question:
http://www.math.byu.edu/~schow/work/IEEEFloatingPoint.htm
And, I also provide the answer: precision for interger numbers is in the [+/-1.40239846e-45 .. +/-3.40282347e+38] range.

And a small program to show it:
BEGIN
A=3.4028*10^38
PRINT A
END


Cheers,
aldweb
Write to aldweb   Post an answer  Top

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 2
--------
24/11/2005 @ 16:40
by Richard

Anonymous

visitor
The reason I was asking was that as I was going through the development cycle .. Piaf, iziBasic compile and run through iziBasic -- I would get an error that would require a reset, the reset button in hte message didn't work, so I'd have to press the reset on the back of the T3. I didn't capture the message -- so I can't tell you any more.

The other question was related to the program appearing to hang up when I put in *LARGE* numbers. The routine I'm using to determine prime is to do a MOD of the number, N, with 2 through N-1. If MOD returns 0 -- then the number is not prime. I've tried numbers around 6500 and the routine works fine. Maybe I should look for another approach for determing prime.

This is very fun .. I've been looking for a programming language that is easy to use for the Palm.

Thanks again,

Richard
  Post an answer  Top

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 3
--------
24/11/2005 @ 23:03
by Richard

Anonymous

visitor
As a follow up...

The error message that I get from time to time is

Fatal Falult, MemoryMgr.c, Line:3757, Invalid chunk ptr, reset (sometimes the reset button works and sometimes it doesn't).

I did a little reading about checking for prime numbers. It is safe to test from 2 to the square root of the N -- rather than from 2 to N-1. This is a big improvement in speed.

Thanks,

Richard
  Post an answer  Top

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 4
--------
24/11/2005 @ 23:09
by aldweb

Anonymous

visitor
Richard,

The error must be in your _ISPRIME routine, because the above source code runs fine (as expected!).

I know very well prime numbers routine too and I even used it here on my web site to benchmark the different development tools for Palm
And I also provide the source code for iziBasic (but you got it in the Bench2 sample source code shipped within the ZIP package).

Cheers,
aldweb

@+
aldweb
Write to aldweb   Post an answer  Top
active topic active   closed topic closed   Sticky Sticky   New New message   -   Correct Correct message   Close Close topic   Make sticky Make sticky
[]
Forum Topic  Forum 



 
^ Top ^