Programming notes -② training exercises topic

 Precision calculation

Part of this article reference links https://blog.csdn.net/fwq990720/article/details/79233889

Octal decimal to re-write the subject, found the problem, not just binary conversion, but I'm not familiar with high precision / large numbers to calculate a relationship.

By this questions, we summarize some of the high-precision points / large numbers calculated:

     String operation ①

     ② each time operation, only bits (single digit) is calculated

       ③ test field when writing, written calculation process, and more testing, consider a variety of boundary conditions.

At the suggestion of some chiefs of the students, I decided to finish this question, the hand line and large numbers arithmetic operations.

First, octal, decimal

First, for the high precision / large numbers calculated, when using the C ++ language, double, and the like have int accuracy limitations, so there is generally a string selection operation, to be noted here that, through the string, each time only a process of calculating operations can be a character, otherwise due to the variable-length strings, calculated with high accuracy becomes dummy, with the use of double, int no difference. (Already mentioned above)

 

This question with a simple division of large numbers this thing, this question divisor 8 (so not too complicated), the main point is basically to

1) first determine dividend integer or floating point, with to string.find has ()

2) storing an integer remainder when f is calculated as storage

3) Finally, if this does not begin with 0 decimal .1283 appears, make up the leading zeros

4) calculating, when Note operation will not divide up 0

 

 This section reverse traversal processing thoughts, I watched solution to a problem is the big brother, the only

 

Guess you like

Origin www.cnblogs.com/Notherthing-hyc/p/11620057.html