Hello Everyone,
This looks like a Golang bug to me. What do you all think?
> I have this function ...
func getArea(base, side int64) float64 {
> var height, fSide, area float64
> fSide = float64(side)
> halfBase := float64(base) / 2.0
> height = math.Sqrt(fSide*fSide - halfBase*halfBase)
> area = halfBase * height
> fmt.Printf("halfBase: %f, height: %f, Area: %f\n", halfBase, height, area)
>
> hb2 := 151414.5
> h2 := 262256.452301
> fmt.Printf("Area 2: %f\n", hb2 * h2)
>
> return area
> }
When I call it with `result := getArea(302829, 302828)`, I get this
output ...
halfBase: 151414.500000, height: 262256.452301, Area: 39709429597.000000
> Area 2: 39709429596.929764
I could see how some kind of rounding could produce the first Area value.
But in that case, why wouldn't Area2 be rounded as well?
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.