128-bit long double floating-point data type

https://www.ibm.com/support/knowledgecenter/en/ssw_aix_71/com.ibm.aix.genprogc/128bit_long_double_floating-point_datatype.htm

The AIX® operating system supports a 128-bit long double data type that provides greater precision than the default 64-bit long double data type. The 128-bit data type can handle up to 31 significant digits (compared to 17 handled by the 64-bit long double). However, while this data type can store numbers with more precision than the 64-bit data type, it does not store numbers of greater magnitude.

The following special issues apply to the use of the 128-bit long double data type:

  • Compiling programs that use the 128-bit long double data type
  • Compliance with the IEEE 754 standard
  • Implementing the 128-bit long double format
  • Values of numeric macros

Compiling programs that use the 128-bit long double data type

To compile C programs that use the 128-bit long double data type, use the xlc128 command. This command is an alias to the xlc command with support for the 128-bit data type. The xlc command supports only the 64-bit long double data type.

The standard C library, libc.a, provides replacements for libc.a routines which are implicitly sensitive to the size of a long double. Link with the libc.a library when compiling applications that use the 64-bit long double data type. Link applications that use 128-bit long double values with both the libc128.a and libc.a libraries. When linking, be sure to specify the libc128.a library before the libc.a library in the library search order.

Compliance with IEEE 754 standard

The 64-bit implementation of the long double data type is fully compliant with the IEEE 754 standard, but the 128-bit implementation is not. Use the 64-bit implementation in applications that must conform to the IEEE 754 standard.

The 128-bit implementation differs from the IEEE standard for long double in the following ways:

  • Supports only round-to-nearest mode. If the application changes the rounding mode, results are undefined.
  • Does not fully support the IEEE special numbers NaN and INF.
  • Does not support IEEE status flags for overflow, underflow, and other conditions. These flags have no meaning for the 128-bit long double inplementation.
  • The 128-bit long double data type does not support the following math APIs: atanhlcbrtlcopysignlexp2l,expm1lfdimlfmalfmaxlfminlhypotlilogblllrintlllroundllog1pllog2llogbllrintllroundlnanl,nearbyintlnextafterlnexttowardnexttowardfnexttowardlremainderlremquolrintlroundlscalblnl,scalbnltgammal, and truncl.

Implementing the 128- bit long double format

A 128-bit long double number consists of an ordered pair of 64-bit double-precision numbers. The first member of the ordered pair contains the high-order part of the number, and the second member contains the low-order part. The value of the long double quantity is the sum of the two 64-bit numbers.

Each of the two 64-bit numbers is itself a double-precision floating-point number with a sign, exponent, and significand. Typically the low-order member has a magnitude that is less than 0.5 units in the last place of the high part, so the values of the two 64-bit numbers do not overlap and the entire significand of the low-order number adds precision beyond the high-order number.

This representation results in several issues that must be considered in the use of these numbers:

  • The exponent range is the same as that of double precision. Although the precision is greater, the magnitude of representable numbers is the same as 64-bit double precision.
  • As the absolute value of the magnitude decreases (near the denormal range), the additional precision available in the low-order part also decreases. When the value to be represented is in the denormal range, this representation provides no more precision than the 64-bit double-precision data type.
  • The actual number of bits of precision can vary. If the low-order part is much less than 1 ULP of the high-order part, significant bits (either all 0's or all 1's) are implied between the significant of the high-order and low-order numbers. Certain algorithms that rely on having a fixed number of bits in the significand can fail when using 128-bit long double numbers.

Values of numeric macros

Because of the storage method for the long double data type, more than one number can satisfy certain values that are available as macros.The representation of 128-bit long double numbers means that the following macros required by standard C in the values.h file do not have clear meaning:

  • Number of bits in the mantissa (LDBL_MANT_DIG)
  • Epsilon (LBDL_EPSILON)
  • Maximum representable finite value (LDBL_MAX)

Number of bits in the mantissa

The number of bits in the significand is not fixed, but for a correctly formatted number (except in the denormal range) the minimum number available is 106. Therefore, the value of the LDBL_MANT_DIG macro is 106.

Epsilon

The ANSI C standard defines the value of epsilon as the difference between 1.0 and the least representable value greater than 1.0, that is, b**(1-p), where b is the radix (2) and p is the number of base b digits in the number. This definition requires that the number of base b digits is fixed, which is not true for 128-bit long double numbers.

The smallest representable value greater than 1.0 is this number:

0x3FF0000000000000, 0x0000000000000001

The difference between this value and 1.0 is this number:

0x0000000000000001, 0x0000000000000000
0.4940656458412465441765687928682213E-323

Because 128-bit numbers usually provide at least 106 bits of precision, an appropriate minimum value for p is 106. Thus, b**(1-p) and 2**(-105) yield this value:

0x3960000000000000, 0x0000000000000000
0.24651903288156618919116517665087070E-31

Both values satisfy the definition of epsilon according to standard C. The long double subroutines use the second value because it better characterizes the accuracy provided by the 128-bit implementation.

Maximum long double value

The value of the LDBL_MAX macro is the largest 128-bit long double number that can be multiplied by 1.0 and yield the original number. This value is also the largest finite value that can be generated by primitive operations, such as multiplication and division:

0x7FEFFFFFFFFFFFFF, 0x7C9FFFFFFFFFFFFF
0.1797693134862315907729305190789002575e+309
Python网络爬虫与推荐算法新闻推荐平台:网络爬虫:通过Python实现新浪新闻的爬取,可爬取新闻页面上的标题、文本、图片、视频链接(保留排版) 推荐算法:权重衰减+标签推荐+区域推荐+热点推荐.zip项目工程资源经过严格测试可直接运行成功且功能正常的情况才上传,可轻松复刻,拿到资料包后可轻松复现出一样的项目,本人系统开发经验充足(全领域),有任何使用问题欢迎随时与我联系,我会及时为您解惑,提供帮助。 【资源内容】:包含完整源码+工程文件+说明(如有)等。答辩评审平均分达到96分,放心下载使用!可轻松复现,设计报告也可借鉴此项目,该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的。 【提供帮助】:有任何使用问题欢迎随时与我联系,我会及时解答解惑,提供帮助 【附带帮助】:若还需要相关开发工具、学习资料等,我会提供帮助,提供资料,鼓励学习进步 【项目价值】:可用在相关项目设计中,皆可应用在项目、毕业设计、课程设计、期末/期中/大作业、工程实训、大创等学科竞赛比赛、初期项目立项、学习/练手等方面,可借鉴此优质项目实现复刻,设计报告也可借鉴此项目,也可基于此项目来扩展开发出更多功能 下载后请首先打开README文件(如有),项目工程可直接复现复刻,如果基础还行,也可在此程序基础上进行修改,以实现其它功能。供开源学习/技术交流/学习参考,勿用于商业用途。质量优质,放心下载使用。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值