为什么frexp()没有产生科学记数法? [英] Why does frexp() not yield scientific notation?

查看:183
本文介绍了为什么frexp()没有产生科学记数法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

科学记数法是前preSS有一个数量明令一些常见的方法。第一非零数字,然后一个小数点,然后一个小数部分,以及指数。在二进制中,只有一个可能的非零数字

Scientific notation is the common way to express a number with an explicit order of magnitude. First a nonzero digit, then a radix point, then a fractional part, and the exponent. In binary, there is only one possible nonzero digit.

浮点运算涉及一个隐含的第一个数字等于一,那么尾数位跟着小数点。

Floating-point math involves an implicit first digit equal to one, then the mantissa bits "follow the radix point."

那么,为什么 frexp()把小数点的隐含位的左侧,并在[0.5返回一个数字,1),而不是科学,notation-如[1,2)?有一些溢出提防?

So why does frexp() put the radix point to the left of the implicit bit, and return a number in [0.5, 1) instead of scientific-notation-like [1, 2)? Is there some overflow to beware of?

有效地减去它不是由IEEE 754 / ISO 60559.指定在硬件上的偏差值一多,这一潜在的交易的另外一个XOR。独自一人,这似乎是一个pretty薄弱的论据,因为在很多情况下,逐渐恢复正常将需要另外一个浮点运算。

Effectively it subtracts one more than the bias value specified by IEEE 754/ISO 60559. In hardware, this potentially trades an addition for an XOR. Alone, that seems like a pretty weak argument, considering that in many cases getting back to normal will require another floating-point operation.

推荐答案

理由说:

4.5.4.2的frexp功能

功能frexp,ldexp和MODF是原语所用的
  库的剩余部分。有一些情绪的拖放
  出于同样的原因即ECVT,fcvt和gcvt被下降,但其
  支持者救出他们用于一般用途。它们的使用是有问题的:对
  非二进制架构ldexp可能会失去precision,并frexp可能
  低效的。

The functions frexp, ldexp, and modf are primitives used by the remainder of the library. There was some sentiment for dropping them for the same reasons that ecvt, fcvt, and gcvt were dropped, but their adherents rescued them for general use. Their use is problematic: on nonbinary architectures ldexp may lose precision, and frexp may be inefficient.

我们可以推测,图书馆的余数与 frexp 的约定写更多的方便,还是已经被传统的书面反对这个接口虽然没有提供任何好处。

One can speculate that the "remainder of the library" was more convenient to write with frexp's convention, or was already traditionally written against this interface although it did not provide any benefit.

我知道,这并不能完全回答这个问题,但它确实不太适合一个注释中。

I know that this does not fully answer the question, but it did not quite fit inside a comment.

我也要指出,一些在C语言$ P $的设计PDATE IEEE 754所做的选择或许到 frexp 返回的格式与PDP-11的浮点格式(S),或在其上首次推出的函数 frexp 任何其他架构是有意义的。编辑:又见href=\"http://pdos.csail.mit.edu/6.828/2005/readings/pdp11-40.pdf\" rel=\"nofollow\">手册为一体的

I should also point out that some of the choices made in the design of the C language predate IEEE 754. Perhaps the format returned by frexp made sense with the PDP-11's floating-point format(s), or any other architecture on which a function frexp was first introduced. See also page 155 of the manual for one PDP-11 model.

这篇关于为什么frexp()没有产生科学记数法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆