# Bug report: \<= doesnt work

**URL:** <https://forums.unrealengine.com/t/bug-report-doesnt-work/356988>\
**Category:** Community & Industry Discussion\
**Tags:** math, float, math-expression, unreal-engine, bug-report, question\
**Created:** [May 10, 2016, 1:56pm UTC](https://forums.unrealengine.com/t/bug-report-doesnt-work/356988 "2016-05-10T13:56:27Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_5de2a6ae1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_5de2a6ae1](https://forums.unrealengine.com/u/anonymous_user_5de2a6ae1)\
**Post date:** [May 10, 2016, 1:56pm UTC](https://forums.unrealengine.com/t/bug-report-doesnt-work/356988/1 "2016-05-10T13:56:27Z")

</div>

in my code the smaller or equal sign does not work on small fractions. my code compares \<=, they are equal but the node pumps out false. how can that be?

---

<div class="post-metadata">

**Author:** ![Sean\_Flint](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Sean\_Flint](https://forums.unrealengine.com/u/Sean_Flint)\
**Post date:** [May 10, 2016, 6:02pm UTC](https://forums.unrealengine.com/t/bug-report-doesnt-work/356988/2 "2016-05-10T18:02:35Z")

</div>

- Are you using code or blueprints?
- If code, could you please provide the code that you are using so I can see how you are using the operator? If blueprint, please provide a screenshot of the blueprint in question.
- Does this occur with whole numbers as well as precise decimals like you are using?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_5de2a6ae1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_5de2a6ae1](https://forums.unrealengine.com/u/anonymous_user_5de2a6ae1)\
**Post date:** [May 11, 2016, 7:23am UTC](https://forums.unrealengine.com/t/bug-report-doesnt-work/356988/3 "2016-05-11T07:23:41Z")

</div>

I’m using blueprints. I’ve never had this occur so I guess it only happens on precise decimals, or it was introduced in 11.2.

 ![90143-samplecode.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/3/7/9378abbf1be6377c5a98974c3ae63ce36427f7a7.png)

 ![90145-samplecode2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/6/2/2620fcba5ce27ba196b1e5ec6caf4149311ad127.png)

---

<div class="post-metadata">

**Author:** ![Sean\_Flint](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Sean\_Flint](https://forums.unrealengine.com/u/Sean_Flint)\
**Post date:** [May 11, 2016, 1:42pm UTC](https://forums.unrealengine.com/t/bug-report-doesnt-work/356988/4 "2016-05-11T13:42:55Z")

</div>

Hello,

After confirming that this was only happening with decimals, this leads me to believe that it is an issue with floats, which is not something that is an engine issue.

Have a look at this Answerhub post for suggestions on how to work around using floats: [Why does \<= only work as if it was \<? - Programming & Scripting - Unreal Engine Forums](https://answers.unrealengine.com/questions/298447/why-does-only-work-as-if-it-was.html)

Let me know if you have any other questions regarding this issue.

Have a great day

---

<div class="post-metadata">

**Author:** ![lordGoldemort](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@lordGoldemort](https://forums.unrealengine.com/u/lordGoldemort)\
**Post date:** [May 11, 2016, 2:40pm UTC](https://forums.unrealengine.com/t/bug-report-doesnt-work/356988/5 "2016-05-11T14:40:44Z")

</div>

You should _never_ check floats for equality, well unless you want an infuriating time 🙂 Use a small tolerance value.

```
float a,b;

...
if (a == b) // BAD PUSSYCAT!

if (abs(a-b) < 0.001) // GOOD KITTY!

```

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_5de2a6ae1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_5de2a6ae1](https://forums.unrealengine.com/u/anonymous_user_5de2a6ae1)\
**Post date:** [May 11, 2016, 7:36pm UTC](https://forums.unrealengine.com/t/bug-report-doesnt-work/356988/6 "2016-05-11T19:36:25Z")

</div>

Thanks for the info but I don’t understand why this happens. If the engine rounds up the floats in any way because they are the same it should round them also to same values. If something is equal then it is equal no matter how you look at it. If the engine cant tell 2 numbers are equal how does it do any of the things it does…
