# Expression not evaluating correctly

**URL:** <https://forum.kirupa.com/t/expression-not-evaluating-correctly/27910>\
**Category:** flash\
**Created:** [August 7, 2003, 8:45pm UTC](https://forum.kirupa.com/t/expression-not-evaluating-correctly/27910 "2003-08-07T20:45:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![arz172](https://avatars.discourse-cdn.com/v4/letter/a/ee59a6/32.png) [@arz172](https://forum.kirupa.com/u/arz172)\
**Post date:** [August 7, 2003, 8:45pm UTC](https://forum.kirupa.com/t/expression-not-evaluating-correctly/27910/1 "2003-08-07T20:45:30Z")

</div>

Hi,  
I have three movie clips on my stage all are at y=388.9. In the actionscipt for the movie clips I have this statement…

if (this.\_y==388.9){  
trace(‘something!’);  
}  
else{  
trace(‘nothing’);  
trace(this.\_y);  
}  
Output:  
nothing  
388.9

everytime this is run the expression results in false and ‘nothing’ and the y coordinate (388.9) print out.

Does anyone know why this expression evaluates to false even though this.\_y is 388.9?

I must be missing something. All the other movie clips at different y values evaluate correctly.

Thanks.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 7, 2003, 8:56pm UTC](https://forum.kirupa.com/t/expression-not-evaluating-correctly/27910/2 "2003-08-07T20:56:50Z")

</div>

its just one of those crazy rounding deals.  
[http://www.macromedia.com/support/flash/ts/documents/roundoff\_error.htm](http://www.macromedia.com/support/flash/ts/documents/roundoff_error.htm)

this one is odd because its not evident in a trace, but you can fix it by forcing a round of the \_y

if (Math.round(this.\_y\*10)/10 == 388.9){

^using round with the \*10 and /10 rounds the value to the nearest 10th and then you’ll have yourself a sure winner.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 7, 2003, 9:19pm UTC](https://forum.kirupa.com/t/expression-not-evaluating-correctly/27910/3 "2003-08-07T21:19:43Z")

</div>

Thank you. That fixed it.
