首页| JavaScript| HTML/CSS| Matlab| PHP| Python| Java| C/C++/VC++| C#| ASP| 其他|
购买积分 购买会员 激活码充值

您现在的位置是:虫虫源码 > C/C++/VC++ > 一个C++类的溢出和下溢错误比双更强大

一个C++类的溢出和下溢错误比双更强大

  • 资源大小:1.46 kB
  • 上传时间:2021-06-29
  • 下载次数:0次
  • 浏览次数:1次
  • 资源积分:1积分
  • 标      签: 一个 强大 错误 溢出

资 源 简 介

Overflows and underflows can be an issue in some calculations (such as calculating the probability of phylogenetic data). There are arbitrary precision libraries (notably GMP), but sometimes the use of them may be overkill. I made a "Superdouble" class consisting of a single header file. An object of that class is basically a number in scientific notation (i.e., 5.2 x 10^28), where the mantissa (5.2 in the example) is a long double and the exponent (28) is an integer. This allows the number to have the same precision as a long double but have an exponent that can take values much greater in magnitude than for a normal long double, dramatically reducing the chance of overflow or underflow. Basic operators (<<, , +, -, /, +=,=, -=, /=, ++, --) and natural log have all been written to work without requiring conversion back to double. There are also functions to convert from and to double. I"m a biologist not trai

文 件 列 表

superdouble.h

相 关 资 源

您 可 能 感 兴 趣 的

同 类 别 推 荐

VIP VIP
0.221148s