[PD] Infinite and NaN float values?

Matteo Sisti Sette matteosistisette at gmail.com
Mon Aug 16 20:26:51 CEST 2010


Here's a test patch.

Inf and NaN seem to be treated almost correctly (except NaN is displayed 
as "-nan"), but not all mathematical operation that should generate them 
actually do (indeed it seems you can only get Inf by overflow)

On 08/16/2010 07:59 PM, Matteo Sisti Sette wrote:
> Hi,
>
> I've found out that making a float grow and grow and grow it eventually
> reaches a value that is displayed in number boxes as "+Inf".
>
> Then if I multiply that number by 0 I get a value that is displayed in a
> number box as "NaN".
>
> Is this expected behaviour? If so i guess infinities and NaN have been
> recently introduced, haven't they?
>
> However there seem to be some inconsistency: 5/4 returns 0 (as I was
> used to), not +inf. Also, I'm not sure +inf is the value you expect when
> adding something to the greatest representable value... or is it?
>
> Also I cannot seem to find a way to write inf's or NaN as a literal (in
> a message box), and I cannot find an [isNaN] or similar object... that's
> why I wonder if this is a feature or a bug.
>
>
> Also, sliders seem not to like them.
>
> If you feed a NaN (or maybe +Inf, I'm not sure) to a slider, it makes
> the cursor disappear (which is probably OK for NaN), but then you
> suddenly get weird behaviour of the window: a scrollbar with a very
> small cursor appears as if the patch window had become suddenly huge and
> it may scroll away so you cannot see the patch content any more and you
> may not be able to scroll it.
>
> It seems like it is actually trying to draw the slider's cursor far
> away, which doesn't happen with huge but finite numbers....
>
>
> I'm trying to build a simple test patch, but I'm having difficulties.
> I can reproduce it with a patch that is pretty simple but doesn't quite
> isolate the "issue" (or non-issue) in a decent way.
> I'll post it if I cannot end up with anything better
>
> Cheers
> m.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_infnan.pd
Type: text/x-puredata
Size: 2976 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20100816/c0009044/attachment.bin>


More information about the Pd-list mailing list