Is there a simple method in PureData that converts a floating point number into a binary (base 2), ternary (base 3), quaternary (base 4), etc. floating point number? The patch has to work for any given floating point number, and one must be able to choose the desired base of the converted number.
-
How to convert the base of a floating point number in PureData?
-
@Nobody Yes for integers although the sign is lost........... mod-base.zip
Its 4 years since I put the help file together (other peoples work mostly)....... so it will take time to work out if it could be made to work for floating point values..... especially as I am uncertain as to how they should be represented....
David.
-
Can it also convert to ternary (base 3), quaternary (base 4), etc. numbers?
-
@Nobody Seems to. I checked it to decimal 100+ for ternary and did a cursory random check up to base 5. I added a right inlet to [f2bin] to change the base. The radio button in help.pd does that.
David. -
Thanks! Than I can probably use it in my current project. I will check it out later.
-
@Nobody For anyone else interested I have added a base selector to [bin2f] as well.....so that floats can be converted to any base and back again......binary2float2binary_any_base.zip
The representation as a list should be used for reconversion to decimal. The representation as a float is corrupted if the number of digits is too great..... which is more likely as the base is reduced towards 2.
David.
-
Great - thanks!