title: How to Get Form Input as Float64 in Go
body: <p>I have a webform built using Go.  Users enter a number, then I need to do some math on that number.  It seems like all methods using http package use strings as the output.  </p>
  
  <p>How can I do simple math on the user input?</p>
  
  <p>Here is the basic code I have:</p>
  
  <pre><code>func init() {
      http.HandleFunc("/", root)
      http.HandleFunc("/result", result)
  }
  
  // handle the root url
  func root(w http.ResponseWriter, r *http.Request) {
      fmt.Fprint(w, inputForm)
  }
  
  // root url html
  const inputForm = `&lt;html&gt;
  &lt;body&gt;
    &lt;form action="/result" method="post"&gt;
      &lt;div&gt;Number between 0 and 1
         &lt;input type="text" name="anar"&gt;
      &lt;/div&gt;
    &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  `
  
  func result(w http.ResponseWriter, r *http.Request) {
      input := r.FormValue("anar")  // FormValue is always string
  
      // add number to input
      newNum := input + 0.25
  
      // stuff to output result
  }
  </code></pre>