[ Web Proxy ]
URL:
Viewing: https://ru.cppreference.com/cpp/string/byte/atof [Back]  [Original]

std::atof cppreference.com
cppreference.com

std::atof

cppreference.com
<tbody> </tbody>
double atof( const char *str );

, str, .

( std::isspace), . , . :

  • . :
  • ()
  • , ( C) ( )
  • () e E, ( 10)
  • . :
  • ()
  • 0x 0X
  • , ( C) ( )
  • () p P, ( 2)
  • . :
  • ()
  • INF INFINITY
  • . :
  • ()
  • NAN NAN( ) NAN. , . NaN .
( C++11)
  • , C

str ,

double, str . , . , 0.0.

#include <cstdlib>
#include <iostream>
 
int main()
{
    std::cout << std::atof("0.0000000123") << '\n'
              << std::atof("0.012")        << '\n'
              << std::atof("15e16")        << '\n'
              << std::atof("-0x1afp-2")    << '\n'
              << std::atof("inF")          << '\n'
              << std::atof("Nan")          << '\n'
              << std::atof("")       << '\n';
}

:

1.23e-08
0.012
1.5e+17
-107.75
inf
nan
0

(C++11)(C++11)(C++11)

() []

() []

() []

() []
C atof

Web Proxy Viewer  |  New URL  |  Original Page