Portál AbcLinuxu, 3. listopadu 2025 12:00
Dobry Den mam problem :
double a ;
///---------------program
cout << a :
hodnota ktoru vrati tento program je "inf" . Neviete akej hodonote sa to rovna alebo co to interpretuje ??
Je to pre mna zahada neviem s cim to mam porovnat .
Dakujem
Dakujem a ve vyraze if sa to da s niecim porovnat ? napr s vyrazom 1/0 ?
1.0/0, jiná (lepší) je std::numeric_limits<double>::infinity(), no a pak jsou tu funkce isnan(), isinf(), isfinite(), fpclassify() (viz jejich manuálovky).
The following macros shall be defined for number classification. They
represent the mutually-exclusive kinds of floating-point values. They
expand to integer constant expressions with distinct values. Additional
implementation-defined floating-point classifications, with macro defi‐
nitions beginning with FP_ and an uppercase letter, may also be speci‐
fied by the implementation.
FP_INFINITE
FP_NAN
FP_NORMAL
FP_SUBNORMAL
FP_ZERO
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.