how do i create a binary float?

I am working on a program which tests the limits of the float type variable.
Is it possible to change the default for my program from decimal to binary?
I am trying to add 1 + 1/2 + 1/4 + 1/8 ... but I want it to be
1 + .1 + .01 + .001 ...
Why don't you just use the numeric limits functionality?
http://www.cplusplus.com/reference/std/limits/numeric_limits.html

Plus. I think you have a strange idea of how the float value is stored and it's inherit inaccuracy.

Edit: Plus your question isn't very clear. In a nutshell, no you cannot change the default display format to decimal. But that really wouldn't help you anyway.
Last edited on
That looks a little over my head. I am trying to determine the number of mantissa digits c++ uses and the unit round off point for my machine.

I assume you mean I can not change it to binary. I am supposed to use a hands on approach to figure this out for a numerical analysis course however none of my professors could tell me how to work in binary.
Last edited on
I'm sorry, but I saw the title of the post, and I can't resist.

The answer is to take a mug, fill it with ones and zeroes, and add a scoop of vanilla ice cream on top.

:)
Haha.. that's a good one.
Topic archived. No new replies allowed.