[PD] more about float limitation

Claude Heiland-Allen claude at mathr.co.uk
Tue Feb 3 20:08:52 CET 2015


Hi,

On 03/02/15 18:37, Miller Puckette wrote:
> The binary compatibility problem needs careful thought.  I think the
> ugliest issue is that for Macintosh, the fat binary format can't very
> easily hold two versions of the same extern, same architecture, but different
> float types - so there would have to be d_fat with 32-bit and
> IA64, 32-bit-float versions (as now) and yet another extent (.d_double?)
> to hold the 64-bit-double version in a separate file.  Yuck....

I guess extra extensions would be needed for the other OS too.

What about making it mandatory for double precision externals to define 
a specially named symbol?  Then Pd could check for the existence (and 
value if it exists) of this symbol before deciding whether it's safe to 
run the setup function.  If the symbol doesn't exist, Pd should assume 
it's using 32bit float, and if Pd is using 64bit float it should refuse 
to load it.

Something like this for external sources (untested):

----8<----
#include "m_pd.h"

#ifdef PD_DOUBLE
extern int myextern_fp = 64;
#else
extern int myextern_fp = 32;
#endif

extern void myextern_setup(void) {
   ...
}
----8<----

with approriate C preprocessor macro magic in "m_pd.h", it could 
simplify to something more like this:

----8<----
#inlude "m_pd.h"

PD_DECLARE_FP(myextern)

extern void myextern_setup(void) {
   ...
}
----8<----

Which is just one extra line for each setup function, and makes it easy 
to see in the source that an external has been adapted to be compatible 
with both pd-float and pd-double.

> On Tue, Feb 03, 2015 at 06:16:39PM +0100, katja wrote:
>> By the way here's a video about precision in Pd, with the latter part
>> showing double precision in action:
>>
>> https://www.youtube.com/watch?v=93632nc8LVs

Very nice!


Claude
-- 
http://mathr.co.uk




More information about the Pd-list mailing list