He is using “eq”, equal to. By design seems logic to not return anything. For the query is not exactly the same as the one recorded. I would recommend using inequality combined with less than and greater than or equal.
{
query(func: has(test))@filter(ge(test,37.796975) OR le(test,37.79697544)){
test
}
}
As it comes to float I do not know what the implication would be. Your call @paulftw . Let’s take the fractions of Bitcoin for example.
PS. Yeah, @paulftw I noticed right now that the correct thing was to return the recorded number completely. And that does not happen. It’s a bug or okay? (*) limitation?.
*I do not think it’s ok, it can be problematic for developers working with fractions.
{
query(func: has(test))@filter(ge(test,37.796975) OR le(test,37.796975)){
test
}
{
query2(func: has(test))@filter(eq(test,37.796975)){
test
}
}
{
query3(func: has(test))@filter(eq(test,37.79697544)){
test
}
}
}
{
"data": {
"query": [
{
"test": 37.796975 #should return the whole number 37.79697544
}
],
"query2": [],
"query3": [
{
"test": 37.796975 #should return the whole number mainly here.
}
]
}
Hi there, so… any updates here? Now I’ve been working with float number and rounding is very annoying. I want to get the whole number, not only 6 digit after point
Can you clarify your use case and the impact? Regrettably, the issue with computers using binary but humans decimal causes some rounding at some level of precision pretty much no matter what.
So if you are storing a value using a decimal representation, and it is stored slightly differently due to finite precision and binary conversion, but trying to do an exact match, I do not know if that will ever work, regardless of adding a couple digits more precision.
Let us know your use case and we can consider approaches, though.