HISE Logo Forum
    • Categories
    • Register
    • Login

    parseFloat

    Scheduled Pinned Locked Moved Feature Requests
    4 Posts 2 Posters 510 Views
    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.healeyD
      d.healey
      last edited by

      We have parseInt could we also get parseFloat?

      Libre Wave - Freedom respecting instruments and effects
      My Patreon - HISE tutorials
      YouTube Channel - Public HISE tutorials

      1 Reply Last reply Reply Quote 0
      • Christoph HartC
        Christoph Hart
        last edited by

        There you go :)

        inline function parseFloat(value)
        {
            local funky = Engine.getMilliSecondsForSamples(value);
            return Engine.getSamplesForMilliSeconds(funky);
        }
        
        d.healeyD 1 Reply Last reply Reply Quote 1
        • d.healeyD
          d.healey @Christoph Hart
          last edited by

          @christoph-hart

          Actually I still get integer returned with that

          Console.print(parseFloat(100.000));

          Libre Wave - Freedom respecting instruments and effects
          My Patreon - HISE tutorials
          YouTube Channel - Public HISE tutorials

          1 Reply Last reply Reply Quote 0
          • Christoph HartC
            Christoph Hart
            last edited by

            Ah, that's just the print function. If there are no digits, it will print an integer. If you need a certain amount of digits, use Engine.doubleToString():

            Console.print(Engine.doubleToString(2.0, 2));
            
            1 Reply Last reply Reply Quote 1
            • First post
              Last post

            25

            Online

            1.7k

            Users

            11.7k

            Topics

            102.0k

            Posts