PDA

View Full Version : hỏi về biểu diễn số thập phân


viet_bk
05-01-2009, 04:40 PM
Bác nào cho em hỏi cách biểu diễn số thập phân cái

em có một chương trình sau:

Synopsis:
#include <arith.h>
void fpmul(float fOpr1, float fOpr2, float *fRes);
Assembly:
push X ; preserve X register if necessary
mov A, >fRes ; push the address of result variable
push A
mov A, <fRes
push A
mov A, [fOpr2+0] ; push the second parameter fOpr2
push A
mov A, [fOpr2+1]
push A
mov A, [fOpr2+2]
push A
mov A, [fOpr2+3]
push A
mov A, [fOpr1+0] ; push the first parameter fOpr1
push A
mov A, [fOpr1+1]
push A
mov A, [fOpr1+2]
push A
mov A, [fOpr1+3]
push A
lcall fpmul ; do the multiplication
add SP, 246 ; pop the stack
pop X ; restore the X register if necessary

trong đó:
fOpr1,fOpr2 là các số thập phân. nó biểu diễn bằng 4byte thì phải. bác nào giả thích cho em cái. thanks

namqn
05-01-2009, 05:24 PM
Các toán hạng fOpr1 và fOpr2 là các toán hạng kiểu float (dấu chấm động, độ chính xác đơn trong C). Bạn chưa cho biết bộ xử lý được dùng.

Thân,

viet_bk
06-01-2009, 01:23 PM
em dùng Psoc. em cung đã tìm hiều hiểu nhưng chưa hiểu rõ lắm. rất mong anh giả đáp. nó bảo là dùng theo chuẩn IEEE standard 754.

thanks!

namqn
06-01-2009, 05:42 PM
em dùng Psoc. em cung đã tìm hiều hiểu nhưng chưa hiểu rõ lắm. rất mong anh giả đáp. nó bảo là dùng theo chuẩn IEEE standard 754.

thanks!
Ở www.dientuvietnam.net có box dành cho PSoC, bạn nên đặt câu hỏi ở đó. Về IEEE 754, Google sẽ trả về rất nhiều link có ích, chẳng hạn:

http://steve.hollasch.net/cgindex/coding/ieeefloat.html
http://en.wikipedia.org/wiki/IEEE_754-1985
http://www.psc.edu/general/software/packages/ieee/ieee.php

Thân,