Re: TIB: Fractions in Output


[Prev][Next][Index][Thread]

Re: TIB: Fractions in Output




Hey Thanx..


>You'll need to write a fraction routine prog.... (note I think this'll only
work
>for positive fractions, the rounding check would need to be changed to work
both
>ways I think, I just don't want to think that much...)
>a sub prog is easiest, in main, you store x,y, and num
>then sub prog tries many denominators
>for(C,2,999)
>if (C*num)==int(c*num)
>then
>D=1+int (log (C*num))  //store decimal places of numerator, easier way?
>output(y,x,c*num)  //numerator
>output(y,x+D,"/")// divided by
>output(y,x+D+1,C) //denominator
>return   //stop the sub prog
>end
>end  //we are done
>disp "Can't make fraction"
>Stop
>
>
>See if that works.....let the list know, and if anyone feels like
optimizing, go
>right ahead, PLEASAE!