[F] Two $num failures

bug-fixed

#1
  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).


Search failure
#2

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


#3

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


#4

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


#5

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


#6

This is the upper limit of the int data type.

Doesn't the $add example show otherwise?


#7

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


#8

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

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

I've found a solution

Thanks!


#9

It has been changed in the current Development Build.


#10

Confirmed - both examples work in V2.39f.

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