[PD] how to get big numbers from array into a file?

Christof Ressi info at christofressi.com
Fri May 7 17:21:30 CEST 2021


Thanks for stressing the differences between 64bit and double precision!

However, I think it's not about double precision, either. Single 
precision only becomes an issue if you need more than 23 bits precision 
(which is not the case here).

The actual issue is how Pd *prints* floating point numbers when writing 
text files. It uses the %g print specifier, which automatically switches 
to scientific notation beyond a certain number of digits. See the 
implementation of "atom_string".

My example with [makefilename %f] shows that you can indeed print/save 
numbers with much higher precision - without the need of double 
precision floating point numbers. But as you have correctly pointed out, 
excessive use can lead to "symbol table pollution". Note that Pd has 
recently increased the size of its symbol table by a factor of 16 
(https://github.com/pure-data/pure-data/commit/36eefd23d793969d3c5c160d9986e0300c474bab), 
so the problem has been mitigated somehow, but not completely eliminated.

I'm not sure how to solve this... the problem is that "atom_string" is 
used to *save* and *display* floats, but these two operations don't 
require the same amount of precision.

I think this has been discussed not too long ago. Maybe IOhannes remembers.

Christof

On 07.05.2021 16:53, hans w. koch wrote:
> there have been a few discussions around this last year (in which i was involved).
>
> 1. its not about pd 64bit (that is liekly already running on your machine)! its about pd double precision, which is possible to compile easily (as i found out, being a noob)
>
> 2. regarding the makefilename approach: be carefule, if you generate lots of numbers:
> https://lists.puredata.info/pipermail/pd-list/2020-10/128229.html
>
> 3. (one of) the other discussions: Problem With Correct Numbers In Pd Double Precision
> https://lists.puredata.info/pipermail/pd-list/2020-09/128107.html
>
> it ain´t easy…
>
>
>
>> Am 07.05.2021 um 16:33 schrieb Christof Ressi <info at christofressi.com>:
>>
>> If your numbers are integers, you can convert them to symbols with [makefilename %d] and add them to a text file, e.g. with [text set].
>>
>> If the numbers are floats, you can use [makefilename %f]. Unlike %g, the %f specifier prevents the use of scientific notation. See also https://stackoverflow.com/a/5913115/6063908.
>>
>> Works for me (tm).
>>
>> Christof
>>
>> On 07.05.2021 16:15, rolfm at dds.nl wrote:
>>> hi,
>>>
>>> i'm struggling with the way Pd handles numbers bigger then 999999.
>>>
>>> i have an array with thousands of numbers, which i write to a file to analyse them.
>>>
>>> however, as soon as a number is bigger then 999999 i get the abbreviated notation and am loosing the lower digits.
>>>
>>>
>>>
>>> in Pd i can make a big number showing all digits by transforming it into a symbol, e.g. with makefilename.
>>>
>>> but a thus created text-file does not work in a spreadsheet.
>>>
>>>
>>>
>>> probably there's a way to overcome this seemingly limitation, but i've not found it yet.
>>>
>>> anybody with a hint?
>>>
>>>
>>>
>>> rolf
>>>
>>>
>>>
>>> _______________________________________________
>>>
>>> Pd-list at lists.iem.at
>>>   mailing list
>>> UNSUBSCRIBE and account-management ->
>>> https://lists.puredata.info/listinfo/pd-list
>> _______________________________________________
>> Pd-list at lists.iem.at mailing list
>> UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
>
>
>
> _______________________________________________
> Pd-list at lists.iem.at mailing list
> UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list





More information about the Pd-list mailing list