Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.

Lord Gzoo

float data type

This topic is 5278 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I wrote a little app that took a variable and showed its binary form in order to make a little research on data types. Integers are just lovely. Unsigned integers or positive integers are straightforward. Signed integers below zero use 2''s complement (or how the hell they call it). Happy and confindent I moved on to floats and started to cry. Here are some results I got for floats (high order byte is the leftmost) 0.0f ===> 00000000 00000000 00000000 00000000 1.0f ===> 00111111 10000000 00000000 00000000 1.127f ===> 00111111 10010000 01000001 10001001 -64.23f ===> 11000010 10000000 01110101 11000011 HA! The only thing that made sense to me was zero and the high-order-bit for positive/negative signs. Explanations anyone? Maybe a few words on doubles also?

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!