This has nothing to do with the math.Pow function. Dividing two ints (1/13) is not the same as dividing a float by an int (1.0/13). Replace your two `fmt.Printf()` calls with
println(1 / 13) println(1.0 / 13) and observe the difference. The fact that both `math.Pow` arguments are of type `float64` does not affect the division operator. It only causes the result of the division to be coerced to a `float64` if possible. See https://go.dev/ref/spec#Conversions. On Fri, Apr 19, 2024 at 10:52 PM DrGo <salah.mah...@gmail.com> 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 > } > ``` > https://go.dev/play/p/oIKGb_uyLb3 > > -- > 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/245517a8-37f9-4ad4-bc42-a1204beb723fn%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts/245517a8-37f9-4ad4-bc42-a1204beb723fn%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- 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/CABx2%3DD__eo%2B2PV8_LZYK4Z-%3Dhi_tKor1s2jomAMWPXWdcr%2BaLg%40mail.gmail.com.