# math_func.cpp File Reference

Math functions. More...

`#include "../stdafx.h"`
`#include "math_func.hpp"`

Go to the source code of this file.

## Functions

int | LeastCommonMultiple (int a, int b)
| Compute least common multiple (lcm) of arguments a and b, the smallest integer value that is a multiple of both a and b.
int | GreatestCommonDivisor (int a, int b)
| Compute greatest common divisor (gcd) of a and b.

## Detailed Description

Math functions.

Definition in file math_func.cpp.

## Function Documentation

int GreatestCommonDivisor | ( | int | a,
|  | int | b |
| ) |  |  |

Compute greatest common divisor (gcd) of a and b.

Parameters:

  | a | First number.
  | b | second number.

Returns:
  Greatest common divisor of a and b.

Definition at line 39 of file math_func.cpp.

Referenced by LeastCommonMultiple().

int LeastCommonMultiple | ( | int | a,
|  | int | b |
| ) |  |  |

Compute least common multiple (lcm) of arguments a and b, the smallest integer value that is a multiple of both a and b.

Parameters:

  | a | First number.
  | b | second number.

Returns:
  Least common multiple of values a and b.

Note:
  This function only works for non-negative values of a and b.

Definition at line 24 of file math_func.cpp.

References GreatestCommonDivisor().

Referenced by NWidgetVertical::SetupSmallestSize(), NWidgetHorizontal::SetupSmallestSize(), and NWidgetStacked::SetupSmallestSize().