Mathematical Functions | ArcGIS Arcade | ArcGIS Developer
While answering a question, I realized that Arcade treats null values as zero in the mathematical functions:
var data = [1, 2, 3]
var data_z = [1, 2, 3, 0]
var data_n = [1, 2, 3, null]
function print(f, d, z, n) {
Console("\n" + f)
Console("data: " + d)
Console("data_z: " + z)
Console("data_n: " + n)
}
print("Average", Average(data), Average(data_z), Average(data_n))
print("StDev", StDev(data), StDev(data_z), StDev(data_n))
print("Variance", Variance(data), Variance(data_z), Variance(data_n))
print("Min", Min(data), Min(data_z), Min(data_n))
Console("\nAbs(null): " + Abs(null))
Average data: 2 data_z: 1.5 data_n: 1.5 StDev data: 0.816496580927726 data_z: 1.118033988749895 data_n: 1.118033988749895 Variance data: 0.6666666666666666 data_z: 1.25 data_n: 1.25 Min data: 1 data_z: 0 data_n: 0
Abs(null): 0
In my opinion, this is wrong. Null means something very different from zero:
I think, null values should not be treated as zero. Instead,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.