Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Python floating-point function string conversion floating-point number reserved digits
Python floating-point function string conversion floating-point number reserved digits
In python, the float function is a built-in function. In fact, at the bottom, it is a library that calls C.

C library has the function of sending strings directly to float. Is the atof function.

The specific implementation of atof is complicated, so you can search "atof source code" and learn by yourself.

The same is true for string to int, calling atoi function in C library. First, learn C and the principle of computer composition. Know how these are actually stored in memory. Then learn the compilation principle and understand the interpretation of high-level languages.

Extended data:

Due to the simplicity, readability and expansibility of Python language, more and more research institutions abroad use Python for scientific computing, and some well-known universities also use Python to teach programming courses. For example, Carnegie Mellon University's programming foundation, MIT's computer science and introduction to programming are all taught in Python.

Many open source scientific computing software packages provide Python calling interfaces, such as the famous computer vision library OpenCV, 3D visualization library VTK and medical image processing library ITK. Python even has more special scientific computing extensions, such as the following three very classic scientific computing extensions:

NumPy, SciPy and matplotlib provide Python with fast array processing, numerical operation and drawing functions respectively. Therefore, the development environment composed of Python language and its many extended libraries is very suitable for engineers and researchers to process experimental data, make charts and even develop scientific computing applications.

On March 20 18, the author of the language announced on the mailing list that Python2.7 would end its support on June+10/day, 2020. If users want to continue to get Python2.7 related support after this date, they need to pay the commercial provider.

Baidu encyclopedia -Python