Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
hyperPad

hyperPad Forum

  1. Home
  2. Bug Reports
  3. Non-Issue
  4. Rounding Error for Object Positions on iPad Pro 11"

Rounding Error for Object Positions on iPad Pro 11"

Scheduled Pinned Locked Moved Non-Issue
3 Posts 2 Posters 1.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • DavioD Offline
    DavioD Offline
    Davio
    wrote on last edited by Davio
    #1

    I came across a rounding error in the iPad Pro 11" mode (with ratio 199:139).

    If an object is at the Y position Height/2
    And I try the if statement
    { if Obj.pos.y = height/2 }
    It turns out they are not equal

    This is because:
    The height/2 = 18.65625
    The obj.pos.y = 18.6563

    So it seems that the position of objects are rounded to the 4th digit.
    Is there anyway that you guys could make the precision better?
    Thank you!

    @Hamed @Murtaza

    1 Reply Last reply
    0
    • DavioD Offline
      DavioD Offline
      Davio
      wrote on last edited by Davio
      #2

      iPad Model: iPad Pro 10.5" 2nd Generation
      iOS version: 12.1
      hyperPad Version: 1.22
      Description: Object's positions are rounded to the 4th digit automatically instead of saving exact position
      Steps to reproduce:
      0- Set aspect ratio to 199:139 (iPad Pro) in the editor
      1- Set an object's y position to height/2
      2- Create an if statement that says { if object.pos.y = height/2 }
      Additional info:
      One workaround is to round both values to the 4th digit and then do the if statement comparing the rounded values. However, since I have many if statements, making the app compatible for 199:139 devices will be tricky.

      1 Reply Last reply
      0
      • HamedH Offline
        HamedH Offline
        Hamed
        Admin
        wrote on last edited by
        #3

        @davio said in Rounding Error for Object Positions on iPad Pro 11":

        1- Set an object's y position to height/2

        @Davio you really shouldn't be doing this because there will always be floating point rounding errors like this.

        If you really need to check positions like that, I suggest checking for a range of values eg. If y > height / 2 + 2 and If y < height / 2 - 2.

        1 Reply Last reply
        0

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Search