vmtrue
vmtrue

Reputation: 1774

Sqlite sum incorrect result

I tried calculate some result by sqlite. My query is SELECT SUM(value) FROM Transaction. I noticed strange behaviour. When result < 6 characters is ok, when result > 6 characters sqlite round result. For example if result 12345678 then sqlite return 1.23456e+07. Can anyone explain?

I use ormlite for work with sqlite on android. The value is BIG_DECIMAL. Ormlite store it like VARCHAR.

Upvotes: 1

Views: 388

Answers (1)

laalto
laalto

Reputation: 152817

It's not an incorrect result but just the result formatted in scientific E notation.

Assuming the value is a double in your code, the behavior is documented in Double.toString(double).

Upvotes: 2

Related Questions