Page 1 of 1

Floating

Posted: Sat Dec 19, 2009 12:51 am
by Force4
Hey :)

Anybody thought to use an union in C/C++? Entering the chars and check what's in the float?

union s_float
{
char c[4];
float f;
}

Posted: Sun Dec 20, 2009 10:23 pm
by DaymItzJack
I went online and found something to do it for me.

Posted: Tue Dec 22, 2009 3:57 pm
by megabreit
Great idea! I was picking up my old C/C++ lessons a bit later for an other challenge, so it looks like I missed another opportunity to polish my C knowledge :lol:
On the other hand, it was far easier to find this website...

Posted: Wed Dec 23, 2009 4:01 am
by Force4
Yeah you might be right.

Well, as for me, I tried googling and all that. I ended up at wikipedia trying to do it by hand, etc.
5 min passed before I said to myself, that's it, I write a little union program. And it took me less than a minute.

But I understand, finding the right website right away seems kinda cool! And doesn't sound too hard. I'm just a noob.

Posted: Wed Dec 23, 2009 7:14 pm
by teebee
This site offers a neat conversion utility: http://www.h-schmidt.net/FloatApplet/IEEE754.html.

Posted: Wed Dec 23, 2009 8:38 pm
by megabreit
Yeah, I guess that was the web site (it's been some time, my memory is not very clear anymore).
I was begging to find such a "cool" web site for the Cobol floating point challenge, but I was not lucky that time.

My C knowledge is a bit outdated (15 years), so I hope it's allowed to use current ways of information first :lol:

And remember: You're no noob if you solved a challenge. The result is important, not the way you achieved it...