If you have an integer-only expression you expect the result to remain integer, but here are a couple of instances where using a negative integer can result in a floating point result (note that the only way I know how to test for the resultant type is to use toString):
-
If the first (or only) value of the expression is a negative integer, as in
toString(-1+2,"%d")
-
If a variable in a with() or forEach() function is a negative integer, as in
with(-1,a,toString(2+a,"%d"))
In both of these cases the result is
Error: java.util.IllegalFormatConversionException: d != java.lang.Double
but if you use "%f" in the string conversion you get 1.000000 .
I am using OpenRefine Version 3.6.2 in Safari Version 16.1 on MacOS 12.6.1 .
If you have an integer-only expression you expect the result to remain integer, but here are a couple of instances where using a negative integer can result in a floating point result (note that the only way I know how to test for the resultant type is to use toString):
If the first (or only) value of the expression is a negative integer, as in
toString(-1+2,"%d")If a variable in a with() or forEach() function is a negative integer, as in
with(-1,a,toString(2+a,"%d"))In both of these cases the result is
Error: java.util.IllegalFormatConversionException: d != java.lang.Double
but if you use "%f" in the string conversion you get 1.000000 .
I am using OpenRefine Version 3.6.2 in Safari Version 16.1 on MacOS 12.6.1 .