boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Computation版 - 关于计算精度的问题 c++
相关主题
问个double计算精度的问题
怎么提高Matlab的计算精度?
高精度计算问题
如何处理这样的精度?
Question about Matlab GUI command
1 Multi-Processing with OpenMP zz
请教一个关于PDE数值解方面的问题
解ODE的六阶精度Runge-Kutta法
fortran怎么处理很大的数?
请教关于解fractional partial differential equ
相关话题的讨论汇总
话题: c++话题: 15话题: integer话题: 计算精度话题: 10
进入Computation版参与讨论
1 (共1页)
t*****s
发帖数: 49
1
请问有没有什么方法可以定义和使用更长的实数而不使去精度, 比如
计算 1。111111111111111112e20 - 1.111111111111111111e20 (小数点后18位)
多谢帮助
c****p
发帖数: 6474
2
数组计算?

【在 t*****s 的大作中提到】
: 请问有没有什么方法可以定义和使用更长的实数而不使去精度, 比如
: 计算 1。111111111111111112e20 - 1.111111111111111111e20 (小数点后18位)
: 多谢帮助

f**l
发帖数: 2041
3
Mathematica can do that, if your computation is not heavy.

【在 t*****s 的大作中提到】
: 请问有没有什么方法可以定义和使用更长的实数而不使去精度, 比如
: 计算 1。111111111111111112e20 - 1.111111111111111111e20 (小数点后18位)
: 多谢帮助

t*****s
发帖数: 49
4
thanks a lot for the reply. But is there anyway to solve the problem in C++ ?
M**********n
发帖数: 432
5
If you are dealing with large numbers you can use two variables to store
that number. Use a long integer to store the integer part and double for the
fractional part.
For example, if m is an integer for power index
1.12345678901234567890e+m = 1.12345678901234567890*10^(+15)*10^(m-15)
=(1123456789012345.67890)*10^(m-15)
=(1123456789012345 + 0.67890)*10^(m-15)
=(long + double)*10^(m-15)
This way you can keep enough precision in double.
However you have to define your own algorithm for adding, mult

【在 t*****s 的大作中提到】
: 请问有没有什么方法可以定义和使用更长的实数而不使去精度, 比如
: 计算 1。111111111111111112e20 - 1.111111111111111111e20 (小数点后18位)
: 多谢帮助

k******n
发帖数: 35
6
C# can do it. But calling C# from C++ is a little bit tricky.
l******n
发帖数: 1683
7
使用GMP或者类似的库

【在 t*****s 的大作中提到】
: 请问有没有什么方法可以定义和使用更长的实数而不使去精度, 比如
: 计算 1。111111111111111112e20 - 1.111111111111111111e20 (小数点后18位)
: 多谢帮助

1 (共1页)
进入Computation版参与讨论
相关主题
请教关于解fractional partial differential equ
大家讨论讨论几种不同的计算方法吧?
fortran 中怎样达到32位有效数字的精度?
Lapack的精度问题
谁能跟我讲讲fmm
请问怎么让contour画出的图在不丢失精度的情况下保存下来
Matlab计算精度请教
Matlab计算精度请教
[cloudera面试] senior engineer
否认一人一票的ID进来表态一下自己愿意有几票?
相关话题的讨论汇总
话题: c++话题: 15话题: integer话题: 计算精度话题: 10