Sign in
go
/
website
/
8683462de3f38a2ec876b4ca5699d91d2e34a97d
/
.
/
_content
/
tour
/
methods
/
methods-continued.go
blob: 6710d1b0bd08ac671f583973b61e2eb0f4632319 [
file
] [
log
] [
blame
]
// +build OMIT
package main
import (
"fmt"
"math"
)
type MyFloat float64
func (f MyFloat) Abs() float64 {
if f < 0 {
return float64(-f)
}
return float64(f)
}
func main() {
f := MyFloat(-math.Sqrt2)
fmt.Println(f.Abs())
}