Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ The project includes implementations of the following mathematical algorithms:
| [basic_operations.h](./src/basic_operations.h) | Basic operations, including rounding to a specified number of decimal places, nth root calculation, and logarithm calculation in a given base |
| [combinatorics.h](./src/combinatorics.h) | Combinatorial analysis, including permutation, circular permutation, arrangement, and combination |
| [factorial.h](./src/factorial.h) | Factorial calculation |
| [gcd.h](./src/gcd.h) | Least common multiple calculation |
| [gcd.h](./src/gcd.h) | Greatest common divisor calculation |
| [geometry.h](./src/geometry.h) | Geometry-related functions, such as conversion between degrees and radians, distance between two points, midpoint between two points, slope of a line, angle of incline of a line, equation of a line, distance between a point and a line, circle perimeter calculation, number of diagonals in a polygon, sum of internal angles of a convex polygon, each internal angle of a regular polygon, and each external angle of a convex polygon |
| [growth.h](./src/growth.h) | Growth calculations, including value after simple growth, rate of simple growth, value after compound growth, and rate of compound growth |
| [happy_numbers.h](./src/happy_numbers.h) | Happy numbers determination |
| [lcm.h](./src/lcm.h) | Greatest common divisor calculation |
| [lcm.h](./src/lcm.h) | Least common multiple calculation |
| [percentage.h](./src/percentage.h) | Percentage calculations, such as finding x percent of a number and determining what percentage one number represents of another |
| [perfect_numbers.h](./src/perfect_numbers.h) | Perfect numbers determination |
| [prime_factorization.h](./src/prime_factorization.h) | Prime factorization of numbers |
Expand Down
6 changes: 3 additions & 3 deletions src/lcm.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define LCM_H

#include <errno.h>
#include <math.h>
#include <stdlib.h>
#include "gcd.h"

/**
Expand All @@ -18,8 +18,8 @@ long long lcm(int x, int y)
{
if (x == 0 || y == 0)
return 0;
long long result;
result = abs(x * y / gcd(x, y));
long long product = (long long) x * (long long) y;
long long result = llabs(product / gcd(x, y));
return result;
}

Expand Down