# Logstash ruby filter math on very large numbers

**URL:** <https://discuss.elastic.co/t/logstash-ruby-filter-math-on-very-large-numbers/261950>\
**Category:** Logstash\
**Created:** [January 22, 2021, 6:26pm UTC](https://discuss.elastic.co/t/logstash-ruby-filter-math-on-very-large-numbers/261950 "2021-01-22T18:26:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrew22](https://avatars.discourse-cdn.com/v4/letter/a/f6c823/32.png) [@Andrew22](https://discuss.elastic.co/u/Andrew22)\
**Post date:** [January 22, 2021, 6:26pm UTC](https://discuss.elastic.co/t/logstash-ruby-filter-math-on-very-large-numbers/261950/1 "2021-01-22T18:26:18Z")

</div>

Hello,

I am trying to do some math on some very large numbers in logstash and it appears that the .to\_f is not large enough as its giving me very inaccurate information. is there anything larger than a float I can use?

here is my bit of code

```
ruby {
           code => event.set('in_diff, (event.get('in').to_f - event.get('in_old').to_f))

}

```

As an example the number I am trying to do math on is over 1,000,000,000,000

---

<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:** [February 19, 2021, 6:26pm UTC](https://discuss.elastic.co/t/logstash-ruby-filter-math-on-very-large-numbers/261950/2 "2021-02-19T18:26:18Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
