【发布时间】:2020-10-28 17:11:47
【问题描述】:
我注意到 int64 类型精度丢失,在我的项目 Firebase 实时数据库中:
- 当我添加新的孩子或在浏览器中编辑孩子的值时;
- 当我通过我的 (C++) 代码添加新子项或编辑子项值时:设置为 SetValue(int64_t) 甚至设置为 SetValue(firebase::Variant::kTypeInt64);
53位后开始丢失精度:
// 9007199254740991 <- I set 53 bits value.."11111111111111111111111111111111111111111111111111111";
// 9007199254740991 -> it records correctly;
// 18014398509481983 <- I set 54 bits value."111111111111111111111111111111111111111111111111111111";
// 18014398509481984 -> it records as......"1000000000000000000000000000000000000000000000000000000";
// seems it declared as int64_t but saved as float?
- 有人可以复制吗?
- 是错误还是功能?
【问题讨论】:
标签: firebase firebase-realtime-database precision int64