Float to Int in Union

Using a union to convert data types is called type punning and is not legal in C++. See this recent discussion, Problem with the use of union