浮点数据转换指令包括不同的浮点精度数之间的转换,还包括整型和浮点数之间的转化。

在了解数据转换指令前,必须学习 IEEE 754 定义的五种舍入规则。前两条规则舍入到最接近的值,其他的称为定向舍入:

舍入到最接近的值

  1. Round to nearest, ties to even – rounds to the nearest value; if the number falls midway, it is rounded to the nearest value with an even least significant digit.(四舍五入到最接近的值;如果数字落在中间,则会四舍五入到最接近的具有偶数最低有效数字的值)

  2. Round to nearest, ties away from zero (or ties to away) – rounds to the nearest value; if the number falls midway, it is rounded to the nearest value above (for positive numbers) or below (for negative numbers).(舍入到最接近的值;如果数字落在中间,则四舍五入到上方(对于正数)或下方(对于负数)最接近的值)

定向舍入

  1. Round toward 0 – directed rounding towards zero (also known as truncation).(向零定向舍入(也称为截断))

12-09 14:36