On Fri, 2024-04-19 at 22:51 -0700, DrGo wrote:
> ```
> package main
> 
> import (
>       "fmt"
>       "math"
> )
> 
> func main() {
>       fmt.Printf("%g\n", 1-(math.Pow(0.6, 1/13)))   //result=0
>       fmt.Printf("%g\n", 1-(math.Pow(0.6, 1.0/13))) //
> result=0.038532272011602364
> }
> ```

1/13 is 0 since both parts of the expression are int, and so it
truncates. After this, it is converted to 0.0. So you have 0.6^0 which
is 1.

https://go.dev/play/p/tq2VAPIWXCy

-- 
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 golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/57f6740ba2d3e8df8fd4e30402eabb241a6af81b.camel%40kortschak.io.

Reply via email to