# Using assert\_in\_delta for floats with extended notation

**URL:** <https://www.ruby-forum.com/t/using-assert-in-delta-for-floats-with-extended-notation/106457>\
**Category:** Ruby\
**Created:** [June 10, 2007, 8:55pm UTC](https://www.ruby-forum.com/t/using-assert-in-delta-for-floats-with-extended-notation/106457 "2007-06-10T20:55:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [June 10, 2007, 8:55pm UTC](https://www.ruby-forum.com/t/using-assert-in-delta-for-floats-with-extended-notation/106457/1 "2007-06-10T20:55:58Z")

</div>

Hi all,

For comparing floats I normally do something like this:

assert\_in\_delta(‘100.324’, ‘100.32’, 0.01)

However, for extended notation it breaks down:

assert\_in\_delta(1.34341429278853e+15,  
18446744073709551616.quo(13731.24), 1.0)

That gives me a failure. What’s the proper way to test this?

Thanks,

Dan

---

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [June 12, 2007, 2:44am UTC](https://www.ruby-forum.com/t/using-assert-in-delta-for-floats-with-extended-notation/106457/2 "2007-06-12T02:44:07Z")

</div>

On Jun 11, 5:32 pm, “Jano S.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > However, for extended notation it breaks down:  
> > assert\_in\_delta(1.34341429278853e+15, 18446744073709551616.quo(13731.24), 2.0)
> 
> works. (the difference is 1.75)
> 
> Jano

Thanks. I suck.

Dan

---

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [June 12, 2007, 1:33am UTC](https://www.ruby-forum.com/t/using-assert-in-delta-for-floats-with-extended-notation/106457/3 "2007-06-12T01:33:02Z")

</div>

On 6/10/07, Daniel B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> That gives me a failure. What’s the proper way to test this?
> 
> Thanks,
> 
> Dan

assert\_in\_delta(1.34341429278853e+15,  
18446744073709551616.quo(13731.24), 2.0)

works. (the difference is 1.75)

Jano
