/** * srmath.h * Header file for SamR's simple math library. * * Copyright (c) 2013-22 Samuel A. Rebelsky. All rights reserved. * * This file is part of SRMath, SamR's simple Math Library. * * SRMath is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SRMath is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with SRMath. If not, see . */ #ifndef __SRMATH_H__ #define __SRMATH_H__ // +--------------------+---------------------------------------------- // | Exported Functions | // +--------------------+ /** * Compute the greatest common divisor of two numbers. */ long gcd (long x, long y); /** * Compute (x^n mod m). * @precondition: x*x < LONG_MAX */ long expmod (long x, long n, long m); #endif // __SRMATH_H__