Question Details

No question body available.

Tags

time-series apache-iotdb

Answers (1)

June 30, 2026 Score: 3 Rep: 287,145 Quality: Medium Completeness: 80%

The current IoTDB docs don't seem to say anything about the tiebreaking behavior.

The 1.2.x docs for ROUND say the following, under the "Corresponding Implementation in the Java Standard Library" column:

Math#rint(Math#pow(10,places))/Math#pow(10,places)

but that can't be right, because that doesn't actually involve the input at all.

So let's check the source. After some digging through their Github, it looks like the 2.0.8 implementation of ROUND handles the rounding as

double res = Math.rint(values[i] Math.pow(10, places)) / Math.pow(10, places);

so they just forgot to put the input value in the expression in the 1.2.x docs.

The Math.rint part of this expression will do round-ties-to-even, but for a nonzero places value, the multiplication by Math.pow(10, places) introduces some rounding error that might cause a value very close to a rounding threshold to hit the threshold and produce a wrong rint output. For a places value of 0 (the default), this isn't an issue.

If you want to do round-ties-away-from-zero, I think you could handle that as

SIGNUM(value)
CEIL(FLOOR(ABS(value)2)/2)

Or for round-ties-toward-infinity,

CEIL(FLOOR(value
2)/2)