[F] Two $num failures

  1. $num fails with numbers that though large are within script arithmetic range e.g.

    Pad UPC 043011001826 to EAN: $num(043011001826,14) (expected 0043011001826)
    Compute 043011001826+1: $add(043011001826,1) (expected 43011001827 and got same)
    gives

Pad UPC 043011001826 to EAN: 2147483647 (expected 0043011001826)
Compute 043011001826+1: 43011001827 (expected 43011001827 and got same)

  1. $num fails when asked for more than five digits e.g.

    Pad catalogue number to six places: $num(1826,6) (expected 001826)
    gives

Pad catalogue number to six places: 01826 (expected 001826).

The $num function is limited to 5 digits. I'll update the documentation.

Thanks. But note that even with five digits it can fail e.g. $num(3011001826,5) -> 2147483647 .

This is the upper limit of the int data type. Maybe I can use 64 bit ints.

I've found a solution which removes broadens the limits. It will be included in the next release.

This is the upper limit of the int data type.

Doesn't the $add example show otherwise?

$add already uses 64 bit instead of 32 bit integers.

$add already uses 64 bit instead of 32 bit integers.

Ah, so $add and $num use different types...

I've found a solution

Thanks!

It has been changed in the current Development Build.

Confirmed - both examples work in V2.39f.

Thanks! And thanks for the handy expression evaluator on ALT-1! :wink:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.