Floating-point Numbers Aren't Real

From WikiContent

(Difference between revisions)
Jump to: navigation, search
(New page: Floating-point numbers are not real numbers in the mathematical sense. Real numbers have infinite precision; floating-point numbers have fixed precision, and resemble "badly-behaved" integ...)
Line 1: Line 1:
-
Floating-point numbers are not real numbers in the mathematical sense. Real numbers have infinite precision; floating-point numbers have fixed precision, and resemble "badly-behaved" integers.
+
Floating-point numbers are not real numbers in the mathematical sense. Real numbers have infinite precision; floating-point numbers have fixed precision, and resemble "badly-behaved" integers. If you have access to a 32-bit platform with single-precision IEEE floating-point, like '''float''' in C++ on Windows, assign 2147483647 (the largest signed integer) to a float variable ('''x''', say), and print it. You'll see 2147483648!

Revision as of 16:07, 14 December 2008

Floating-point numbers are not real numbers in the mathematical sense. Real numbers have infinite precision; floating-point numbers have fixed precision, and resemble "badly-behaved" integers. If you have access to a 32-bit platform with single-precision IEEE floating-point, like float in C++ on Windows, assign 2147483647 (the largest signed integer) to a float variable (x, say), and print it. You'll see 2147483648!

Personal tools