aldweb

Fermer I. aldweb

Fermer II. Gratuitiels PC

Fermer III. Gratuitiels Palm

Fermer IV. Partagiciels Palm

Fermer V. iziBasic Palm

Fermer VI. Connaissance Palm

Fermer VII. Ordinateur Poche

Fermer VIII. miniPortail

Spécial !



Version mobile
de l'aldweb Site

m.aldweb.com


Ni Français, ni Anglais ?

Essayez donc l'un de ces drapeaux :
[de] [es] [it] [pt]
Recherche




Météo / Spam / www

Météo Lyon


aldweb contre le SPAM


Newsletter
Pour avoir des nouvelles de ce site, inscrivez-vous à notre Newsletter.
S'abonner
Se désabonner
298 Abonnés
Sites web de la famille

Webmaster - Infos
News Amis
Visites

   visiteurs

   visiteurs en ligne

Sondage
Comment trouve-tu le nouvel habillage de l'aldweb Site ?
 
Superbe !
Joli
Moyen
Moche...
Résultats
forum.gifForum - iziBasic - Sujet n°1296

Forum - Forum
iziBasic - iziBasic


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

actif  Sujet n° 1296  Proper way to Exit concole program

le 23/11/2005 @ 21:45
par Richard

Anonyme



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

Ecrire à Richard   Poster une réponse  Haut

[]   


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

Anonyme

visiteur
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
Ecrire à aldweb   Poster une réponse  Haut

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

Anonyme

visiteur
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
  Poster une réponse  Haut

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

Anonyme

visiteur
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
  Poster une réponse  Haut

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

Anonyme

visiteur
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
Ecrire à aldweb   Poster une réponse  Haut
actif sujet actif   clos sujet clos   Important! Important!   Nouveau Nouveau message   -   Rectifier Rectifier message   Clôturer Clôturer sujet   Remonter Remonter
[]
Catégories de discussion  Forum 



 
^ Haut ^