This file is indexed.

/usr/include/qsopt_ex/eg_lpnum.mpf.h is in libqsopt-ex-dev 2.5.10.3-1+b1.

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
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
/* EGlib "Efficient General Library" provides some basic structures and
 * algorithms commons in many optimization algorithms.
 *
 * Copyright (C) 2005 Daniel Espinoza and Marcos Goycoolea.
 *
 * 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 of the License, 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; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 * */
#ifndef __EG_LPNUM_MPF__
#define __EG_LPNUM_MPF__

#include <stdlib.h>
#include <string.h>

#include <gmp.h>

#include "eg_lpnum.h"

/** @file
 * @ingroup EGlpNum */
/** @addtogroup EGlpNum */
/** @{ */
/* ========================================================================= */
/** @brief This is the smallest difference (with the current precision) that can
 * be distinguished betwen 1.0 and it's clossest representable number, in some
 * sense it is the absolute minimum epsilon for comparisons */
extern mpf_t mpf_eps;

/* ========================================================================= */
/** extern definitions of constaants for different set-ups */
extern const mpf_t __zeroLpNum_mpf__;
extern const mpf_t __oneLpNum_mpf__;
extern const mpf_t __MaxLpNum_mpf__;
extern const mpf_t __MinLpNum_mpf__;
#define mpf_zeroLpNum __zeroLpNum_mpf__
#define mpf_oneLpNum  __oneLpNum_mpf__
#define mpf_epsLpNum  mpf_eps
#define mpf_MaxLpNum  __MaxLpNum_mpf__
#define mpf_MinLpNum  __MinLpNum_mpf__

/* ========================================================================= */
/** @brief Given a double exp, compute \f$ e^{exp} \f$ and store it in the given
 * mpf_t number.
 * @param exp double exponent to be used.
 * @param num mpf_t number where to store the result.
 * */
#define mpf_EGlpNumEpow(num,exp) ({\
	unsigned int __i = 0;\
	int __lsgn = (exp)<0 ? 1:0;\
	mpf_t __ntmp,__res,__lexp,__err;\
	mpf_init_set_d(__lexp,exp);\
	if(__lsgn) mpf_neg(__lexp,__lexp);\
	mpf_init_set_ui(__ntmp,(unsigned long int)1);\
	mpf_init_set_ui(__res,(unsigned long int)1);\
	mpf_init(__err);\
	mpf_div(__err,__ntmp,__res);\
	while(mpf_cmp(__err,mpf_eps)>0)\
	{\
		mpf_mul(__ntmp,__ntmp,__lexp);\
		mpf_div_ui(__ntmp,__ntmp,(unsigned long int)(++__i));\
		mpf_add(__res,__res,__ntmp);\
		mpf_div(__err,__ntmp,__res);\
	}\
	if(__lsgn) mpf_ui_div(num,(unsigned long int)1,__res);\
	else mpf_set(num,__res);\
	mpf_clear(__ntmp);\
	mpf_clear(__res);\
	mpf_clear(__err);\
	mpf_clear(__lexp);})

/* ========================================================================= */
/** @brief Read from a string a number and store it in the given mpf_t, 
 * @return the number of chars readed from the input string */
#define mpf_EGlpNumReadStr(a,str) ({\
	int __i =0;\
	char __lpstr__[4096];\
	mp_exp_t __lexp;\
	mpf_set_str(a,str,10);\
	mpf_get_str(__lpstr__,&__lexp,10,(size_t)0,a);\
	__i = strlen(__lpstr__);\
	__i;})

/* ========================================================================= */
/** @brief given a mpf_t, write it to a string (to be allocated internally),
 * and return it. */
#define mpf_EGlpNumGetStr(a) ({\
	char *__out= 0;\
	mp_exp_t __lexp = 0;\
	size_t __pos = 0,__lo = (mpf_cmp_ui(a,(unsigned long)0) < 0) ? 1:0;\
	char __lpstr__[4096];\
	mpf_get_str(__lpstr__,&__lexp,10,(size_t)25,a);\
	__pos = strlen(__lpstr__) + ((size_t)(__lo + 2));\
	__out = EGsMalloc(char,__pos+((size_t)15));\
	if(__lo) sprintf(__out,"-0.");\
	else sprintf(__out,"0.");\
	sprintf(__out+__lo+2,"%s",__lpstr__+__lo);\
	if(__pos == 2) __out[1] = '\0';\
	else if(__lexp != 0)\
	{\
		__out[__pos-__lo] = 'e';\
		snprintf(__out+__pos+1-__lo,(size_t)(12-__lo),"%d",(int)__lexp);\
	}\
	__out;})

/* ========================================================================= */
/** @brief given an array of type mpf_t, free it, if the pointer is NULL
 * nothing happen. */
#define mpf_EGlpNumFreeArray(ea) ({\
	size_t __sz = __EGlpNumArraySize(ea);\
	mpf_t* __ptr__ = (ea);\
	while(__sz--) mpf_clear(__ptr__[__sz]);\
	__EGlpNumFreeArray(ea);})


/* ========================================================================= */
/** @brief Reallocate and initialize (if needed) 'size' elements of type 
 * mpf_t and return it, if no more memory, exit(1) */
#define mpf_EGlpNumReallocArray(lptr, lsize) ({ \
	mpf_t** __ptr__ = (lptr); \
	size_t __sz__ = (lsize); \
	size_t *__ntmp__ = (size_t *) *__ptr__; \
	size_t __psz__; \
	/* if no memory allocated before we just call the regular allocator */ \
	if (!*__ptr__) *__ptr__ = mpf_EGlpNumAllocArray (__sz__); \
	else \
	{ \
		/* first check that the previous size is not larger than the current */ \
		__ntmp__--; \
		__psz__ = __ntmp__[0]; \
		if (__psz__ < __sz__) \
		{ \
			/* now we have to do the reallocation */ \
			*__ptr__ = (mpf_t *) __ntmp__; \
			*__ptr__ = EGrealloc(*__ptr__, sizeof(mpf_t) * __sz__ +sizeof(size_t));\
			__ntmp__ = (size_t *) *__ptr__; \
			__ntmp__[0] = __sz__; \
			__ntmp__++; \
			*__ptr__ = (mpf_t *) __ntmp__; \
			for (; __psz__ < __sz__; __psz__++) mpf_init ((*__ptr__)[__psz__]); \
		} \
	} \
})

/* ========================================================================= */
/** @brief Allocate and initialize (if needed) 'size' elements of type mpf_t
 * and return it, if no more memory, exit(1) */
#define mpf_EGlpNumAllocArray(size) ({\
	size_t __i__ = (size);\
	mpf_t *__res = __EGlpNumAllocArray(mpf_t,__i__);\
	while(__i__--) mpf_init(__res[__i__]);\
	__res;})

/* ========================================================================= */
/** @brief set the given number pointer, set its value to the given double.
 * @param var mpf_t where we will store the double value.
 * @param dbl double value to be stored in 'var'.
 * @par Description:
 * This function is intended to set initial values to variables; note that the
 * double is a number and not a pointer to that value, be carefull with this
 * detail. Also, due to implementation details this function can't deal with
 * numbers above 1e158 or smaller than 1e-158. Note also that if the number is
 * writen in the form \f$x=\bar{x}\cdot 2^e\f$ with \f$0.5<|\bar{x}|<1\f$, 
 * then \f$\left|x-\frac{p}{q}\right|<2^{e-64}\f$.
 * */
#define mpf_EGlpNumSet(var, dbl) mpf_set_d(var,(double)(dbl))

/* ========================================================================= */
/** @brief Stores in the first number the ceil value of the second number, i.e.
 * EGlpNumCeil(a,b) <==> a= ceil(b) */
#define mpf_EGlpNumCeil(a, b) mpf_ceil(a,b)

/* ========================================================================= */
/** @brief Stores in the first number the floor value of the second number, i.e.
 * EGlpNumFloor(a,b) <==> a= floor(b) */
#define mpf_EGlpNumFloor(a, b) mpf_floor(a,b)

/* ========================================================================= */
/** @brief store the (multiplicative) inverse of a number to itself, i.e.
 * implement a = 1/a.
 * @param a the number to be inverted. */
#define mpf_EGlpNumInv(a) mpf_ui_div(a,(unsigned long int)1,a)

/* ========================================================================= */
/** @brief Compare if two numbers are equal within a maximum __error.
 * @param a mpf_t first number to compare.
 * @param b mpf_t second number to compare.
 * @return int one in success, zero oterwise.
 * @par Description:
 * Given two numbers 'a','b' return 1 if a == b, otherwise it return 0
 * */
#define mpf_EGlpNumIsEqqual(a,b) (mpf_cmp(a,b) == 0)

/* ========================================================================= */
/** @brief Compare if two numbers are equal within a maximum __error.
 * @param a mpf_t first number to compare.
 * @param b mpf_t second number to compare.
 * @param __error mpf_t maximum difference allowed between both
 * numbers.
 * @return int one in success, zero oterwise.
 * @par Description:
 * Given two numbers 'a','b' and a tolerance '__error',
 * return 1 if |a-b|<= __error, otherwise it return 0.
 * */
#define mpf_EGlpNumIsEqual(a,b,__error) ({\
	mpf_t __lpnum__;int __res__=0;mpf_init(__lpnum__);\
	mpf_sub (__lpnum__, a, b);\
	mpf_abs (__lpnum__, __lpnum__);\
	__res__=(mpf_cmp (__lpnum__, __error) <= 0);\
	mpf_clear(__lpnum__);\
	__res__;\
})

#define mpf_EGlpNumIsNeq(a,b,__error) ({\
	mpf_t __lpnum__;int __res__=0;mpf_init(__lpnum__);\
	mpf_sub (__lpnum__, a, b);\
	mpf_abs (__lpnum__, __lpnum__);\
	__res__=(mpf_cmp (__lpnum__, __error) > 0);\
	mpf_clear(__lpnum__);\
	__res__;\
})

#define mpf_EGlpNumIsNeqZero(a,__error) ({\
	mpf_t __lpnum__;int __res__=0;mpf_init(__lpnum__);\
	mpf_abs (__lpnum__, a);\
	__res__=(mpf_cmp (__lpnum__, __error) > 0);\
	mpf_clear(__lpnum__);\
	__res__;\
})

#define mpf_EGlpNumIsNeqqZero(a)     	(mpf_sgn(a))
#define mpf_EGlpNumIsNeqq(a,b)        (mpf_cmp(a,b)!=0)

/* ========================================================================= */
/** @brief test if the first number is bigger to the second number
 * @param a mpf_t the first number.
 * @param b mpf_t the second number
 * @return int one if success, zero otherwise.
 * @par Description:
 * Given two numbers 'a' and 'b', return one if a < b, zero
 * otherwise.
 * */
#define mpf_EGlpNumIsLess(a,b) (mpf_cmp(a,b) < 0)

/* ========================================================================= */
/** @brief test if a given number is greater than zero
 * @param a number to test
 * @return int one if success, zero otherwise.
 * */
#define mpf_EGlpNumIsGreatZero(a) (mpf_sgn(a) > 0)

/* ========================================================================= */
/** @brief test if a given number is less than zero
 * @param a number to test
 * @return int one if success, zero otherwise.
 * */
#define mpf_EGlpNumIsLessZero(a) (mpf_sgn(a) < 0)

/* ========================================================================= */
/** @brief test if the sum of the first two numbers is less thatn the third
 * number.
 * @param a mpf_t the first number.
 * @param b mpf_t the second number
 * @param c mpf_t the third number
 * @return int one if success, zero otherwise.
 * @par Description:
 * Given a,b, and c, return nonzero if (a + b < c), zero toherwise.
 * */
#define mpf_EGlpNumIsSumLess(a, b, c) ({\
	mpf_t __lpnum__;int __res__=0;mpf_init(__lpnum__);\
	mpf_add (__lpnum__, a, b);\
	__res__=(mpf_cmp (__lpnum__, c) < 0);\
	mpf_clear(__lpnum__);\
	__res__;\
})

/* ========================================================================= */
/** @brief test if the diference of the first two numbers is less thatn the 
 * third number.
 * @param a mpf_t the first number.
 * @param b mpf_t the second number
 * @param c mpf_t the third number
 * @return int one if success, zero otherwise.
 * @par Description:
 * Given a,b, and c, return nonzero if (a - b < c), zero toherwise.
 * */
#define mpf_EGlpNumIsDiffLess(a, b, c) ({\
	mpf_t __lpnum__;int __res__=0;mpf_init(__lpnum__);\
	mpf_sub (__lpnum__, a, b);\
	__res__=(mpf_cmp (__lpnum__, c) < 0);\
	mpf_clear(__lpnum__);\
	__res__;\
})

/* ========================================================================= */
/** @brief test if the first number is bigger to the second number
 * @param a mpf_t the first number.
 * @param b double the second number
 * @return int one if success, zero otherwise.
 * @par Description:
 * Given two numbers 'a' and 'b', return one if a < b, zero
 * otherwise.
 * */
#define mpf_EGlpNumIsLessDbl(a,b) (mpf_cmp_d(a,((double)(b))) < 0)

/* ========================================================================= */
/** @brief test if the first number is bigger to the second number
 * @param a mpf_t the first number.
 * @param b double the second number
 * @return int one if success, zero otherwise.
 * @par Description:
 * Given two numbers 'a' and 'b', return one if a > b, zero
 * otherwise.
 * */
#define mpf_EGlpNumIsGreaDbl(a,b) (mpf_cmp_d(a,((double)(b))) > 0)

/* ========================================================================= */
/** @brief test if the first number is bigger to the second number
 * @param a mpf_t the first number.
 * @param b mpf_t the second number
 * @return int one if success, zero otherwise.
 * @par Description:
 * Given two numbers 'a' and 'b', return one if a <= b, zero
 * otherwise.
 * */
#define mpf_EGlpNumIsLeq(a,b) (mpf_cmp(a,b) <= 0)

/* ========================================================================= */
/** @brief copy the value of the second number to the first.
 * @param a mpf_t source number (it won't change value).
 * @param b mpf_t source number (it won't change value).
 * @param c mpf_t denominator of the difference (it won't change value).
 * @param d mpf_t where to store the value .
 * @par Description:
 * Set @f$a = \frac{b - c}{d} @f$ */
#define mpf_EGlpNumCopyDiffRatio(a, b, c, d) ({\
	mpf_sub (a, b, c);\
	mpf_div (a, a, d);\
})

/* ========================================================================= */
/** @brief copy the value of the second number to the first.
 * @param a mpf_t source number (it won't change value).
 * @param b mpf_t source number (it won't change value).
 * @param dest mpf_t where to store the value stored in 'orig'.
 * @par Description:
 * Set dest = a - b */
#define mpf_EGlpNumCopyDiff(dest,a,b) mpf_sub(dest,a,b)

/* ========================================================================= */
/** @brief copy the value of the sum of the second and third parameter
 * @param a mpf_t source number (it won't change value).
 * @param b mpf_t source number (it won't change value).
 * @param dest mpf_t where to store the sum.
 * @par Description:
 * Set dest = a + b */
#define mpf_EGlpNumCopySum(dest,a,b) mpf_add(dest,a,b)

/* ========================================================================= */
/** @brief copy the value of the second number to the first.
 * @param orig mpf_t source number (it won't change value).
 * @param dest mpf_t where to store the value stored in 'orig'.
 * @par Description:
 * Given two numbers copy the values in 'orig', into 'dest'.
 * */
#define mpf_EGlpNumCopy(dest,orig) mpf_set(dest,orig)

/* ========================================================================= */
/** @brief change the fist number to the maximum between itself and the 
 * absolute value of the second.
 * @param orig mpf_t source number (it won't change value).
 * @param dest mpf_t where to store the value stored in 'orig'.
 * @par Description:
 * implement dest = max(dest,abs(orig))
 * */
#define mpf_EGlpNumSetToMaxAbs(dest, orig) ({\
	mpf_t __lpnum__;mpf_init(__lpnum__);\
	mpf_abs (__lpnum__, orig);\
	if (mpf_cmp (dest, __lpnum__) < 0) mpf_set (dest, __lpnum__);\
	mpf_clear(__lpnum__);})

#define mpf_EGlpNumSetToMinAbs(dest, orig) ({\
	mpf_t __lpnum__;mpf_init(__lpnum__);\
	mpf_abs (__lpnum__, orig);\
	if (mpf_cmp (dest, __lpnum__) > 0) mpf_set (dest, __lpnum__);\
	mpf_clear(__lpnum__);})

/* ========================================================================= */
/** @brief copy the square of the second argument, divided by the third 
 * argument into the first argument.
 * @param dest mpf_t where to store the result
 * @param orig mpf_t second parameter
 * @param den mpf_t third parameter
 * @par Description:
 * compute dest = (orig*orig)/den
 * */
#define mpf_EGlpNumCopySqrOver(dest, orig, den) ({\
	mpf_mul (dest, orig, orig);\
	mpf_div (dest, dest, den);\
})

/* ========================================================================= */
/** @brief copy the value of the absolute value of the second parameter to the 
 * first parameter.
 * @param orig mpf_t source number (it won't change value).
 * @param dest mpf_t where to store the absolute value stored
 * in 'orig'.
 * @par Description:
 * Given a number 'orig', copy its absolute value to 'dest'. i.e.
 * dest = |orig|
 * */
#define mpf_EGlpNumCopyAbs(dest,orig) mpf_abs(dest,orig)

/* ========================================================================= */
/** @brief copy minus the value of the second parameter to the 
 * first parameter.
 * @param orig mpf_t the source number (it won't change value).
 * @param dest mpf_t where to store minus the value stored
 * in 'orig'.
 * @par Description:
 * Given a number 'orig', copy minus the value to 'dest'. i.e.
 * dest = -orig
 * */
#define mpf_EGlpNumCopyNeg(dest,orig) mpf_neg(dest,orig)

/* ========================================================================= */
/** @brief Set des = op1/op2.
 * @param dest mpf_t where we will store the result.
 * @param op1 mpf_t numerator of the fraction (possibly non an integer)
 * @param op2 mpf_t denominator of the fraction (possibly non an integer)
 * @par Description:
 *  Set des = op1/op2
 * */
#define mpf_EGlpNumCopyFrac(dest,op1,op2) mpf_div(dest,op1,op2)

/* ========================================================================= */
/** @brief copy the first 'size' values in the second array to the first array.
 * @param orig mpf_t* pointer to the array from where we will copy the
 * values (it won't change value).
 * @param dest mpf_t* pointer to where to store the first 'size' values 
 * stored in 'orig'.
 * @param size unsigned int specifying how many values of 'orig' will be copied
 * onto 'dest'
 * @par Description:
 * This function is provided to (possible) make fast copies of arrays of
 * numbers, the arrays should be of length at least 'size', and the resulting
 * copy is absolutely independent froom the original, any change in one vale of
 * one array won't change values on the other array.
 * */
#define mpf_EGlpNumCopyArray(dest,orig,size) {\
	register unsigned int __i__ = (size);\
	for(;__i__--;)\
	{\
		mpf_set(dest[__i__],orig[__i__]);\
	}\
}

/* ========================================================================= */
/** @brief Sub to a given number the product of two numbers.
 * @param a mpf_t the number that we are going to Sub to.
 * @param b mpf_t value to be multiplyed.
 * @param c mpf_t value to be multiplyed.
 * @par Description:
 * This function implements a = a - b*c, and clearly don't change the value
 * stored in 'b' nor in 'c'.
 * */
#define mpf_EGlpNumSubInnProdTo(a, b, c) ({\
	mpf_t __lpnum__;mpf_init(__lpnum__);\
	mpf_mul (__lpnum__, b, c);\
	mpf_sub (a, a, __lpnum__);\
	mpf_clear(__lpnum__);\
})

/* ========================================================================= */
/** @brief Add to a given number the product of two numbers.
 * @param a mpf_t the number that we are going to add to.
 * @param b mpf_t value to be multiplyed.
 * @param c mpf_t value to be multiplyed.
 * @par Description:
 * This function implements a = a + b*c, and clearly don't change the value
 * stored in 'b' nor in 'c'.
 * */
#define mpf_EGlpNumAddInnProdTo(a, b, c) ({\
	mpf_t __lpnum__;mpf_init(__lpnum__);\
	mpf_mul (__lpnum__, b, c);\
	mpf_add (a, a, __lpnum__);\
	mpf_clear(__lpnum__);\
})

/* ========================================================================= */
/** @brief Substract to a given number the value of the second number.
 * @param a mpf_t the number that we are going to substract to.
 * @param b unsigned int value to be substracted to 'a'.
 * @par Description:
 * This function implements a = a - b, and clearly don't change the value
 * stored in 'b'.
 * */
#define mpf_EGlpNumSubUiTo(a,b) mpf_sub_ui(a,a,((unsigned long)(b)))

/* ========================================================================= */
/** @brief Add to a given number the value of the second number.
 * @param a mpf_t the number that we are going to add to.
 * @param b unsigned int value to be added to 'a'.
 * @par Description:
 * This function implements a = a + b, and clearly don't change the value
 * stored in 'b'.
 * */
#define mpf_EGlpNumAddUiTo(a,b) mpf_add_ui(a,a,((unsigned long)(b)))

/* ========================================================================= */
/** @brief Add to a given number the value of the second number.
 * @param a mpf_t the number that we are going to add to.
 * @param b mpf_t value to be added to 'a'.
 * @par Description:
 * This function implements a = a + b, and clearly don't change the value
 * stored in 'b'.
 * */
#define mpf_EGlpNumAddTo(a,b) mpf_add(a,a,b)

/* ========================================================================= */
/** @brief Substract to a given number the value of the second number.
 * @param a mpf_t the number that we are going to substract
 * from.
 * @param b mpf_t value to be substracted to 'a'.
 * @par Description:
 * This function implements a = a - b, and clearly don't change the value
 * stored in 'b'.
 * */
#define mpf_EGlpNumSubTo(a,b) mpf_sub(a,a,b)

/* ========================================================================= */
/** @brief Multiply a given number by the value of the second number.
 * @param a mpf_t the number that we are going to multiply by
 * the second number and store the result.
 * @param b mpf_t value to be multyply to 'a'.
 * @par Description:
 * This function implements a = a * b, and clearly don't change the value
 * stored in 'b'.
 * */
#define mpf_EGlpNumMultTo(a,b) mpf_mul(a,a,b)

/* ========================================================================= */
/** @brief Divide a given number by the value of the second number.
 * @param a mpf_t the number that we are going to divide by
 * the second number and store the result.
 * @param b mpf_t value to be divide to 'a'.
 * @par Description:
 * This function implements a = a / b, and clearly don't change the value
 * stored in 'b'.
 * */
#define mpf_EGlpNumDivTo(a,b) mpf_div(a,a,b)

/* ========================================================================= */
/** @brief Divide a given number by the value of the second number.
 * @param a mpf_t the number that we are going to divide by
 * the second number and store the result.
 * @param b unsigned int value to be divided to 'a'.
 * @par Description:
 * This function implements a = a / b, and don't change the value
 * stored in 'b'.
 * */
#define mpf_EGlpNumDivUiTo(a,b) mpf_div_ui(a,a,((unsigned long)(b)))

/* ========================================================================= */
/** @brief Multiply a given number by the value of the second number.
 * @param a mpf_t the number that we are going to multiply by
 * the second number and store the result.
 * @param b unsigned int value to be multyply to 'a'.
 * @par Description:
 * This function implements a = a * b, and clearly don't change the value
 * stored in 'b'.
 * */
#define mpf_EGlpNumMultUiTo(a,b) mpf_mul_ui(a,a,((unsigned long)(b)))

/* ========================================================================= */
/** @brief Reset the value of the pointed number to zero.
 * @param a mpf_t the value to be set to zero.
 * @par Descrpition:
 * Reset a to zero, i.e. implements a = 0;
 * */
#define mpf_EGlpNumZero(a) mpf_set_ui(a,(unsigned long)0)

/* ========================================================================= */
/** @brief Reset the value of the pointed number to one.
 * @param a mpf_t value to be set to one.
 * @par Descrpition:
 * Reset a to zero, i.e. implements a = 1;
 * */
#define mpf_EGlpNumOne(a) mpf_set_ui(a,(unsigned long)1)

/* ========================================================================= */
/** @brief Change the sign of the number.
 * @param a mpf_t number we will change sign.
 * @par Descrpition:
 * Change the sign of the given number, i.e. implements a = -a
 * */
#define mpf_EGlpNumSign(a) mpf_neg(a,a)

/* ========================================================================= */
/** @brief return the closest double value of the given pointer number.
 * @param a mpf_t number that we will be transformed to double.
 * @return double the closest double representation of the given number.
 * par Description:
 * return the double number closest in value to the value stored in a.
 * */
#define mpf_EGlpNumToLf(a) mpf_get_d(a)

/* ========================================================================= */
/** @brief initialize the internal memory of a given variable */
#define mpf_EGlpNumInitVar(a) mpf_init(a)

/* ========================================================================= */
/** @brief free the internal memory of a given variable */
#define mpf_EGlpNumClearVar(a) mpf_clear(a)

/* ========================================================================= */
/** @} */
#endif