Decimal -> Numerator/Denominator ?
Hey all,
I don't seem able to find an easy object for this, and I'm kind of scratching my head. Before I spend a day writing an abstraction that does this, I thought I'd hit up our forum:
I need to be able to convert a decimal to the simplest approximate integer-over-integer fraction. I see an abstraction that takes a floating point in an inlet and has three outlets - outlet1: numerator, outlet2:denominator, outlet3: the difference between absolute and approximation (I guess "remainder" isn't the right word, but I would prefer a round fraction with a margin of erre as long as I could get a value on the difference).
It's hard to believe that someone hasn't had to tread this path before... anybody got any suggestions?
thanks and happy patching,
Taylor
Look at the 'bach' package. It has objects for rational numbers and conversions.
thanks, broc. I have that installed i'll go straight to it. i imagine i would be using it for the same purposes.
broc for the win! thank you, this is exactly what I needed, and knew was lurking around in my objects. that is perfect. thanks again.