# Math Functions

**Table 9-8. Math Functions**

Function Name | Description |
---|---|

Abs(number) | Return the absolute value. |

Fix(number, decimals) | Return a number with a specified number of significant digits. |

Int(number), numerator \ denominator | Return the integer portion of a fractional number. |

Pi | 3.14… |

Remainder(numerator, denominator), | Return the remainder of dividing the numerator by the denominator. |

numerator Mod denominator | Return the remainder of dividing the numerator by the denominator. |

Round(number, decimals) | Round up a number with a specified number of significant digits. |

Sgn(number) | Return number’s sign. |

Sqr(number), Exp(number), Log(number) | The standard arithmetic functions. |

Cos(number), Sin(number), Tan(number), Atn(number) | The standard scientific functions. |

The math functions listed in Table 9-8 are similar to the corresponding functions in .NET. There are only a couple of interesting points to notice.

Working with whole numbers and decimals is done numerous ways. The Fix() and Round() functions take a fractional number and truncate it to a specified number of digits. The Round() function will round up to the nearest decimal. The number of decimals to display is optional and the default is zero. The Int() function is similar to the Round() function except that it only returns the whole number and will round down to the nearest whole number. Table 9-9 shows how the three functions will return a different number depending upon the decimal portion and whether the number is positive...

Already a member? Sign in to read the entire tutorial!