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

    Round not working...

    Scheduled Pinned Locked Moved Help and Support
    13 Posts 5 Posters 2.5k Views 2 Watching
    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.
    • iTap DevelopmentI Offline
      iTap Development
      last edited by

      Re: Overlays
      @Hamed i sent you new copy of the project.....I've run into a new problem😩 in the title I've added a bunch of new behaviors to set all my labels to various things...the problem is that the rounding isn't working right. Sometimes it is fine but sometimes I get a HUGE decimal. If you can't get the default location to do it, you can search a new location with the 🔎.

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

        @Hamed or @Murtaza did you find out why this is happening?

        1 Reply Last reply Reply Quote 0
        • MurtazaM Offline
          Murtaza Admin
          last edited by

          I beleive @Hamed is looking into this still. I'll remind him about it tomorrow.

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

            @Murtaza great, thanks!

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

              I think its because you're dividing the number after you're rounding it. Divide first, then round.

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

                @Hamed the reason I'm rounding first, is because I'm trying to round it to 1 decimal place.
                That's why I multiplied by ten, then rounded, then divided by 10.
                For example 10.25*10 = 102.5 round that and you get 103.0 divide that by 10 and get 10.3

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

                  I think you're going to need another round then. The math behaviours convert the number to a decimal number which is why you're seeing this behaviour.

                  Jack de WildeJ iTap DevelopmentI 2 Replies Last reply Reply Quote 0
                  • Jack de WildeJ Offline
                    Jack de Wilde @Hamed
                    last edited by

                    @Hamed but round(10x)/10 should result in one decimal digit, shouldn't it? I've used round like this before and not had a problem with it.

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

                      @Hamed why would dividing by ten give it a decimal...it should just move the decimal place but not give it .999999999 or something, right?

                      Aidan_FireA Jack de WildeJ 2 Replies Last reply Reply Quote 0
                      • Aidan_FireA Offline
                        Aidan_Fire @iTap Development
                        last edited by

                        @iTap-Development Lol I get this sort of problem too with multiplication/division, get things like .999999999 or .000000001

                        1 Reply Last reply Reply Quote 0
                        • Jack de WildeJ Offline
                          Jack de Wilde @iTap Development
                          last edited by

                          @iTap-Development you could try using the modulus behaviour instead of round, like this:
                          0_1488868223145_IMG_3100.PNG

                          It doesn't use multiplication or division, so you shouldn't get that problem, I don't know how useful this is though if you have to use a lot of round numbers.

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

                            @Jack8680 yeah I do have to round a lot of numbers, but I could just have the input be an attribute that gets set to the number that needs to be rounded to reuse all the same behaviors.

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

                              If anyone is interested, it works to get the text length of the rounded number, and then add 1 to it(since after dividing there's a decimal) and then trimming any decimals off by putting the added value as the end index and having it start from beginning. I guess depending on what you're doing with the rounded number you'll have to add or subtract or whatever from the text length.

                              I think i fixed the decimals in my weather app, but if anyone still has a decimal in it, please let me know!

                              1 Reply Last reply Reply Quote 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
                              • First post
                                Last post