Reputation: 7894
Is it possible to do a "+=" with GMP Floating-point Functions like this?
mpf_add (op1, op1, op2);
or must the three arguments always be different (requiring the use of a temp variable)?
(Same question goes for multiplication, subtraction, and division, although I'm sure the answer is the same for all four cases.)
Upvotes: 0
Views: 99
Reputation: 11394
The GMP manual states:
GMP lets you use the same variable for both input and output in one call.
I have done so with a variety of GMP functions and it has always worked properly but I don't know if I've ever done it with the mpf functions. I generally use the MPFR library and it states that you can use the same variable for input and output, too.
Upvotes: 2