[PD] number to fractions external?

i go bananas hard.off at gmail.com
Fri Dec 16 07:46:37 CET 2011


i had a go at it.  This one converts up to 5 decimal places (you could
probably mod it to do more, but then you get pretty close to the limits of
float-based arithmetic, i think).

i was getting glitches, because of the known issue where 58/1000 comes out
as 57.99999..  , so i have just added a tiny amount to each number to stop
this.

also, the one i have done here splits a number into whole and fractional
parts, but it would be trivial to multiply the whole by the denominator to
express the number as a vulgar fraction (3/2, etc)






On Fri, Dec 16, 2011 at 11:52 AM, Alexandre Torres Porres
<porres at gmail.com>wrote:

> hi there,
>
> Is there an external that converts decimal numbers to fractions, like 1.5
> => 3 / 2 ?
>
> I bet it's complicated to do it as a vanilla patch, right?
>
> thanks
> alex
>
> _______________________________________________
> Pd-list at iem.at mailing list
> UNSUBSCRIBE and account-management ->
> http://lists.puredata.info/listinfo/pd-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20111216/132c1133/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dec2frac.pd
Type: application/octet-stream
Size: 1717 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20111216/132c1133/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dec2frac-help.pd
Type: application/octet-stream
Size: 465 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20111216/132c1133/attachment-0001.obj>


More information about the Pd-list mailing list