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. Rounding Behaviour has a bug, or division by 1000x does.

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

Scheduled Pinned Locked Moved Bug Reports
14 Posts 4 Posters 2.3k Views 3 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.
  • D Deeeds

    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 Offline
    iTap DevelopmentI Offline
    iTap Development
    wrote on last edited by
    #2

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

    1 Reply Last reply
    0
    • D Deeeds

      I'm doing x1000

      Round.

      Divide by 1000

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

      33.333000000000000001

      or

      33.333999999999999999

      Jack de WildeJ Offline
      Jack de WildeJ Offline
      Jack de Wilde
      wrote on last edited by
      #3

      @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
      1
      • Jack de WildeJ Jack de Wilde

        @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 Offline
        HamedH Offline
        Hamed
        Admin
        wrote on last edited by Hamed
        #4

        @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
        0
        • HamedH 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 Offline
          D Offline
          Deeeds
          wrote on last edited by Deeeds
          #5

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

          1 Reply Last reply
          0
          • HamedH 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.

            iTap DevelopmentI Offline
            iTap DevelopmentI Offline
            iTap Development
            wrote on last edited by
            #6

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

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

              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
              2
              • HamedH Hamed

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

                iTap DevelopmentI Offline
                iTap DevelopmentI Offline
                iTap Development
                wrote on last edited by
                #8

                @Hamed that would be great! Thanks

                1 Reply Last reply
                0
                • HamedH Hamed

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

                  D Offline
                  D Offline
                  Deeeds
                  wrote on last edited by
                  #9

                  @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
                  0
                  • HamedH Offline
                    HamedH Offline
                    Hamed
                    Admin
                    wrote on last edited by
                    #10

                    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
                    0
                    • HamedH Hamed

                      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 Offline
                      D Offline
                      Deeeds
                      wrote on last edited by
                      #11

                      @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
                      0
                      • HamedH Offline
                        HamedH Offline
                        Hamed
                        Admin
                        wrote on last edited by Hamed
                        #12

                        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
                        1
                        • HamedH 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 Offline
                          D Offline
                          Deeeds
                          wrote on last edited by
                          #13

                          @Hamed Do you know Bogdan?

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

                            @Deeeds I do not

                            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