Question: 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. 

How can I do simple math on the user input?

Here is the basic code I have:

```
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 = `<html>
<body>
  <form action="/result" method="post">
    <div>Number between 0 and 1
       <input type="text" name="anar">
    </div>
  </form>
</body>
</html>
`

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
}

```

Answer: 
Convert the input to a float first using [`strconv.ParseFloat`](http://golang.org/pkg/strconv/#ParseFloat)

```
fval, err := strconv.ParseFloat(input, 64)

if err != nil { 
    log.Println(err)
    //do something about it
}

newNum = fval + 0.25

```
A friend just gave me this answer using fmt package. I thought I would share it too.

```
type userInput struct {
    Num float64
}

input := "0.50"
s, err := fmt.Sscanf(input, "%f", &userInput.Num)
newNum := userInput.Num + 0.25

```