# How to exclude "inf(inite)" values when checking laser values?

**URL:** <https://get-help.theconstruct.ai/t/how-to-exclude-inf-inite-values-when-checking-laser-values/1762>\
**Category:** Python Basics For Robotics\
**Created:** [December 23, 2019, 5:42am UTC](https://get-help.theconstruct.ai/t/how-to-exclude-inf-inite-values-when-checking-laser-values/1762 "2019-12-23T05:42:50Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![ralves](https://get-help.theconstruct.ai/user_avatar/get-help.theconstruct.ai/ralves/32/7039_2.png) [@ralves](https://get-help.theconstruct.ai/u/ralves)\
**Post date:** [January 27, 2020, 10:17pm UTC](https://get-help.theconstruct.ai/t/how-to-exclude-inf-inite-values-when-checking-laser-values/1762/5 "2020-01-27T22:17:44Z")

</div>

Hi @dave.m.mckay,

A good way of ignoring laser values with infinite is checking whether the laser value is `inf`.  
In your code below:

```
distance = float(laser)
if biggest < distance:
    biggest = distance

```

this could be achieved with (note `and distance != inf`):

```
inf = float('inf')

```

…

```
distance = float(laser)
if biggest < distance and distance != inf:
    biggest = distance

```

This should solve the problem.

Please let us know in case you have more questions.

---

_[View the full topic](https://get-help.theconstruct.ai/t/how-to-exclude-inf-inite-values-when-checking-laser-values/1762)._
