maybe this can help you make a full vanilla abstraction
https://github.com/porres/pd-else/blob/master/Classes/Abstractions/hex2dec.p...
Em ter., 19 de jan. de 2021 às 21:22, oliver oliver@klingt.org escreveu:
hi,
i'm trying to convert arbitrary hexadecimal numbers to decimal ones, preferably with vanilla objects.
while it's easy to do it the other way round with [makefilename], i'm facing a peculiar problem from hex --> dec when the letter E is present and followed by a number.
my approach would be to take a hex number, interpret it as a symbol, get each hex-digit's ascii value, and do the conversion from there
let's take the hex number 27E5 as an example
no matter what sort of conversion i try ([symbol], [list tosymbol], [makefilename], [fudiformat]), PD always interprets it as a decimal number with an exponent, so
[27E5( | makefilename %s | [print]
will give me "symbol 2.7e+006" in the console (or in a symbol atom).
(of course a number like 27A5 or 275E expands with no problem to a straight symbol and can then be ascii-fied)
is there anything i can do to make PD take 27E5 as a literal symbol rather than a float ?
best
oliver
-- \\\\\\\\\\\\\\\\\\\\\\\\\\\\ /////////////// http://pendler.klingt.org ////////////// \\\\\\\\ http://oliver.klingt.org \\\\\\\ ////////////////////////////////////////////////////////
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list