Posts

Showing posts with the label Floating point

A Genetic Algorithm Function Optimizer in C++

Image
Introduction An example of how a genetic algorithm can be applied to optimize standard mathematical functions, such as the Rosenbrock function. (Image obtained from the Wikipedia page.)

Converting between binary and decimal representations of IEEE 754 floating-point numbers in C++, Java and Python

Image
This post implements a previous post that explains how to convert 32-bit floating point numbers to binary numbers in the IEEE 754 format. What we have is some C++ / Java / Python routines that will allows us to convert a floating point value into it's equivalent binary counterpart, using the standard IEEE 754 representation consisting of the sign bit, exponent and mantissa (fractional part).

Converting IEEE 754 Floating Point into Binary

This post explains how to convert floating point numbers to binary numbers in the IEEE 754 format.  A good link on the subject of IEEE 754 conversion exists at Thomas Finleys website . For this post I will stick with the IEEE 754 single precision binary floating-point format: binary32. See this other posting for C++, Java and Python implementations for converting between the binary and decimal formats.