Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python Cassandra floating precision loss

I'm sending data back and forth Python and Cassandra. I'm using both builtin float types in my python program and the data type for my Cassandra table. If I send a number 955.99 from python to Cassandra, in the database it shows 955.989999. When I send a query in python to return the value I just sent, it is now 955.989990234375.

I understand the issue with precision loss in python, I just wanted to know if there's any built-in mechanisms in Cassandra that could prevent this issue.

like image 504
user2361174 Avatar asked Mar 08 '23 14:03

user2361174


1 Answers

Python float is an 64-bit IEEE-754 double precision binary floating point number. Use double in Cassandra for a matching type.

like image 192