Ok, I got one. It finds the great common divisor. I divide the numerator and denominator by it. Then I do an if statement to see if the numerator is greater then the denominator. If so, I divide them by each other. How can I tell if there's a remainder, and if so, put it into a fraction in simpliest form?

## Advertising

----- Original Message ----- From: "Ray Hunter" <[EMAIL PROTECTED]> To: "Stephen" <[EMAIL PROTECTED]> Cc: "PHP List" <[EMAIL PROTECTED]> Sent: Monday, December 09, 2002 6:38 PM Subject: Re: [PHP] Fractions > If there are none in the math functions then you need to create your own > or do a search at google to see if anyone has created some functions > like that... > > > > On Mon, 2002-12-09 at 16:20, Stephen wrote: > > But how do you find it in PHP? > > > > > > ----- Original Message ----- > > From: "Ray Hunter" <[EMAIL PROTECTED]> > > To: "Stephen" <[EMAIL PROTECTED]> > > Cc: <[EMAIL PROTECTED]> > > Sent: Monday, December 09, 2002 6:12 PM > > Subject: Re: [PHP] Fractions > > > > > > > Just like math...find the greatest common denominator of the numerator > > > and denominator and then divide each (numerator and denominator) by that > > > number... > > > > > > ie: numerator = 8 and denominator = 12 > > > > > > so we have 8/12 > > > > > > then greatest common denominator is 4... > > > > > > so 8/4 = 2 and 12/4 = 3 > > > > > > thus, 8/12 => 2/3 > > > > > > > > > On Mon, 2002-12-09 at 15:55, Stephen wrote: > > > > I know for a fact that you're all going to think, "What the heck does > > > > he want fractions for!?" I have a reason...I just won't tell you. :-P > > > > > > > > My problem is this. I want to simplify a fraction to simplest form but > > > > if I divide, I'll get a decimal which I can't use. How could I put it > > > > in simplest form without displaying a decimal to the user and if one > > > > does come up, a mixed number? > > > > Thanks, > > > > Stephen Craton > > > > http://www.melchior.us > > > > > > > > "What is a dreamer that cannot persevere?" -- http://www.melchior.us > > > > > > > > ______________________________________________________________________ > > > > > > > > -- > > > > PHP General Mailing List (http://www.php.net/) > > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- > > > > > > Ray Hunter > > > email: [EMAIL PROTECTED] > > > www: http://venticon.com > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > -- > > Ray Hunter > email: [EMAIL PROTECTED] > www: http://venticon.com > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php