Mam program, ktory mi pri vypocte niekedy vrati vyraz -1.#IND, pre urcite hodnoty funguje v pohode ale pre ine zase nie. V com to je?? Dik za pomoc!
Fórum › C / C++
vysledok -1.#IND???

Google:
Debugging 1.#IND, 1.#INF, nan, and inf
If your operation would generate a larger positive number than could be stored in a double, the operation will return 1.#INF on Windows or inf on Linux. Similarly your code will return 11.#INF or -inf if the result would be a negative number too large to store in a double. Dividing a positive number by zero produces a positive infinity and dividing a negative number by zero produces a negative infinity. Example code at the end of this page will demonstrate some operations that produce infinities.
http://www.johndcook.com/IEEE_exceptions_in_cpp.html
mam pocit ze odmocnina z nuly jde...
druha odmocnina ze zaporneho cisla nejde...
je mozny ze ti tam vyjde "skoro" nula... lehce tihnouci k zapornemu cislu a tim to pak nejde odmocnit
KIIV napsal:
mam pocit ze odmocnina z nuly jde...
druha odmocnina ze zaporneho cisla nejde...
je mozny ze ti tam vyjde "skoro" nula... lehce tihnouci k zapornemu cislu a tim to pak nejde odmocnit
Odmocnina z nuly v realnych cislech nejde na to pozor :)
To Anonymní uživatel : vyzkousime to tedy 0^2 = 0 tim by mela jit i odmocnina avsak dejme tomu (-2)^2 = 4 tudiz at bych se snazil jakkoliv nemohl bych odmocnenim -4 dostat nic protoze zaporne na druhou by dalo kladne
EDIT: opraven preklep z -1 na -2 :D
To KIIV : Chvilku jsem koukal na (-1)^2 = 4, pak mi asi došlo, že tam asi mělo být (-2)^2 = 4 :smile1:. Nicméně, posuneme-li se na množinu čísel komplexních. -4 lze odmocnit, jako sqrt(4j^2). Výsledek by tedy byl 2j. Ale to jen spíš na doplnění :smile14:.
To Bald3rr : jiste .. jsem se pohyboval v mnozine realnejch cisel... komplexni by byly z hlediska implementace lehce narocnejsi.. ikdyz to zabere jen par desitek minut

Přidej příspěvek
Ano, opravdu chci reagovat → zobrazí formulář pro přidání příspěvku
×Vložení zdrojáku
×Vložení obrázku
×Vložení videa
































Uživatelé prohlížející si toto vlákno
Podobná vlákna
Nezobrazí výsledok — založil Thomash
Sql vysledok do premennej — založil deadripple
Funkcia vypisať vysledok — založil Zelenac14
1.#QNAN a -1.#IND — založil Deskjet
Vystup -1.#IND - dotaz — založil Milan
Moderátoři diskuze