0 Replies Latest reply on Jun 8, 2006 1:30 AM by Silent_Scope

    Discrepency when using comparison operator?

    Silent_Scope
      Dear all!

      I noticed there are some discrepency in result when using comparison operator between _width and a constant number.

      In my test setup, I drew an arbitrary shape and converted it to a movieclip with the name "platform". Then I assigned a frame action script to it.

      Finally I proceeded to "Control > Test Movie". Here is my test trace output:
      quote:

      Pass by value test
      mywidth = 1281.8
      Is mywidth >= mywidth ? = true
      Is mywidth <= mywidth ? = true
      Is mywidth == mywidth ? = true
      Is mywidth >= 1281.8 ? = true
      Is mywidth <= 1281.8 ? = false
      Is mywidth == 1281.8 ? = false
      Is 1281.8 >= mywidth ? = false
      Is 1281.8 <= mywidth ? = true
      Is 1281.8 == mywidth ? = false

      _width test
      platform._width = 1281.8
      Is platform._width >= platform._width ? = true
      Is platform._width <= platform._width ? = true
      Is platform._width == platform._width ? = true
      Is platform._width >= 1281.8 ? = true
      Is platform._width <= 1281.8 ? = false
      Is platform._width == 1281.8 ? = false
      Is 1281.8 >= platform._width ? = false
      Is 1281.8 <= platform._width ? = true
      Is 1281.8 == platform._width ? = false

      _height test
      platform._height = 173
      Is platform._height >= platform._height ? = true
      Is platform._height <= platform._height ? = true
      Is platform._height == platform._height ? = true
      Is platform._height >= 173 ? = true
      Is platform._height <= 173 ? = true
      Is platform._height == 173 ? = true
      Is 173 >= platform._height ? = true
      Is 173 <= platform._height ? = true
      Is 173 == platform._height ? = true

      _x test
      platform._x = -18
      Is platform._x >= platform._x ? = true
      Is platform._x <= platform._x ? = true
      Is platform._x == platform._x ? = true
      Is platform._x >= -18 ? = true
      Is platform._x <= -18 ? = true
      Is platform._x == -18 ? = true
      Is -18 >= platform._x ? = true
      Is -18 <= platform._x ? = true
      Is -18 == platform._x ? = true

      _y test
      platform._y = 267
      Is platform._y >= platform._y ? = true
      Is platform._y <= platform._y ? = true
      Is platform._y == platform._y ? = true
      Is platform._y >= 267 ? = true
      Is platform._y <= 267 ? = true
      Is platform._y == 267 ? = true
      Is 267 >= platform._y ? = true
      Is 267 <= platform._y ? = true
      Is 267 == platform._y ? = true



      I had expected it to be "true" for all. However, I noticed there are some "false" in my result, in particular for _width test. Does anyone know why this is so? Attached with this post is my source code. Please advice, many thanks in advance!