/usr/include/libcob/numeric.h is in libcob1-dev 1.0-5build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | /*
* Copyright (C) 2002-2007 Keisuke Nishida
* Copyright (C) 2007 Roger While
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1,
* or (at your option) any later version.
*
* This library 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; see the file COPYING.LIB. If
* not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
#ifndef COB_NUMERIC_H
#define COB_NUMERIC_H
#include <gmp.h>
#include <libcob/common.h>
#define COB_STORE_ROUND 0x01
#define COB_STORE_KEEP_ON_OVERFLOW 0x02
#define COB_STORE_TRUNC_ON_OVERFLOW 0x04
/*
* Internal representation of decimal numbers.
*
* n = value / 10^scale
*/
typedef struct {
mpz_t value;
int scale;
} cob_decimal;
extern void cob_decimal_init (cob_decimal *d);
extern void cob_decimal_set_field (cob_decimal *d, cob_field *f);
extern int cob_decimal_get_field (cob_decimal *d, cob_field *f, const int opt);
extern void cob_decimal_add (cob_decimal *d1, cob_decimal *d2);
extern void cob_decimal_sub (cob_decimal *d1, cob_decimal *d2);
extern void cob_decimal_mul (cob_decimal *d1, cob_decimal *d2);
extern void cob_decimal_div (cob_decimal *d1, cob_decimal *d2);
extern void cob_decimal_pow (cob_decimal *d1, cob_decimal *d2);
extern int cob_decimal_cmp (cob_decimal *d1, cob_decimal *d2);
extern int cob_add (cob_field *f1, cob_field *f2, const int opt);
extern int cob_sub (cob_field *f1, cob_field *f2, const int opt);
extern int cob_add_int (cob_field *f, const int n);
extern int cob_sub_int (cob_field *f, const int n);
extern int cob_div_quotient (cob_field *dividend, cob_field *divisor, cob_field *quotient, const int opt);
extern int cob_div_remainder (cob_field *fld_remainder, const int opt);
extern int cob_cmp_int (cob_field *f1, const int n);
extern int cob_cmp_uint (cob_field *f1, const unsigned int n);
extern int cob_cmp_packed (cob_field *f, int n);
extern int cob_cmp_numdisp (const unsigned char *data, const size_t size, const int n);
extern int cob_cmp_sign_numdisp (const unsigned char *data, const size_t size, const int n);
extern int cob_cmp_long_numdisp (const unsigned char *data, const size_t size, const int n);
extern int cob_cmp_long_sign_numdisp (const unsigned char *data, const size_t size, const int n);
extern void cob_set_packed_zero (cob_field *f);
extern void cob_set_packed_int (cob_field *f, const int val);
#endif /* COB_NUMERIC_H */
|