裏 RjpWiki

Julia ときどき R, Python によるコンピュータプログラム,コンピュータ・サイエンス,統計学

微少量 epsilon (Python)

2020年12月21日 | Python

R の .Machine$double.eps

the smallest positive floating-point number x such that 1 + x != 1. It equals double.base ^ ulp.digits if either double.base is 2 or double.rounding is 0; otherwise, it is (double.base ^ double.ulp.digits) / 2. Normally 2.220446e-16.

> options(digits=16)
> .Machine$double.eps
[1] 2.220446049250313e-16

> 2^-52
[1] 2.220446049250313e-16

Python では,

>>> import sys
>>> sys.float_info.epsilon
2.220446049250313e-16

... 同じだ

追記 2021/05/19

Julia だと,

julia> eps()
2.220446049250313e-16

julia> 2^-52
2.220446049250313e-16

 

コメント
  • X
  • Facebookでシェアする
  • はてなブックマークに追加する
  • LINEでシェアする

PVアクセスランキング にほんブログ村

PVアクセスランキング にほんブログ村