Hey Dude, A quick 'n' dirty way of doing it would be to count the number of digits after the decimal point as your numerator and use this number of digits to calculate your denominator. Ex: .3456 = 3456/10000 That'd give you a fraction at least. If you want to reduce it, find numbers that divide both the numerator and denominator evenly. Use the modulus operator for this. A result of 0 indicates that the number is evenly divisible. ex: 2%10=0, evenly divisible 3%10=1, not evenly divisible. Of course for very long decimals you may want to adopt some fixed amount of places to round off to. You will lose some precision in the number however. I'd put the whole operation in a function like: void print_fraction(double decimal_value), that prints a fraction for the decimal value you pass to it. Hope this helps. Josh Knox
Josh Knox
Posts
-
decimal fraction conversion -
Slackware 9 is DA BOMBSee, you're smarter already!;P Everytime I try KDevelop it's "real Alpha". Always looks cool but always seems to be half done. Josh Knox
-
Slackware 9 is DA BOMBSlack 9 Rocks!!! Serve it up with a side of Dropline Gnome and yer stylin'. You'd never believe it's free software. :omg: Highly recommended!!! :-D Plus, Slackware makes you smarter. Josh Knox
-
snow...Wussy,;P I've got 4 feet of snow in my yard and the blizzard isn't even here yet!:mad: Plus my furnace is broken and my pipes are frozen. Why the hell do I love Maine? At least my broadband is still working. Josh Knox
-
snow...Kastellanos Nikos wrote: I have to travel for >1.5 hours to see snow. Heh, I've got to travel 1.5 hours through this damn blizzard for my first day of work tomorrow. Can't be late! Josh Knox
-
Curiosity - Which Linux brand/version do you prefer?Slackware is all I've ever used. Has every thing I need. Dropline Gnome is a great desktop package for Slackware. Makes it easy to get up and running and stay updated. I use RedHat at werk. Josh Knox
-
CPian goes back to workHopefully you can get back on the tech side of things soon. My unemployment ran out months ago so I started doing my own thing building systems, doing websites, tech support, etc; basically just pimping myself out through word-of-mouth. I should've called my biz "Compu-Hoe: I Do Computers". The tech market still sucks but there's alot of people with computers who don't know how to use them or where to get them fixed/upgraded , etc. After I got over the initial wierdness of billing people, I found that they were more than willing to pay for help. It wasn't too much programming but I was still gettin' cash to play with computers. Is it possible to get any work for yourself? That's what helped get me through. Didn't make me rich but it did help. Good luck finding a job you like. Josh Knox
-
CPian goes back to work"... you were just holding out so you were unemployed for longer than me, weren't you? " I wasn't going for any records. I'm just glad I ended up with a cool job after all. The only bad thing is the 1.5 hr commute through the rural country side of southern New Hampshire (where the high today was 0F and we've got 4 feet of snow). I get to play with robots all day though. I think I'll build a blonde.:laugh: Did you find some gainful employment yet? Knoxy
-
CPian goes back to workOooops.:-O Worked fine in Mozilla?:confused: Josh Knox
-
CPian goes back to workMy 1.5 years of unemployment is finally over! I officially go back to werk on 2/18/03. I'll be a Support Engineer at iRobot. I'll be helping users keep their robots running as well as developing control software for their linux brains. Sweeeeeet!!! Gonna party like crazy for the next week! Josh Knox
-
2nd interviewThanks for the replies everyone. I'm very anxious to get the interview over with. It's a support position but it does invlove a wide range of skills from programming(c/c++, scripts), some web dev, networks, troubleshooting and mechanical abilities, as well as the potential for occasional international travel. Fortunately I use most of the required skills on a regular basis. I'm 97% sure I'm the man for the job and after 1.5 years werkin' on my own I sure hope I get it. Thanks again everyone. Wish me luck tomorrow. Josh Knox
-
2nd interviewWe went through my technical skills pretty thoroughly the first time around. Hopefully it's just an evaluation of my interpersonal/teamwork skills. Everyone there seemed to like me. Maybe I'll be back to work monday! Wish me luck. Josh Knox
-
2nd interviewAfter 1.5 years without a "real" job, I think I might be landing a post with a cool company. The first interview went well and I think I'd be the perfect candidate for the position. Now I've been called back for a second meeting on Friday morning to meet with the Senior VP and Director of the Research Robotics Division. While not trying to get my hopes up, what do "second interviews" usually entail? I've always either gotten the job or not after one interview. What should I be prepared for in a second interview? Josh Knox
-
PHP resources ...sitepoint.com has some excellent articles and resources on development with php and MySQL and web development in general. I've found it to be on par with our beloved CP as a development resource. I've seen Chris Duncans articles there as well. I just embarked on some MySQL/PHP development for the first time. php is very intuitive, coming from a c/c++ background. It makes working with MySQL pretty easy. I'm new to sql but its been pretty easy going so far. Josh Knox
We will rid the world of buttmunching pussnuts. Armed only with my blunt spoon of death and my circumcising potato peeler. Death and torture to them all. - Michael Martin
-
I love the smell of new electronics in the morningSweet. Good luck getting that Radeon 9700 working on linux though. AFAIK anything after the 8500s aren't supported by X yet. Josh Knox
We will rid the world of buttmunching pussnuts. Armed only with my blunt spoon of death and my circumcising potato peeler. Death and torture to them all. - Michael Martin
-
Funny interview questionSeems like a sort of useless question. Does this question reveal any skills on the prospect's part that are necessary for the job? Josh Knox
We will rid the world of buttmunching pussnuts. Armed only with my blunt spoon of death and my circumcising potato peeler. Death and torture to them all. - Michael Martin
-
New ComputerIf you can find an ATI All-In-Wonder 128 I'd recommend that as the TV/vid capture card to get. I got one a few years ago and it still rocks. They're tough to find now though as ATI has moved to Radeon all-in-wonders which are pretty expensive. Josh Knox
We will rid the world of buttmunching pussnuts. Armed only with my blunt spoon of death and my circumcising potato peeler. Death and torture to them all. - Michael Martin
-
GardeningYeah, I've got a bunch of lettuce, tomatoes, cucumbers, zucchini, a couple plum trees, a peach tree, and a peculiar unnamed herb. I love my garden. Josh Knox
We will rid the world of buttmunching pussnuts. Armed only with my blunt spoon of death and my circumcising potato peeler. Death and torture to them all. - Michael Martin
-
Klez virusHey!!! WTF?!?! webmaster@codeproject.com just tried to send me klez! Josh Knox
We will rid the world of buttmunching pussnuts. Armed only with my blunt spoon of death and my circumcising potato peeler. Death and torture to them all. - Michael Martin
-
This isn't <b>really</b> a programming