• ## Why is precision lost? Teach you to understand IEEE-754!

Time：2020-9-27

Link to the original text: https://ssshooter.com/2020-09… The image above is from Wikipedia. IEEE-754 standard is a floating-point number standard. There are three formats: 32-bit, 64-bit, and 128 bit (the above two pictures are 32-bit and 64 bit respectively, and the structure is consistent). JavaScript uses 64 bit, which is commonly known as “double precision”. This […]

• ## [30 day leetcoding challenge] day 3

Time：2020-7-13

Hi, everyone. I’m a pig. Welcome to “baby can understand” series special – 30 day leetcoding challenge. This is a small official event for leetcode. As you can see on the official website, from April 1, every day, the official will select a question and complete it within 24 hours to get a small reward. […]

• ## 41. First positive number missing

Time：2020-4-19

Given an array of unsorted integers, find the smallest positive integer that does not appear. Example 1: Input: [1,2,0]Output: 3Example 2: Input: [3,4, – 1,1]Output: 2Example 3: Input: [7,8,9,11,12]Output: 1Explain: The time complexity of your algorithm should be o (n), and only constant level space can be used. First record all the positive values with […]

• ## Implementation of negative number in the bottom layer of computer

Time：2020-2-6

Do you really understand negative numbers in Java? From http://blog.csdn.net/candyguy 1、 How to code negative numbers in Java? Java uses “two’s complement” to encode negative numbers. It is a numerical encoding method, which needs to be completed in two steps: first, each binary bit takes the opposite value, 0 becomes 1, 1 becomes 0. For […]

• ## IOS – about some rounding methods

Time：2019-12-6

1. Direct conversion float k = 1.6; int a = (int)k; NSLog(@”a = %d”,a); The output is 1, (int) is a forced type conversion, which directly discards the decimal part of the floating-point number. 2. Rounding of floor function (rounding down) float k = 1.6; int a = floor(k); NSLog(@”a = %d”,a); The output result […]

• ## C Language: Modular Operation between Positive and Negative Numbers (Reprint)

Time：2019-9-20

If the operands on both sides of% are positive, the result is positive or zero; if the operands on both sides of% are negative, the result is negative or zero. Before C99, it was not stipulated what the result of modular division would be if one of the operands was negative. C99 stipulates that if […]