Searching \ for ' Microship 24bit Floating point format qu' in subject line. ()
Help us get a faster server
FAQ page: www.piclist.com/techref/index.htm?key=microship+24bit
Search entire site for: 'Microship 24bit Floating point format qu'.

No exact or substring matches. trying for part
'[PICLIST] Microship 24bit Floating point format qu'
2001\03\18@153523 by

Hi,
I'm converting some numbers to Microship's 32 & 24bits floating point
format (Microship application notes AN575 IEEE 754 compliant floating point
routines) but I have problems converting the zero number, I know it should
be a denormalized number but I'm not able to find the correct answer.

converting 1 to 24bits I get :
e = 0
eb = 7F
f = 0000
1 = 7F0000

and converting 0
e = 0
eb = 7f
f = 0000
0 = 7f0000

what's the correct answer ? can you explain ?

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:

Sorry I'm reposting the message because I forgot the topic tag in the first
email

Hi,
I'm converting some numbers to Microship's 32 & 24bits floating point
format (Microship application notes AN575 IEEE 754 compliant floating point
routines) but I have problems converting the zero number, I know it should
be a denormalized number but I'm not able to find the correct answer.

converting 1 to 24bits I get :
e = 0
eb = 7F
f = 0000
1 = 7F0000

and converting 0
e = 0
eb = 7f
f = 0000
0 = 7f0000

what's the correct answer ? can you explain ?

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

Zero is a special case. It is encoded as a zero biased exponent (eb=0):

00xxxx     (xxxx can have any value)

eb=0
e=-127

As your number gets closer and closer to zero, the exponent is getting
smaller and smaller until it reaches e=-127 (or eb=0), which is zero.

There is another special case, which is ignored in Microchip's
routines (according to AN575) when eb=255, which means infinity.

So, the range for exponent can be either -126..128 (ignoring Inf) or
-126..127 (using Inf). But MPLAB displays the case of eb=255 as zero
(at least in version 5.00).

Nikolai

---- Original Message ----
From: Thomas Robert de Massy <tomasdAXESS.COM>
Sent: Sunday, March 18, 2001 22:34:20
To: PICLISTMITVMA.MIT.EDU
Subj: Microship 24bit Floating point format question

{Quote hidden}

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

{Quote hidden}

With this type of floating point number you cannot express 0. The nearest
you can get is 000000 which is actually 5.87747175411E-39. Some of the math
routines in AN575 treat 000000 as a special case, but some don't so check
carefully.
If you were looking at DS00575A then you'll find the explanations rather
difficult to follow. Find DS00575B from the Microchip website, everything is
explained more clearly.

James

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestmitvma.mit.edu

I believe that the IEEE 754 and HiTech explanation is that if the exponent
is 0, then the 24 bit value represents 0. I've converted back and forth
between PC databases and Pic embedded structures and it works.

Tom Mariner

{Original Message removed}
> With this type of floating point number you cannot express 0. The nearest
> you can get is 000000 which is actually 5.87747175411E-39. Some of the math
> routines in AN575 treat 000000 as a special case, but some don't so check
> carefully.
> If you were looking at DS00575A then you'll find the explanations rather
> difficult to follow. Find DS00575B from the Microchip website, everything is
> explained more clearly.

I use a floating point number format where zero can be represented
exactly.  It is basically the IEEE standard for 32 bit floating point
squished into 24 bits.  So far I have not needed more than 24 bit
floating point numbers in a PIC.  1 part in 65000 is usually plenty
for any real world application.

Here are the header comments for the FP24FLT routine, which describe
the floating point format:

;   Subroutine FP24FLT
;
;   Convert the signed fixed point number in REGA to 24 bit floating point
;   in the low 24 bits of REGA.  REG8 is a signed value indicating the number
;   of fraction bits included in the fixed point REGA value.
;
;   24 bit floating point format:
;
;     24 bits are used to describe a floating point value using 1 sign bit
;     7 exponent bits, and 16 mantissa bits as follows:
;
;     |         byte 2        |         byte 1        |         byte 0        |
;     |           |           |           |           |           |           |
;      23 22 21 20 19 18 17 16 15 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0
;     ------------------------------------------------------------------------
;     |  |                    |                                               |
;     | S|      EXP           |                   MANT                        |
;     |  |                    |                                               |
;     ------------------------------------------------------------------------
;
;     S  -  Sign bit.  0 for positive or zero value, 1 for negative value.
;
;     EXP  -  Exponent.  The overall floating point value is the mantissa
;       value times 2 ** (EXP - 64) when EXP is in the range from 1 to 127.
;       The special EXP value of 0 is only used when the overall floating
;       point value is 0.0.
;
;     MANT  -  Mantissa.  Except for the special case when the overall
;       floating point value is 0, the mantissa represents a fixed point
;       value such that 1 <= mantissa < 2.  This means the integer part of
;       the mantissa is always 1.  Since this integer part is always the
;       same, it is not stored.  The MANT field contains the 16 most
;       significant fraction bits of the mantissa value.  Therefore
;       MANT = (mantissa - 1) * 65536.  An overall floating point value of
;       0.0 is indicated by EXP = 0.  In that case MANT is reserved, and
;       should be 0.
;
;    Consider the following examples:
;
;      0.0 --> 000000h
;
;        S = 0  (positive or zero)
;        EXP = 0  (special case for 0.0)
;        MANT = 0  (special case for 0.0)
;
;      1.0 --> 400000h
;
;        S = 0  (positive or zero)
;        exponent = 0, EXP = 64 --> 40h
;        mantissa = 1.0, MANT = 0
;
;      -3.141593 --> C19220h
;
;        S = 1  (negative)
;        exponent = 2, EXP = 65 --> 41h
;        mantissa = 1.570797, MANT = 37,408 --> 9220h
;
;   Unless otherwise specified, overflow and underflow values are silently
;   clipped to the maximum magnitude (7FFFFF for positive, FFFFFF for negative)
;   and zero, respectively.
;

********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, olinembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestmitvma.mit.edu

I didn't find these file on microchip's web site DS00575A & DS00575B where
did you find them ? The only file I have is 00575.PDF is it the same ? Are
sure the library doesn't support 0. Because everyone told me that if the exp
(biased) is 0 then the number is interpreted as 0.

Thanks

{Original Message removed}
Sorry for reply delay. 220 piclist emails only arrived this morning.

>I didn't find these file on microchip's web site DS00575A & DS00575B where
>did you find them ?

unfortunately the document is 150 pages long  (only the first 10 pages are
explanation, the rest is library code).

>The only file I have is 00575.PDF is it the same ?
Yes, revision B is easier to understand.

>Are sure the library doesn't support 0 ?
Sorry, I should have been more specific. All (as far as I know) the math
routines treat a number with AEXP = 0 as 0 except INT24 which does this :

If  INT24 is called when AEXP is 0, but AARGB0:1 is not zero, return is
incorrect. AARGB0 and AARGB1 are unchanged, so they need to be cleared.

> Because everyone told me that if the exp (biased) is 0 then the number is
interpreted as 0.

Yes that is true. Page 3 of the datasheet shows that the lower limit for EXP
is 01, allowing anything with an exponent of 0 to be treated as zero by the
library routines. Sorry for the confusion, I had thought I understood this
topic....

James

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservmitvma.mit.edu with SET PICList DIGEST in the body

More... (looser matching)
- Last day of these posts
- In 2001 , 2002 only
- Today
- New search...