weired value

48 views
Skip to first unread message

WALID BELRHALMIA

unread,
Jul 28, 2016, 7:01:39 PM7/28/16
to golang-nuts
Hello everybody still learning Go i remark a weired think,

this command :  fmt.Println(int(math.Pow(float64(9200), float64(5))))

Return :   -9223372036854775808   i don't know why normally 9200⁵  is a  positive big value can some one explain me this please in details ? 

Matt Harden

unread,
Jul 28, 2016, 7:44:57 PM7/28/16
to WALID BELRHALMIA, golang-nuts
The large value overflows the range of an int and so it "wraps around" to a negative number.

--
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...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages