Our training paths
Grow your skills
You’ll get our FREE Video Series & special offers on upcoming training events along with notifications on our latest blog posts.
Valid email required.
Submit failed. Try again or message us directly at email@example.com.
Check your email for confirmation.
Back in June, Gustavo Niemeyer posted the following question on his Labix.org blog:
Assume uf is an unsigned integer with 64 bits that holds the IEEE-754 representation for a binary floating point number of that size.How can you tell if uf represents an integer number?I can’t talk for you, but I write business applications. I just don’t have the background to quickly knock out an answer for a question like this. Fortunately Gustavo posted the logic for the answer. I thought it would be fun to better understand the question and break down his answer. I am going to work with a 32 bit number just to make everything easier.How does the IEEE-754 standard store a floating point number in a binary format? To start I found these two pages:http://steve.hollasch.net/cgindex/coding/ieeefloat.htmlhttp://class.ece.iastate.edu/arun/CprE281_F05/ieee754/ie5.htmlThe IEEE-754 specification represents a floating point number in base 2 scientific notation using a special binary format. If you don’t know what I mean by base 2 then look at my post on Understanding Type In Go (https://www.ardanlabs.com/blog/2013/07/understanding-type-in-go.html).Scientific notation is an efficient way of writing very large or small numbers. It works by using a decimal format with a multiplier. Here are some examples:
In normal scientific notation form there is always just one digit on the left side of the decimal point. For base 10 numbers that digit must be between 1 through 9 and for base 2 numbers that digit can only be 1.The entire number in scientific notation is called the Coefficient. The Mantissa is all the numbers to the right of the decimal point. These terms are important so take the time to study and understand the chart above.How we move the decimal point to that first position determines the value of the Exponent. If we have to move the decimal point to the left, the Exponent is a positive number, to the right, it is a negative number. Look at the chart above and see the Exponent value for each example.The Base and the Exponent work together in the notation. The exponent determines the "Power Of" calculation we need to perform on the base. In the first example the number 7 is multiplied by 10 (The Base) to the power of 2 (The Exponent) to get back to the original base 10 number 700. We moved the decimal point to the left two places to convert 700 to 7.00, which made the Exponent +2 and created the notation of 7e+2.The IEEE-754 standard does not store base 10 scientific notation numbers but base 2 scientific notation numbers. The last example in the chart above represents the base 10 number 0.085 in base 2 scientific notation. Let’s learn how that notation is calculated.
We have taught Go to thousands of developers all around the world since 2014. There is no other company that has been doing it longer and our material has proven to help jump start developers 6 to 12 months ahead of their knowledge of Go. We know what knowledge developers need in order to be productive and efficient when writing software in Go.
Our classes are perfect for both experienced and beginning engineers. We start every class from the beginning and get very detailed about the internals, mechanics, specification, guidelines, best practices and design philosophies. We cover a lot about "if performance matters" with a focus on mechanical sympathy, data oriented design, decoupling and writing production software.
Interested in Ultimate Go Corporate Training and special pricing?
Our courses have been designed from training over 30,000 engineers since 2013, and they go beyond just being a language course. Our goal is to challenge every student to think about what they are doing and why.
Please fill out the form below, and we'll get back to you soon.
Check your email for confirmation of your sent message. We'll get back to you shortly.
Ardan Labs Copyrights © 2022