matlab eps 大小,【 MATLAB 】eps (浮点相对精度)简介

目录

eps

Floating-point relative accuracy

Syntax

d = eps

d = eps(x)

d = eps(datatype)

Description

d = eps returns the distance from 1.0 to the next larger double-precision number, that is,

3974022a9f27ee53ca350b57c6f5f9ef.gif.

d = eps返回从1.0到下一个更大的双精度数的距离,即

d6993c55358a46ffce49e916294c18ff.gif

d = eps(x), where x has data type single or double, returns the positive distance from abs(x) to the next larger floating-point number of the same precision as x. If x has typeduration, then eps(x) returns the next larger duration value. The command eps(1.0) is equivalent to eps.

d = eps(x),其中x具有数据类型single或double,返回从abs(x)到下一个与x相同精度的较大浮点数的正距离。 如果x具有typeduration,则eps(x)返回下一个更大的持续时间值。 命令eps(1.0)等同于eps。

d = eps(datatype) returns eps according to the data type specified by datatype, which can be either 'double' or 'single'. The syntax eps('double') (default) is equivalent to eps, and eps('single') is equivalent to eps(single(1.0)).

d = eps(datatype)根据datatype指定的数据类型返回eps,数据类型可以是“double”或“single”。 语法eps('double')(默认)等同于eps,eps('single')等同于eps(single(1.0))。

Accuracy in Double Precision

clc

clear

close all

% Display the distance from 1.0 to the next largest double-precision number.

d = eps

% d = 2.2204e-16

% eps is equivalent to eps(1.0) and eps('double').

% Compute log2(eps).

d = log2(eps)

% d = -52

% In base 2, eps is equal to 2^-52.

%

% Find the distance from 10.0 to the next largest double-precision number.

d = eps(10.0)

% d = 1.7764e-15

结果如下:

d =

2.2204e-16

d =

-52

d =

1.7764e-15

Accuracy in Single Precision

clc

clear

close all

% Display the distance from 1.0 to the next largest single-precision number.

d = eps('single')

% d = single

% 1.1921e-07

% eps('single') is equivalent to eps(single(1.0)).

% Compute log2(eps('single')).

d = log2(eps('single'))

% d = single

% -23

% In base 2, single-precision eps is equal to 2^-23.

% Find the distance from the single-precision representation of 10.0 to the next largest single-precision number.

d = eps(single(10.0))

% d = single

% 9.5367e-07

结果如下:

d =

single

1.1921e-07

d =

single

-23

d =

single

9.5367e-07

本文同步分享在 博客“李锐博恩”(CSDN)。

如有侵权,请联系 support@oschina.cn 删除。

本文参与“OSC源创计划”,欢迎正在阅读的你也加入,一起分享。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值