Sqrt<\/strong> method that can be used to get the cube root of that number.<\/p>\n\n\n\nBelow is the signature of the function. It takes input a float and also returns a float.<\/p>\n\n\n\n
func Sqrt(x float64) float64<\/code><\/pre>\n\n\n\nSome special cases of Sqrt function are<\/p>\n\n\n\n
Sqrt(\u00b10) = \u00b10<\/li> Sqrt(\u00b1Inf) = \u00b1Inf<\/li> Sqrt(x < 0) = NaN<\/li> Sqrt(NaN) = NaN<\/li><\/ul>\n\n\n\n<\/span>Code:<\/strong><\/span><\/h1>\n\n\n\npackage main\n\nimport (\n\t\"fmt\"\n\t\"math\"\n)\n\nfunc main() {\n\t\/\/Square root of a integer\n\tres := math.Sqrt(4)\n\tfmt.Println(res)\n\n\t\/\/Square root of a integer\n\tres = math.Sqrt(9)\n\tfmt.Println(res)\n\n\t\/\/Square Root of a float\n\tres = math.Sqrt(30.33)\n\tfmt.Println(res)\n\n\t\/\/Square Root of a negative number\n\tres = math.Sqrt(-9)\n\tfmt.Println(res)\n}\n<\/code><\/pre>\n\n\n\nOutput:<\/strong><\/p>\n\n\n\n2\n3\n5.5072679252057455<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"Table of Contents OverviewCode: Overview math package of GO provides a Sqrt method that can be used to get the cube root of that number. Below is the signature of the function….<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","footnotes":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false},"categories":[1],"tags":[3,4,219,229],"class_list":["post-1846","post","type-post","status-publish","format-standard","hentry","category-tech","tag-go","tag-golang","tag-math","tag-square-root"],"yoast_head":"\n
Square Root of a number in Go (Golang) - Welcome To Golang By Example<\/title>\n \n \n \n \n \n \n \n \n \n \n \n \n \n\t \n\t \n\t \n