c++ - 我可以使用 `mpfr_t` 作为输入和输出参数吗?

标签 c++ c arbitrary-precision mpfr

问题很简单直接,但是我在documentation上找不到答案。 .如果我有

mpfr_t a, b;

我可以做类似的事情吗

mpfr_add(a, a, b, rnd);

这将计算ab 的总和并将结果存储在a 中。我不知道这是否会导致别名问题,可能使结果无效,或者这是否正常。

最佳答案

没关系,它在链接文档的第 4.3 节中。

MPFR allows you to use the same variable for both input and output in the same expression. For example, the main function for floating-point multiplication, mpfr_mul, can be used like this: mpfr_mul (x, x, x, rnd). This computes the square of x with rounding mode rnd and puts the result back in x.

关于c++ - 我可以使用 `mpfr_t` 作为输入和输出参数吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42436447/

相关文章:

c++ - C++ 标准中的哪一段验证了以下示例中使用的表达式 `sizeof(S::m + 42)`?

c++ - 如何建立facebook的抄写员?

c - 为什么这个 C 代码段被标记为错误?

c - 为什么我必须将我的内存地址转换为 (void *)?

c++ - c++中如何将字符串转换为string中提到的数据类型

c++ - 从 Boost ptime 中减去分钟数

c - 删除动态内存分配 - 从嵌入式 C 程序

c - 如何处理不适合任何语言数据结构的大整数

matlab - 使用 VPA 评估微小概率

c++ - 是否有相当于Python的fractions.Fraction(bignum/任意精度分数/有理数类)?