Is There a Pitfall in C Language Floating Point ‘Rounding’? Unveiling the ‘Banker’s Rounding’ You Didn’t Know!

Is There a Pitfall in C Language Floating Point 'Rounding'? Unveiling the 'Banker's Rounding' You Didn't Know!

“Rounding, what’s so difficult about it?” When you hear this term, do you immediately think of your elementary school textbooks? However, in computing, especially when dealing with floating-point numbers, things are far from simple. When we mention rounding of floating-point numbers, we often refer not to the most common “round half up” that we encounter … Read more

In-Depth Analysis of ‘Unconventional’ Values in C: Infinity and NaN

In-Depth Analysis of 'Unconventional' Values in C: Infinity and NaN

As we explore the fascinating world of C programming, we typically deal with common values such as integers and floating-point numbers. But did you know that C also hides some ‘unconventional’ values that represent extreme cases in the computing world—such as ‘Infinity’ and ‘Not a Number’ (NaN)? Today, we will delve into these special floating-point … Read more

Why is the Range of Float in C Language 3.4E+38? Unveiling the Secrets of Floating Point ‘Hidden Bit’ and ‘Golden Rule’

Why is the Range of Float in C Language 3.4E+38? Unveiling the Secrets of Floating Point 'Hidden Bit' and 'Golden Rule'

In learning C language, float (single precision floating point) and double (double precision floating point) are two unavoidable hurdles. Many students memorize their value ranges—such as float being approximately ±3.4E+38—but do not understand where this astronomical number comes from. Today’s lesson is an “elective content,” but it is highly valuable. We will dive into the … Read more

Cortex Authority Manual – Floating Point Operations

Cortex Authority Manual - Floating Point Operations

Floating Point Representation The representation of floating-point numbers follows the IEEE 754 standard, including single precision, double precision, and half precision floating-point numbers. Each floating-point number has a sign bit, an exponent, and a fraction part. Single Precision Floating Point (32 bits) Bit 31: Sign bit (0 indicates positive, 1 indicates negative). Bits 30-23: Exponent … Read more

Can Bitwise AND Operator & Be Used on Floating Point Numbers in C? (Part 1) The Mystery of IEEE 754 Standard and Floating Point Representation

Can Bitwise AND Operator & Be Used on Floating Point Numbers in C? (Part 1) The Mystery of IEEE 754 Standard and Floating Point Representation

In C language development, when we attempt to use the bitwise AND operator & on floating point numbers, the compiler will throw an error without mercy. This phenomenon is rooted in the basic principles of number representation, base conversion, and floating point structure in computer science. By delving deeper into this issue, we can uncover … Read more