首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >ASN.1实数与误码率的编解码

ASN.1实数与误码率的编解码
EN

Stack Overflow用户
提问于 2015-01-27 08:37:04
回答 1查看 1.8K关注 0票数 0

对不起,我的英语很差。我在十进制中有一个数字:0.15625

(这是一个例子) words.pdf (第5页)

以八进制编码:09 03 90 FE 0A (这是正确的决定)

http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf -标准ASN.1(8.5 -实)

1字节:

代码语言:javascript
运行
复制
(8-7) Class - Universal - 00 
(6) P/C - Primitive - 0
(5-1) Tag Number - 01001(REAL)

总计: 00001001(2) = 09(16) (正确)

2字节:

代码语言:javascript
运行
复制
     (8) binary encoding - 1
      _____________________
     (7) When binary encoding is used (bit 8 = 1), then if the mantissa M is 
         non-zero, it shall be represented by a sign S, a positive integer value N 
         and a binary scaling factor F, such that:
            M = S × N × 2F
         Bit 7 of the first contents octets shall be 1 if S is –1 and 0 otherwise. 
         What I would have bit 7?
        _____________________
     (6-5) base 8 - 01
       _______________________
     (3-4) Bits 4 to 3 of the first contents octet shall encode the value of
     the binary scaling factor F as an unsigned binary
     integer. I don't have scaling factor. - 00
      _____________________
     (2-1) 8.5.6.4 Bits 2 to 1 of the first contents octet shall encode 
     the format of the exponent as follows: I do not know how to determine 
     what my value will be here. (Poor understand English). I think 11?

总计: 1?010011 -不等于03为什么?(不正确)

90是什么?打电话给八位?怎么找到它?这本书没有说,或者我根本就不明白。

FE代码编号-2(指数)中,如何翻译FE,而不是获取254和-2?也许它包含有关字节的信息:90

感谢您的收听。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-01-27 09:24:04

在“第1章. ASN.1编码的共同规则”一节中,它指出编码有三个部分:

  1. 信息块
  2. 长度块
  3. 值块

length块指定值块的长度。

作为八进制09 03 80 FB 05,0.15625的编码如下所示:

代码语言:javascript
运行
复制
09       - information block (1 octet)
03       - length block (1 octet)
80 FB 05 - value block (3 octets)

值块本身由三个部分组成:信息八位组、指数块和尾数块。在这种情况下,尾数为M=5(基数2为101),指数E= -5。因此,值块是:

代码语言:javascript
运行
复制
80       - information octet
FB       - the exponent block (FB = -5)
05       - the mantissa block (5)

信息八位组指定了各种信息,包括:

  • 我们正在编码一个实数
  • 我们在基地2使用,而且
  • 这个数字是非负的(>= 0)

要回答关于FE被解释为-2的问题,这就是在2s-补码算术(更多信息)中表示负数的方法。对于单个八位数,我们有:

代码语言:javascript
运行
复制
FF   ->  -1
FE   ->  -2
FD   ->  -3
...
80   ->  -128
7F   ->  +127
7E   ->  +126
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28166194

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档