Welcome To Golang By Example

Menu
  • Home
  • Blog
Menu

Tag: math

Max of two numbers in Go (Golang)

Posted on March 28, 2023March 28, 2023 by admin

Overview math package of GO provides a Max method that can be used to get the maximum of two numbers. Below is the signature of the function. It takes input two float…

Min of two numbers in Go (Golang)

Posted on March 28, 2023March 28, 2023 by admin

Overview math package of GO provides a Min method that can be used to get the minimum of two numbers. The Below is the signature of the function. It takes input two…

Check if a number is negative or positive in Go (Golang)

Posted on March 28, 2023March 28, 2023 by admin

Overview math package of GO provides a Signbit method that can be used to check whether a given number is negative or positive. It returns true for a negative number It returns…

Break number into integer and fraction parts in Go (Golang)

Posted on March 28, 2023March 28, 2023 by admin

Overview math package of GO provides a Modf method that can be used to break a floating-point number into integer and floating part. Please note that the integer part is also returned…

Remainder or Modulus in Go (Golang)

Posted on March 28, 2023March 28, 2023 by admin

Overview In this tutorial we will study about % Operator – applicable to get remainder for integers Mod function – can be used to get remainder in case of floats also Remainder…

Square Root of a number in Go (Golang)

Posted on March 26, 2023March 26, 2023 by admin

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. It takes input a…

Pi value in Go (Golang)

Posted on March 26, 2023March 26, 2023 by admin

Overview math package of GO provides a Pi constant. This is how it is defined in the constant.go file of math package. It is a float64 value Code: Output:

Get absolute value of a number in Go (Golang)

Posted on March 26, 2023March 26, 2023 by admin

Overview math package of GO provides an Abs method that can be used to get the absolute value of a number. Below is the signature of the function. It takes input a…

Remove decimal points from a float in Go (Golang)

Posted on March 25, 2023March 26, 2023 by admin

Overview math package of GO provides a Trunc method that can be used to remove decimal points of a float and convert it to an integer Below is the signature of the…

Round Even a number in Go (Golang)

Posted on March 25, 2023March 25, 2023 by admin

Overview math package of GO provides a RoundToEven method that can be used to round to even a number. It returns the nearest integer rounding ties to even. Here you can read…

Posts navigation

1 2 Next

Popular Articles

Golang Comprehensive Tutorial Series

All Design Patterns in Go (Golang)

Slice in golang

Variables in Go (Golang) – Complete Guide

OOP: Inheritance in GOLANG complete guide

Using Context Package in GO (Golang) – Complete Guide

All data types in Golang with examples

Understanding time and date in Go (Golang) – Complete Guide

©2023 Welcome To Golang By Example | Design: Web XP