func parseFloatPrefix(s string) float64 {
	i := 0
	for i < len(s) && asciiSpace[s[i]] != 0 {
		i++
	}
	start := i
	gotDigit := false
	if i < len(s) && (s[i] == '+' || s[i] == '-') {
		i++
	}
	for i < len(s) && s[i] >= '0' && s[i] <= '9' {
		gotDigit = true
		i++
	}
	if i < len(s) && s[i] == '.' {
		i++
	}
	for i < len(s) && s[i] >= '0' && s[i] <= '9' {
		gotDigit = true
		i++
	}
	if !gotDigit {
		return 0
	}
	end := i
	if i < len(s) && (s[i] == 'e' || s[i] == 'E') {
		i++
		if i < len(s) && (s[i] == '+' || s[i] == '-') {
			i++
		}
		for i < len(s) && s[i] >= '0' && s[i] <= '9' {
			i++
			end = i
		}
	}
	floatStr := s[start:end]
	f, _ := strconv.ParseFloat(floatStr, 64)
	return f  
}
Like strconv.ParseFloat, but parses at the start of string and
allows things like "1.5foo"
package interp
import (
	"fmt"
	"math"
	"strconv"
	"strings"
)
type valueType uint8
const (
	typeNull valueType = iota
	typeStr
	typeNum
	typeNumStr
)
type value struct {
	typ valueType  
	s   string     
	n   float64    
}
func null() value {
	return value{}
}
func num(n float64) value {
	return value{typ: typeNum, n: n}
}
func str(s string) value {
	return value{typ: typeStr, s: s}
}
func numStr(s string) value {
	f, err := strconv.ParseFloat(strings.TrimSpace(s), 64)
	if err != nil {
		return value{typ: typeStr, s: s}
	}
	return value{typ: typeNumStr, s: s, n: f}
}
func boolean(b bool) value {
	if b {
		return num(1)
	}
	return num(0)
}
func (v value) isTrueStr() bool {
	return v.typ == typeStr
}
func (v value) boolean() bool {
	if v.isTrueStr() {
		return v.s != ""
	} else {
		return v.n != 0
	}
}
func (v value) str(floatFormat string) string {
	if v.typ == typeNum {
		switch {
		case math.IsNaN(v.n):
			return "nan"
		case math.IsInf(v.n, 0):
			if v.n < 0 {
				return "-inf"
			} else {
				return "inf"
			}
		case v.n == float64(int(v.n)):
			return strconv.Itoa(int(v.n))
		default:
			return fmt.Sprintf(floatFormat, v.n)
		}
	}
	return v.s
}
func (v value) num() float64 {
	if v.typ == typeStr {
		return parseFloatPrefix(v.s)
	}
	return v.n
}
var asciiSpace = [256]uint8{'\t': 1, '\n': 1, '\v': 1, '\f': 1, '\r': 1, ' ': 1}