Text funnels work well with numeric data

An aspect of Panorama X that’s not made clear in the documentation is that, unlike Panorama 6, text funnels work with both integer and floating-point arguments, with the decimal point counted as a character in the latter case. I haven’t conducted an exhaustive test but nor have I yet encountered a structure that didn’t work.

I mention this in case it’s of use to anybody.

I think you’ll find that this depends on whether you are formatting the numbers the same way the str( function does. Text funnels only work on text, but if you provide it with a number, it will convert it to text, and then operate on that. If you use scientific notation, and str( doesn’t, or vice versa, you may not get the result you want.

Here is an example of what I am talking about.

Local A,B
A = 123
B = 0.0000345
message A + B[".",-1]

The message is 123.45e-05

When A was converted to text, it was converted to “123”. When B was converted to text, it was converted to “3.45e-05”. The text funnel took everything from the decimal point to the end, returning “.45e-05”, and then they were concatenated.

Yes, there are exceptions but I’ve found it useful and reliable with integers. Here’s a really odd example of how it doesn’t always work:

local a11
a11 = 608530.36
message a11[-4,-1]
a11 = 601833.32
message a11[-4,-1]

The first message is 0.36 but the second is 9999 - that’s really weird.

Neither .36 nor .32 has an exact binary representation. When the nearest binary equivalent to 608530.36 is converted back to decimal and rounded to 16 significant digits the result is 608530.3600000000 and the trailing zeroes are discarded. When the nearest binary equivalent to 601833.32 is converted back to decimal, and rounded to 16 significant figures, the result is 601833.3199999999, and since there are no trailing zeroes, all the digits are retained.

1 Like

Another brilliant piece of analysis Holmes :slight_smile: