Floating

Discussion of challenges you have already solved
Post Reply
Force4
Posts: 29
Joined: Wed Dec 16, 2009 8:33 pm

Floating

Post 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;
}
DaymItzJack
Posts: 106
Joined: Thu Oct 29, 2009 9:21 pm

Post by DaymItzJack »

I went online and found something to do it for me.
megabreit
Posts: 141
Joined: Sat Jan 03, 2009 3:33 pm

Post 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...
Force4
Posts: 29
Joined: Wed Dec 16, 2009 8:33 pm

Post 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.
User avatar
teebee
Posts: 89
Joined: Mon Nov 10, 2008 3:21 pm
Location: Germany

Post by teebee »

This site offers a neat conversion utility: http://www.h-schmidt.net/FloatApplet/IEEE754.html.
megabreit
Posts: 141
Joined: Sat Jan 03, 2009 3:33 pm

Post 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...
Post Reply