Conversation

Notices

  1. !CoderPonies Anyone know a simple algorithm for finding the number of digits in a number? Like 138273 = 6. xD

    Wednesday, 19-Sep-12 22:17:58 UTC from web
    1. @minti Divide by ten until the number is less than ten, while keeping a count of number of divisions?

      Wednesday, 19-Sep-12 22:21:55 UTC from web
      1. @cabinboybitshift Was trying to avoid using division. Hmm, time for a jsperf I think xD

        Wednesday, 19-Sep-12 22:22:26 UTC from web
        1. @minti Of course, considering how optimised various conversions are, you might find len(n.toString()) ends up actually faster than anything you could hack together. :P

          Wednesday, 19-Sep-12 22:23:45 UTC from web
        2. @minti http://jsperf.com/digits-in-a-number what

          Wednesday, 19-Sep-12 22:36:36 UTC from web
          1. @minti I'd appreciate if everyone opened this in their browsers and ran it, please.

            Wednesday, 19-Sep-12 22:38:06 UTC from web
            1. @minti What does it prove

              Wednesday, 19-Sep-12 22:38:51 UTC from web
              1. @renovatedkitchen Which method of getting the number of digits in a number is fastest. So far, regular old "count them by dividing by 10" seems fastest. O_o;

                Wednesday, 19-Sep-12 22:39:32 UTC from web
                1. @minti Wait what? I'm lost here

                  Wednesday, 19-Sep-12 22:40:01 UTC from web
                  1. @minti Im with bagles

                    Wednesday, 19-Sep-12 22:40:27 UTC from web
                  2. @baglesman Click link, "run test", let it finish, close page. It'll just collect some information for me. :p

                    Wednesday, 19-Sep-12 22:40:45 UTC from web
                    1. @minti @marshy Oh! what are you guys up to ?

                      Wednesday, 19-Sep-12 22:43:12 UTC from web
                      1. @nlghtmaremoon I have no clue. I just got done watching a horror movie and I did this test thingy.

                        Wednesday, 19-Sep-12 22:44:01 UTC from web
            2. @minti I'd probably get better results by closing this chrome profile and running it on a vanilla one, but oh well. http://ur1.ca/ac4zv

              Wednesday, 19-Sep-12 22:40:40 UTC from web
              1. @nerthos Thanks!

                Wednesday, 19-Sep-12 22:41:18 UTC from web
                1. @minti @nerthos But, what?

                  Wednesday, 19-Sep-12 22:42:25 UTC from web
                2. @minti What's this for?

                  Wednesday, 19-Sep-12 22:42:48 UTC from web
                  1. @nerthos Me being OCD about how to do stuff the fastest way possible. xD

                    Wednesday, 19-Sep-12 22:43:45 UTC from web
                    1. @minti Oh, sounds typical you xD

                      Wednesday, 19-Sep-12 22:44:00 UTC from web
                      1. @nerthos Yeah, basically. xD

                        Wednesday, 19-Sep-12 22:44:14 UTC from web
    2. @minti Of course, that would only work for integers, but still.

      Wednesday, 19-Sep-12 22:22:27 UTC from web