# Can I set the precision of a double comparison?

**URL:** <https://discuss.elastic.co/t/can-i-set-the-precision-of-a-double-comparison/23765>\
**Category:** Elasticsearch\
**Created:** [June 16, 2015, 4:51pm UTC](https://discuss.elastic.co/t/can-i-set-the-precision-of-a-double-comparison/23765 "2015-06-16T16:51:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jdh2550](https://avatars.discourse-cdn.com/v4/letter/j/e19adc/32.png) [@jdh2550](https://discuss.elastic.co/u/jdh2550)\
**Post date:** [June 16, 2015, 4:51pm UTC](https://discuss.elastic.co/t/can-i-set-the-precision-of-a-double-comparison/23765/1 "2015-06-16T16:51:02Z")

</div>

Is it possible to set the precision of a double comparison?

e.g. in index I have 0.127 and (due to rounding errors) my search query is generated as 0.12700000001. Is there a way to tell ES to only use the first N significant digits when doing the comparison?

Thanks.  
John H.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 12:07am UTC](https://discuss.elastic.co/t/can-i-set-the-precision-of-a-double-comparison/23765/2 "2017-07-06T00:07:14Z")

</div>


