Using assert_in_delta for floats with extended notation

D

Daniel Berger

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
 
J

Jano Svitok

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

assert_in_delta(1.34341429278853e+15, 18446744073709551616.quo(13731.24), 2.0)

works. (the difference is 1.75)

Jano
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,261
Messages
2,571,308
Members
47,967
Latest member
pakasi

Latest Threads

Top