[過去ログ] Visual Studio 2008 Part 22 (314レス)
前次1-
抽出解除 必死チェッカー(本家) (べ) 自ID レス栞 あぼーん

このスレッドは過去ログ倉庫に格納されています。
次スレ検索 歴削→次スレ 栞削→次スレ 過去ログメニュー
179: 2018/09/15(土)13:36 ID:heijdb7v(1/7) AAS
>>174
x87でも誤差を丸める方法を fpu control word で設定できる事は出来る。
四捨五入と切り捨てなどを切り替えられる。
180: 2018/09/15(土)13:42 ID:heijdb7v(2/7) AAS
fpu control word で、丸め方法と、精度の二つを独立に設定できる。

この精度の設定で、メモリ上の表現がdouble型でも、計算時のfpuの内部精度が変わってくる。

普通は64bit doubleに対して、fpu内部では80bitの精度で計算する。仮数部のbit数は、確か、それぞれ、53BIT、64BITだったかな。
181
(1): 2018/09/15(土)14:05 ID:heijdb7v(3/7) AAS
Intel® 64 and IA-32 Architectures Software Developer’s Manual

[Vol 1]

11.6.8 Compatibility of SIMD and x87 FPU Floating-Point Data Types

SSE and SSE2 extensions operate on the same single-precision and double-precision floating-point data types that
the x87 FPU operates on. However, when operating on these data types, the SSE and SSE2 extensions operate on
them in their native format (single-precision or double-precision), in contrast to the x87 FPU which extends them
to double extended-precision floating-point format to perform computations and then rounds the result back to a
single-precision or double-precision format before writing results to memory. Because the x87 FPU operates on a
higher precision format and then rounds the result to a lower precision format, it may return a slightly different
result when performing the same operation on the same single-precision or double-precision floating-point values
than is returned by the SSE and SSE2 extensions. The difference occurs only in the least-significant bits of the
significand.
182
(1): 2018/09/15(土)14:14 ID:heijdb7v(4/7) AAS
>>181
書いてある意味は、

「SSEやSSE2だと、float(32BIT)やdouble(64BIT)のまま計算するが、x87 fpuだと、もっと高い精度であるところの
  『double extended-precision floating-point format(拡張倍精度浮動小数点フォーマット:80BIT)』
で計算を実行して、丸めてから、floatやdoubleに戻す。
そのため、SSE/SSE2 と x87 fpuでは結果が変わることがある。
しかし、その場合でも結果の違いは、仮数部の LSB (最も価値の小さいBIT)の1BITにだけ現れる。」

というような事。
186
(1): 2018/09/15(土)17:12 ID:heijdb7v(5/7) AAS
>>183
「The difference occurs only in the least-significant bits of the significand.」

これは、SSE の場合の LSB と、x87 FPU の場合の FPU の2種類を頭の中に想定していると思われる。

SSE: a1 = 1.xxxxxxxxz * 10^b
x87 : a2 = 1.yyyyyyyyw * 10^c

つまり、LSB は、↑のように、z と w で、2つあるので、LSBs という英語になる。
187: 2018/09/15(土)17:15 ID:heijdb7v(6/7) AAS
誤:これは、SSE の場合の LSB と、x87 FPU の場合の FPU の2種類を
正:これは、SSE の場合の LSB と、x87 FPU の場合の 2種類を
188: 2018/09/15(土)17:18 ID:heijdb7v(7/7) AAS
>>183
>揚げ足取りだけどLSBを「最も価値が小さい」って直訳はいかがなものかなw
>普通に最下位ビットじゃないの?

整数の場合は、「最下位ビット」というと、本当にBITの位置が一番右にあるようなイメージもある。

一方、浮動小数点数の場合は、右にあるとかより、仮数部において、一番価値の小さいビット、というニュアンスを使えたかった。

IEEEでは、それは確かに一番右にあるビットであって、マシン語レベルの表現では、BIT0ではあるのだが。

ニュアンス的に。
前次1-
スレ情報 赤レス抽出 画像レス抽出 歴の未読スレ AAサムネイル

ぬこの手 ぬこTOP 0.020s