Re: TIB: Fractions in Output


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

Re: TIB: Fractions in Output




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!


Andrew Boudreau wrote:

> Well after a couple hours of looking i can not find anyother way to output a
> fraction into program screen then to disp ###/>/FRAC.  I don't want this i
> want to outpt(3,2,A/B/>/Frac)  Is there anyway to do this converting it to a
> string doesn't work.  and that above doesn't work. What can i do.
>
> Andrew <johnpb@keynet.net>




References: