PIPS
ppcm.c
Go to the documentation of this file.
1 /*
2 
3  $Id: ppcm.c 1669 2019-06-26 17:24:57Z coelho $
4 
5  Copyright 1989-2016 MINES ParisTech
6 
7  This file is part of Linear/C3 Library.
8 
9  Linear/C3 Library is free software: you can redistribute it and/or modify it
10  under the terms of the GNU Lesser General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  any later version.
13 
14  Linear/C3 Library is distributed in the hope that it will be useful, but WITHOUT ANY
15  WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  FITNESS FOR A PARTICULAR PURPOSE.
17 
18  See the GNU Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with Linear/C3 Library. If not, see <http://www.gnu.org/licenses/>.
22 
23 */
24 
25 /* package arithmetique
26  */
27 
28 /*LINTLIBRARY*/
29 
30 #ifdef HAVE_CONFIG_H
31  #include "config.h"
32 #endif
33 #include <stdio.h>
34 
35 #include "arithmetique.h"
36 #include "linear_assert.h"
37 
38 /* int ppcm(int i, int j): plus petit entier positif divisible par i et j
39  *
40  * Ancien nom et ancien type: void lcm(int i, int j, int *pk)
41  */
43 {
44  if (value_neg_p(i)) i = value_uminus(i);
45  if (value_neg_p(j)) j = value_uminus(j);
46 
47  if (value_zero_p(i) || value_zero_p(j))
48  return VALUE_ZERO;
49  else {
50  Value d = pgcd(i,j);
51  d = value_div(i,d);
52  return value_mult(d,j);
53  }
54 }
#define VALUE_ZERO
#define pgcd(a, b)
Pour la recherche de performance, selection d'une implementation particuliere des fonctions.
#define value_uminus(val)
unary operators on values
#define value_zero_p(val)
int Value
#define value_mult(v, w)
whether the default is protected or not this define makes no sense any more...
#define value_neg_p(val)
#define value_div(v1, v2)
Value ppcm(Value i, Value j)
package arithmetique
Definition: ppcm.c:42