CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

I need information about mantisa and floating point.

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Guillermo Alvarado
Guest







I need information about mantisa and floating point.
PostPosted: Thu Aug 30, 2001 12:28 pm     Reply with quote

Hi i need information about mantisa and float point... i want have a float point in two or more byte for separate...

for example

void main()
{

float ejemplo;
int a,b,c,d;

ejemplo=20,39;


I need in a=2, b=0, c=3, d=9 and how to i know the point

thanks
___________________________
This message was ported from CCS's old forum
Original Post ID: 104
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

Re: Necesito saber sobre puntos flotantes y mantisa
PostPosted: Thu Aug 30, 2001 12:56 pm     Reply with quote

:=Hi i need information about mantisa and float point... i want have a float point in two or more byte for separate...
---------------------------------------------------------

Check the compiler manual for the format of floating point numbers. Look in the section called "What is the format
of floating point numbers ?" on page 163.
See the link below.
___________________________
This message was ported from CCS's old forum
Original Post ID: 106
Darren Rook



Joined: 06 Sep 2003
Posts: 287
Location: Milwaukee, WI

View user's profile Send private message Send e-mail

Or...
PostPosted: Thu Aug 30, 2001 3:35 pm     Reply with quote

Check out the new FAQ page located on the menu to the left.. It answers the question of the floating point format.
___________________________
This message was ported from CCS's old forum
Original Post ID: 112
_________________
I came, I saw, I compiled.
Doug Kennedy
Guest







Re: Necesito saber sobre puntos flotantes y mantisa
PostPosted: Fri Aug 31, 2001 7:20 am     Reply with quote

Using the example in the manual 0f 100 decimal here is how it works

100 85 48 00 00
decimal hex
exp mantissa

(85-7f(bias))+1 is 7 the positive exponent is 7

the extra 1 adjusts for the .1 implied conventional representation

48 is the mantissa but has a sign bit hex 48 is 01001000 binary

so after removing the sign and noting (0 is positive) we have 1001

there is an implied binary point of .1 so we have .1+1001 or positive .11001 binary
to be raised 7 powers of 2 ( same as a shift)
the result is 1100100 which is 100 decimal
___________________________
This message was ported from CCS's old forum
Original Post ID: 129
dave2007
Guest







sobre mantisas y puntos flotantes
PostPosted: Wed Dec 19, 2007 11:51 am     Reply with quote

Hello friends, i´m designing a digital filter and i ´m working with float number inside. Later I need to transmit to another micro the data after processing it in format int16. I study the CCS compiler and i don´t know how can i form the new valor to be transmitted and work with mantissa and exponent bytes. My number look like this in the watch option:

74.488878
96.343322
-43.556547
....

thanks a lot
Dave Very Happy Very Happy
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Dec 19, 2007 12:45 pm     Reply with quote

Floating point numbers require 4 bytes (not 2 bytes as in int16).
See this FAQ article about floating point number format:
http://www.ccsinfo.com/faq.php?page=mchp_float_format

This FAQ article explains how to extract the 4 bytes from the 'float'
and write them to eeprom. You could transmit them with RS-232
instead of writing to eeprom. Use the same method.
http://www.ccsinfo.com/faq.php?page=write_eeprom_not_byte
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group