AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Sono alle prime armi e....

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java (Italian)
View previous topic :: View next topic  
Author Message
st3fania
Guest





PostPosted: Mon Oct 24, 2005 1:16 pm    Post subject: Sono alle prime armi e.... Reply with quote



Sto diventando matta, è un problema di parentesi (credo):

JOptionPane.showMessageDialog(null, "Le due radici sono " +
(-b+(Math.sqrt(Math.pow(b,2)-4*a*c))/2*a) + " " +
(-b-(Math.sqrt(Math.pow(b,2)-4*a*c))/2*a));

Mi restituisce: Le due radici sono NaN NaN


Dove sbaglio?

Grazie, 1000
Stefania



Back to top
st3fania
Guest





PostPosted: Mon Oct 24, 2005 1:20 pm    Post subject: Re: Sono alle prime armi e.... Reply with quote



Scusate, ho risolto da sola.



"st3fania" <st3fania (AT) NOSPAMlibero (DOT) it> ha scritto nel messaggio
news:a957f.28540$Pe2.555303 (AT) twister2 (DOT) libero.it...
Quote:
Sto diventando matta, è un problema di parentesi (credo):

JOptionPane.showMessageDialog(null, "Le due radici sono " +
(-b+(Math.sqrt(Math.pow(b,2)-4*a*c))/2*a) + " " +
(-b-(Math.sqrt(Math.pow(b,2)-4*a*c))/2*a));

Mi restituisce: Le due radici sono NaN NaN


Dove sbaglio?

Grazie, 1000
Stefania






Back to top
Gian Uberto Lauri
Guest





PostPosted: Mon Oct 24, 2005 1:24 pm    Post subject: Re: Sono alle prime armi e.... Reply with quote



Quote:
Long count = 12.19.12.13.5; tzolkin = 2 Chicchan; haab = 3 Zac.
I get words from the Allmighty Great Gnus that
"s" == st3fania <st3fania (AT) NOSPAMlibero (DOT) it> writes:

s> Mi restituisce: Le due radici sono NaN NaN

Prova a stampare a, b e c singolarmente o a seguire passo per passo il
programma con un debugger.

Mi pare che Math.sqrt() ritorni NaN nel caso in cui l'argomento
passato non sia maggiore o uguale a 0 (Not A Number, valore speciale
delle variabili floating point in formato IEEE echisiricordailnumero
che indica che il risultato dell'operazione non è un numero reale o
non esiste)


--
/ ___
/___/__|_|_|__|___Gian Uberto Lauri_____________________
//-- | | | | Integralista GNUslamico
/ e allevatore di bug da competizione

Back to top
Totonno®
Guest





PostPosted: Mon Oct 24, 2005 2:53 pm    Post subject: Re: Sono alle prime armi e.... Reply with quote


"st3fania" <st3fania (AT) NOSPAMlibero (DOT) it> ha scritto

Quote:
Scusate, ho risolto da sola.

E no carina, adesso devi dirci che cavolo era.

:-) Smile :-)

Totonno®



Back to top
Totonno®
Guest





PostPosted: Mon Oct 24, 2005 3:02 pm    Post subject: Re: Sono alle prime armi e.... Reply with quote


"st3fania" <st3fania (AT) NOSPAMlibero (DOT) it> ha scritto


Quote:
Sto diventando matta, è un problema di parentesi (credo):

JOptionPane.showMessageDialog(null, "Le due radici sono " +
(-b+(Math.sqrt(Math.pow(b,2)-4*a*c))/2*a) + " " +
(-b-(Math.sqrt(Math.pow(b,2)-4*a*c))/2*a));

Mi restituisce: Le due radici sono NaN NaN


Gli avrai mica passato una equazione che prevede soluzioni complesse &
coniugate?
Che fortuna!!!!!


Totonno®





Back to top
Marino Borra
Guest





PostPosted: Mon Oct 24, 2005 3:26 pm    Post subject: Re: Sono alle prime armi e.... Reply with quote

Gian Uberto Lauri wrote:
Quote:
Long count = 12.19.12.13.5; tzolkin = 2 Chicchan; haab = 3 Zac.
I get words from the Allmighty Great Gnus that
"s" == st3fania <st3fania (AT) NOSPAMlibero (DOT) it> writes:


s> Mi restituisce: Le due radici sono NaN NaN

Prova a stampare a, b e c singolarmente o a seguire passo per passo il
programma con un debugger.
Il debugger? Spendere 2 minuti per leggersi le specifiche?

Ciao

Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java (Italian) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.