@TxH The issue is the 'Numeric Formula' you are using in your Sum() function. It's getting evaluated for EACH ROW not for the entire "decVal" column.
Eg
for error HexNum = 20000000000001 Sum(decVal) returns Sum([-1,0,0,0,0,0,0,0,0,0,0,0,0,1]) = 0;
for error HexNum = 20000000000002 Sum(decVal) returns Sum([-1,0,0,0,0,0,0,0,0,0,0,0,0,2]) = 1;
You can test this with a slightly different number to get a better idea of what's happening
eg 20000000000302 = (-1) + 768 + 2 = 769
I managed to fix this for you by adding a condition inf front of the Sum() function. I'm not 100% sure this meets your needs but with my testing it throws -1 when it needs to. You maybe able to refactor my code down to something easier to read though?
Here's my code for the 'Result' text label:
// check for > max(int) => returns unexpected results
With({/* remove leading '#' or "0x" */
hexStr:If(Left(hexStr.Text,1)="#",Mid(Upper(hexStr.Text),2,Len(hexStr.Text)-1),If(Left(Lower(hexStr.Text),2)="0x",Mid(Upper(hexStr.Text),3,Len(hexStr.Text)-2),Upper(hexStr.Text))),
/* highest supported int value */
maxSaveInteger:9007199254740991},If(IsMatch(hexStr,"^[A-F0-9]{1,14}$"),
// ***** start of extra If()
If(Sum(AddColumns([1,2,3,4,5,6,7,8,9,10,11,12,13,14],"decVal",If(Value<=Len(hexStr),(Find(Mid(hexStr,Value,1),"0123456789ABCDEF")-1)*Power(16,Len(hexStr)-Value),0)),decVal)<=maxSaveInteger,
Sum(AddColumns([1,2,3,4,5,6,7,8,9,10,11,12,13,14],"decVal",If(Value<=Len(hexStr),(Find(Mid(hexStr,Value,1),"0123456789ABCDEF")-1)*Power(16,Len(hexStr)-Value),0)),
/** return sum of decimal values
* fails if sum > 9007199254740991
*/
// ***** remove existing If() from here
decVal),-1),
/* invalid hex string, return -1 */
-1))
Note the // ***** parts where I've added some extra comments.
Let me know if this helps?