logo hyperPad Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Login

    Rounding Behaviour has a bug, or division by 1000x does.

    Scheduled Pinned Locked Moved
    Bug Reports
    4
    14
    415
    Loading More Posts
    • 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.
    • D
      Deeeds
      last edited by

      I'm doing x1000

      Round.

      Divide by 1000

      About every 20 of these, one pops out with something like:

      33.333000000000000001

      or

      33.333999999999999999

      iTap DevelopmentI Jack8680J 2 Replies Last reply Reply Quote 0
      • iTap DevelopmentI
        iTap Development @Deeeds
        last edited by

        @Deeeds yep...that happened to me when I made the weather app. I had to work around.

        1 Reply Last reply Reply Quote 0
        • Jack8680J
          Jack8680 @Deeeds
          last edited by

          @Deeeds I'm guessing it's a floating point rounding error. You could get around this by looping through the digits and rounding using trim text at he nth digit after the decimal point, but would be nice if this wasn't needed.

          HamedH 1 Reply Last reply Reply Quote 1
          • HamedH
            Hamed Admin @Jack8680
            last edited by Hamed

            @Jack8680 said in Rounding Behaviour has a bug, or division by 1000x does.:

            @Deeeds I'm guessing it's a floating point rounding error. You could get around this by looping through the digits and rounding using trim text at he nth digit after the decimal point, but would be nice if this wasn't needed.

            This is the case. Its a floating point issue. You should only be rounding your final calculated behaviour. You want to avoid rounding before your multiplies or divides.

            D iTap DevelopmentI 2 Replies Last reply Reply Quote 0
            • D
              Deeeds @Hamed
              last edited by Deeeds

              @Hamed what's the most efficient way to get a time in 3 decimal places, often, like this: 88.888

              1 Reply Last reply Reply Quote 0
              • iTap DevelopmentI
                iTap Development @Hamed
                last edited by

                @Hamed so then there is no way to round to a decimal?

                1 Reply Last reply Reply Quote 0
                • HamedH
                  Hamed Admin
                  last edited by

                  Right now, unfortunately, is @Jack8680 way of doing it. I'll add number of decimal places to Round number behaviour.

                  iTap DevelopmentI D 2 Replies Last reply Reply Quote 2
                  • iTap DevelopmentI
                    iTap Development @Hamed
                    last edited by

                    @Hamed that would be great! Thanks

                    1 Reply Last reply Reply Quote 0
                    • D
                      Deeeds @Hamed
                      last edited by

                      @Hamed Cheers. I was afraid you'd say that.

                      btw, if a label gets content that's longer and deeper than it was expecting and doesn't fit the text box region, and this value is getting updated a lot, it creates a bit of a slowdown each time it's trying to fit the text.

                      1 Reply Last reply Reply Quote 0
                      • HamedH
                        Hamed Admin
                        last edited by

                        When updating a TTF Label, its very slow process because it destroys the label and re-creates it by turning the text into an image, then presenting it to the screen. Where as updating a BM Font label is fast because its not recreating the image.

                        D 1 Reply Last reply Reply Quote 0
                        • D
                          Deeeds @Hamed
                          last edited by

                          @Hamed Oh, I thought from the aliasing on scaling small to large that you were rendering ttf into bitmaps in the background, long before presentation, as part of the build, and this was why they need to be loaded into the project.

                          1 Reply Last reply Reply Quote 0
                          • HamedH
                            Hamed Admin
                            last edited by Hamed

                            No, you need to import it into the project for when sharing/exporting the project with the ttf font, it will work for users that don't have the font.

                            D 1 Reply Last reply Reply Quote 1
                            • D
                              Deeeds @Hamed
                              last edited by

                              @Hamed Do you know Bogdan?

                              1 Reply Last reply Reply Quote 0
                              • HamedH
                                Hamed Admin
                                last edited by

                                @Deeeds I do not

                                1 Reply Last reply Reply Quote 0
                                • First post
                                  Last post