Hi @mwiegand , I think the issue is indeed one of precision.
Unfortunately the precision of a java Double data type is notoriously poor, when we get to large values.
So… as per the previous suggestion, you have attempted to use Long, but…
Unfortunately, KNIME’s support for Long is very poor!
- its presence breaks the String Manipulation (multi) node
- String Manipulation (Variable) cannot see Long variables
- Math Formula (Variable) cannot see Long Variables
- Variable Expressions cannot see them or create them
- Java Edit Variable cannot read or create Long variables. It can only create Integer variables.
… the list probably goes on!
The last point I think is what is “breaking” the int version of your code.
Such issues have caused me to wonder exactly what data type we should be using for large values, as KNIME has no numeric datatypes that can handle large values with good precision across its nodes.
Back to your specific issue with the “int” version… If you look at the output for your Int metanode, you can see that it begins to switch between negative and positive results, which is a sure sign the value has gone “round the clock” and busted the Integer range limit.
So what to do?
While doing a bit of research here, I found that to get a java edit variable to sucessfully perform your required Long calculations would involve using a whole succession of nodes such as this example:
Basically, you need to convert (marshal) the Long variables to Strings and within Java Edit Variable you would have code such as this, to calculate the result of these as Longs, and then output this again as a String, e.g.
But then another thought occurred to me, that if we need to do all of this using String Manipulation (ironically, one of the very few nodes that can actually handle Longs!), then why not just use String Manipulation for the job of calculating:
e.g. given two Long variables:
The result of the sum of two Longs can be calculated by String Manipulation (edit: after they have been converted into columns!) as follows:
I haven’t tried plugging such functionality into your workflow, but I suspect that if it could be incorporated in place of the Java Edit variables, you would get closer to the result that you are looking for.
Better support for Longs is long overdue in KNIME though, and if I could change just one thing about KNIME it would be this!