机器epsilon [英] The machine epsilon

查看:150
本文介绍了机器epsilon的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨。


继续我的教程,这是我最近添加的一个条目。我希望它没有争议。
希望它没有争议。如果你看到任何错误/含糊不清/请

只需回答这个帖子。


预先感谢您的帮助。

------------------------------------------------- ---------------------

机器epsilon


机器epsilon是最小的在表示数字

最密集的点处更改

加法运算结果的数字。在IEEE754表示中,此数字具有指数

偏差值,并且分数为1.如果您将小于

的数字添加到1.0,结果将是1.0。对于不同的表示形式

我们在标准标题中< float.h>:


#define FLT_EPSILON 1.19209290e-07F // float

#define DBL_EPSILON 2.2204460492503131e-16 //双倍

#define LDBL_EPSILON 1.084202172485504434007452e-19L // long double

// qfloat epsilon截断以便它适合此页...

#define QFLT_EPSILON 1.09003771904865842969737513593110651 ... E-106

此定义是C99 ANSI标准的一部分。对于标准类型

(float,double和long double),这个定义应该总是存在于

其他编译器中。


这里是一个程序,可以找出给定的

浮点表示的机器epsilon。


#include< stdio.h>

int main(无效)

{

double float_radix = 2.0;

double inverse_radix = 1.0 / float_radix;

double machine_precision = 1.0;

double temp = 1.0 + machine_precision;


while(temp!= 1.0){

machine_precision * = inverse_radix;

temp = 1.0 + machine_precision;

printf("%。17g \ n",machine_precision);

}

返回0;

}

Hi.

Continuing with my tutorial, here is an entry I have added recently. I
hope it is not controversial. If you see any errors/ambiguities/etc please
just answer in this thread.

Thanks in advance for your help.
----------------------------------------------------------------------
The machine epsilon

The machine epsilon is the smallest number that changes the result of an
addition operation at the point where the representation of the numbers
is the densest. In IEEE754 representation this number has an exponent
value of the bias, and a fraction of 1. If you add a number smaller than
this to 1.0, the result will be 1.0. For the different representations
we have in the standard header <float.h>:

#define FLT_EPSILON 1.19209290e-07F // float
#define DBL_EPSILON 2.2204460492503131e-16 // double
#define LDBL_EPSILON 1.084202172485504434007452e-19L //long double
// qfloat epsilon truncated so that it fits in this page...
#define QFLT_EPSILON 1.09003771904865842969737513593110651 ... E-106

This defines are part of the C99 ANSI standard. For the standard types
(float, double and long double) this defines should always exist in
other compilers.

Here is a program that will find out the machine epsilon for a given
floating point representation.

#include <stdio.h>
int main(void)
{
double float_radix=2.0;
double inverse_radix = 1.0/float_radix;
double machine_precision = 1.0;
double temp = 1.0 + machine_precision;

while (temp != 1.0) {
machine_precision *= inverse_radix;
temp = 1.0 + machine_precision ;
printf("%.17g\n",machine_precision);
}
return 0;
}

推荐答案

jacob navia说:


< snip>
jacob navia said:

<snip>

对于我们在标准标题中的不同

表示< floa t.h>:


#define FLT_EPSILON 1.19209290e-07F //浮动

#define DBL_EPSILON 2.2204460492503131e-16 //双倍

#define LDBL_EPSILON 1.084202172485504434007452e-19L // long double

// qfloat epsilon截断以便它适合此页面...

#define QFLT_EPSILON 1.09003771904865842969737513593110651。 .. E-106
For the different
representations we have in the standard header <float.h>:

#define FLT_EPSILON 1.19209290e-07F // float
#define DBL_EPSILON 2.2204460492503131e-16 // double
#define LDBL_EPSILON 1.084202172485504434007452e-19L //long double
// qfloat epsilon truncated so that it fits in this page...
#define QFLT_EPSILON 1.09003771904865842969737513593110651 ... E-106



合规实现不得在< float.h>中定义QFLT_EPSILON

Conforming implementations must not define QFLT_EPSILON in <float.h>


该定义是C99 ANSI标准的一部分。
This defines are part of the C99 ANSI standard.



好​​吧,其中三个是。


你的文字会因你在lcc-win32和C之间的混乱而受到影响。 br />

< snip>


-

Richard Heathfield< http://www.cpax.org .uk>

电子邮件:-www。 + rjh @

谷歌用户:< http://www.cpax.org.uk/prg/writings/googly.php>

Usenet是一个奇怪的放置" - dmr 1999年7月29日

Well, three of them are.

Your text suffers from your usual confusion between lcc-win32 and C.

<snip>

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999


Richard Heathfield写道:
Richard Heathfield wrote:

jacob navia说:


< snip>
jacob navia said:

<snip>

>对于我们在标准标题中的不同
表示< float.h>:

#define FLT_EPSILON 1.19209290e-07F //浮动
#define DBL_EPSILON 2.2204460492503131e-16 //双重
#define LDBL_EPSILON 1.084202172485504434007452e-19L //长双
// qfloat epsilon被截断以便它适合这个页面...
#define QFLT_EPSILON 1.09003771904865842969737513593110651 ... E-106
>For the different
representations we have in the standard header <float.h>:

#define FLT_EPSILON 1.19209290e-07F // float
#define DBL_EPSILON 2.2204460492503131e-16 // double
#define LDBL_EPSILON 1.084202172485504434007452e-19L //long double
// qfloat epsilon truncated so that it fits in this page...
#define QFLT_EPSILON 1.09003771904865842969737513593110651 ... E-106



合规实现必须不定义< float.h>中的QFLT_EPSILON


Conforming implementations must not define QFLT_EPSILON in <float.h>



C标准段落J.5.6:通用扩展名:

J.5.6其他算术类型

附加算术类型,例如_ _int128或double double,以及

定义了适当的转换(6.2.5,6.3.1)。额外的

浮动类型可能比long double有更多的范围或精度,可能是用于评估其他浮动类型的表达式的
,可能是

用于定义float_t或double_t。

The C standard paragraph J.5.6: Common extensions:
J.5.6 Other arithmetic types
Additional arithmetic types, such as _ _int128 or double double, and
their appropriate conversions are defined (6.2.5, 6.3.1). Additional
floating types may have more range or precision than long double, may be
used for evaluating expressions of other floating types, and may be
used to define float_t or double_t.


>
>

>此定义是C99 ANSI标准的一部分。
>This defines are part of the C99 ANSI standard.



好​​吧,其中三个是。


Well, three of them are.



你切下一句话!


"对于标准类型(float,double和long double),这个定义

应该总是存在于其他编译器中。


这是引用时BIAS的一个很好的例子。

You cut the next sentence!

"For the standard types (float, double and long double) this defines
should always exist in other compilers. "

This is a good example of BIAS when quoting.


在文章< 46 ****** *****************@news.orange.fr> ;,

jacob navia< ja *** @ jacob.remcomp.frwrote:
In article <46***********************@news.orange.fr>,
jacob navia <ja***@jacob.remcomp.frwrote:

>>此定义是C99 ANSI标准的一部分。
>>This defines are part of the C99 ANSI standard.



大概你的意思是这些,而不是这个。并且说定义可能不那么客气了

而不是定义。

Presumably you meant "these", not "this". And it would be less jargonish
to say "definitions" rather than "defines".


>好吧,其中三个是。
>Well, three of them are.


"对于标准类型(float,double和long double),这个定义
应该总是存在于其他编译器中。

这是引用时BIAS的一个很好的例子。


You cut the next sentence!

"For the standard types (float, double and long double) this defines
should always exist in other compilers. "

This is a good example of BIAS when quoting.



我不这么认为。即使你在下一句话中澄清它,也没有必要在这里说出错的东西,




- Richard


-

在一些字母表中需要考虑多达32个字符

" - 1963年的X3.4。

I don''t think so. There''s no need to say something that''s wrong here,
even if you clarify it in the next sentence.

-- Richard

--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.


这篇关于机器epsilon的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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