0

floating-point

When doing math operation in cratedb, it produces floating point, here is how I create table in crate:

create table:

create table cash(date string, spend float);
insert into cash(date, spend) values ('2017-05-03', 55.55);
insert into cash(date, spend) values ('2017-05-03', 34.55);
insert into cash(date, spend) values ('2017-05-03', 87.55);
select (0 - spend) sp,* from cash limit 100;

the picture above is the result of executing the select sql

dataTypes in cratedb have no support for decimal, do you have any suggestions on handling this issue in cratedb?

thanks

Cœur
  • 37,241
  • 25
  • 195
  • 267
MayI
  • 53
  • 1
  • 9

1 Answers1

1

Thanks for reporting this. We fixed this issue already and it has also been released with CrateDB 1.1.3 (stable).

As a side note:
This improvement checks if an expression consisting of an arithmetic operator and a decimal value only contains float types. If this is the case the resulting data type will be of type float. In case the expression contains decimal values of type double the behavior is like before and the result type will also be a representation of type double.