Exact match. Not showing close matches.
PICList
Thread
'[PIC]: Floating point or fixed point routines?'
2001\04\16@105737
by
Jose S. Samonte Jr.
2001\04\16@135520
by
Olin Lathrop
> What's the difference between floating point and fixed point?
In short, fixed point has a fixed number of fraction bits. Floating point
numbers contain a value that indicates the number of fraction bits at run
time.
There is a lot more to it than this, so go spend some time in the library.
I would imagine most introductory computer science texts that discuss data
structures would cover this sort of thing.
********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 7429014, .....olinKILLspam@spam@embedinc.com, http://www.embedinc.com

http://www.piclist.com hint: To leave the PICList
piclistunsubscriberequestKILLspammitvma.mit.edu
2001\04\16@143721
by
mike

On Mon, 16 Apr 2001 08:56:07 MDT, you wrote:
>What's the difference between floating point and fixed point?
Floating point can represent a large range of numbers, but with less
precision, all other things being equal (i.e. the number of bytes
used)
>When do you use floating point routines? Only when you ABSOLUTELY have to, especially on a processor like a PIC
with limited RAM and code space  Floating point code is usually
memory and processortime hungry. Embedded apps rarely have the need
for floating point's range, as realworkd values don't often cover a
wide enough range to need
>When do you use fixed point
>routines?
When you want to reprent a fractional value. You have to decide where
to put the point, which will depend on your appliction.
There is actually almost no difference between integers and fixed
point numbers in terms of code  the point is where you think you need
it  the precessor often doesn't know or care.

http://www.piclist.com hint: To leave the PICList
.....piclistunsubscriberequestKILLspam.....mitvma.mit.edu
2001\04\16@151844
by
Drew Vassallo
> >When do you use fixed point
> >routines?
>When you want to reprent a fractional value. You have to decide where
>to put the point, which will depend on your appliction.
>
>There is actually almost no difference between integers and fixed
>point numbers in terms of code  the point is where you think you need
>it  the precessor often doesn't know or care.
Uhoh.. let's not start this one again!
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com

http://www.piclist.com hint: To leave the PICList
EraseMEpiclistunsubscriberequestspam_OUTTakeThisOuTmitvma.mit.edu
2001\04\16@155622
by
David W. Gulley

> What's the difference between floating point and fixed point?
The following is an oversimplification to give a quick idea of the
difference between floating point and fixed point numbers.
Fixed point numbers represent integers (e.g. 1,2,3...),
Floating point numbers represent real numbers (e.g. 3.14159, 1.41421)
A 16bit fixed point number can represent the range of integers
as unsigned numbers from:
0 (0x0000) to 65535 (0xFFFF)
or if dealing with signed numbers from:
32768 (0x8000) to 1 (0xFFFF) and 0 (0x0000) to +32767 (0x7FFF)
There are many representations of floating point numbers, but they all
have a mechanism for specifying a mantissa and an exponent to represent
a number.
For example, one possibility is to use the most significant bit of a
16bit value for the sign, the next 3 bits to represent a quaternary
exponent and the remaining 12 bits a fraction (SEEEFFFFFFFFFFFF) with
the radix point to the left of the most significant bit where the number
represented would be:
((1)^sign) * (0.FFFFFFFFFFFF) * (4^(EEE))
One of the most common floating point number representations is the
IEEE754 single precision format, which uses a 32bit value where the
most significant bit (31) is the Sign of the mantissa, bits 2330
represent the exponent plus 127, and the remaining 23 bits (022) are
the fractional part of the mantissa.
SEEEEEEEEFFFFFFFFFFFFFFFFFFFFFFF
S = sign
E = exponent
F = fraction
The general formula for using this number is:
((1)^sign) * (2^(exponent127)) * (1.fraction)
There are exceptions for certain cases of the exponent and mantissa
that this formula does not cover:
if exponent = 255 and fraction = 0, then the number represents
+/ infinity
if exponent = 0 and fraction = 0, then the number represents 0
if exponent = 255 and fraction != 0, then this represents "Not
a Number"
if exponent = 0 and fraction != 0, this is a "denormalized number"
Hopefully this is a quick summary of fixed vs floating point without
(m)any errors!
David W. Gulley
Destiny Designs

http://www.piclist.com hint: To leave the PICList
piclistunsubscriberequestspam_OUTmitvma.mit.edu
2001\04\16@210802
by
Olin Lathrop
> Fixed point numbers represent integers (e.g. 1,2,3...),
> Floating point numbers represent real numbers (e.g. 3.14159, 1.41421)
Integers represent integers. Both floating point and fixed point can
represent nonintegers. The difference is that in fixed point there are a
fixed (known at assembly/compile time) number of fraction bits. Floating
point contains an extra field that specifies the number of fraction bits at
run time. This makes floating point more adaptive and easier to use with a
large dynamic range of values. The downside is lower precision for the same
amount of storage used, and more more complicated handling in the math
routines at run time.
You can make an analogy with scientific notation decimal numbers. 3.14159
can also be expressed as 314159 x 10**5. If you had a bunch of numbers
where the 10**5 part was understood and therefore not stored, that would be
fixed point. If the exponent was stored and could therefor change at run
time, that would be floating point.
********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 7429014, @spam@olinKILLspamembedinc.com, http://www.embedinc.com

http://www.piclist.com hint: To leave the PICList
KILLspampiclistunsubscriberequestKILLspammitvma.mit.edu
2001\04\16@232937
by
Bill Westfield
The difference is that in fixed point there are a fixed (known at
assembly/compile time) number of fraction bits. Floating point contains
an extra field that specifies the number of fraction bits at run time.
While I know what you MEAN, I wouldn't have said it that way. Floating
point usually has a fixed number of fraction bits and a variable
EXPONENT. (*A* result of this is that you can specify a variable number
of bits of fraction for real numbers in the range up to 2^N (for N bits
of "mantissa." You can ADDITIONALLY go way outside that range with a
fixed number of bits of PRECISION in the fraction/mantissa.)
I might have said...
Integer math includes a binary number and an implied multiplier of 1.
Fixed point math includes a binary number and a knownatcompiletime
implied multiplier less than 1 ( 2^(N))
Floating point math includes a binary number AND a second binary number
to indicate the exponent used in the multiplier (which can be
bigger or smaller than 0)
So: Format Memory Multipler Value
integer 0x1234 (implied 2^0 = 1) 0x1234
fixed pt. 0x1234 (implied 2^8 = 1/256) 0x12.34
float pt 0x1234 0x56 (2^56) 0x0.1234 * 2^56
Things are not as exciting as they used to be back in the days before there
was a standardized floating point format. Used to be that the mantissa could
be Binary or BCD, the root of the exponent could be 2, 10, or even 16 (?), and
the sign bit/format could be variously expressed.
Come to think of it, if you MUST use floating point in a microcontroller
(which means implementing it entirely in software), it's probably still a
pretty good idea to design your own format, except when you can afford the
time and space of an existing library...
BillW

http://www.piclist.com hint: To leave the PICList
RemoveMEpiclistunsubscriberequestTakeThisOuTmitvma.mit.edu
More... (looser matching)
 Last day of these posts
 In 2001
, 2002 only
 Today
 New search...