Forum

    • Register
    • Login
    • Search
    • Categories

    parseFloat

    Feature Requests
    2
    4
    346
    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.healey
      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 Hart
        Christoph Hart last edited by

        There you go 🙂

        inline function parseFloat(value)
        {
            local funky = Engine.getMilliSecondsForSamples(value);
            return Engine.getSamplesForMilliSeconds(funky);
        }
        
        d.healey 1 Reply Last reply Reply Quote 1
        • d.healey
          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 Hart
            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

            15
            Online

            795
            Users

            5.5k
            Topics

            51.6k
            Posts