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

signed float

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



Joined: 11 Dec 2010
Posts: 11
Location: Germany

View user's profile Send private message

signed float
PostPosted: Mon May 12, 2014 2:53 pm     Reply with quote

Sorry, but I have not found something in the Forum, but perhaps somebody can help very quickliy
I Need to define a signed float data type (for example -1.0769) and don't know how (signed float will not work) Compiler Version 4.141

Thanks.
Johann
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon May 12, 2014 3:11 pm     Reply with quote

Download the CCS manual. Go to page 37. It says a 'float' can take
values in this range: -1.5 x 1045 to 3.4 x 1038

So yes, a 'float' is inherently capable of holding a negative number.
Example:
Code:

void main()
{
float temp = -5.321;


}
ezflyr



Joined: 25 Oct 2010
Posts: 1019
Location: Tewksbury, MA

View user's profile Send private message

PostPosted: Mon May 12, 2014 3:13 pm     Reply with quote

Hi,

A 'float' data type in 'C' is inherently signed, so you need to do nothing more than

Code:

float MyVariable = -1.0769;


Frankly, it's a strange question as mostly you encounter people that want an 'unsigned' version of the float variable for things that will never be negative, ie. the result of a square root operation.

John
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Mon May 12, 2014 3:17 pm     Reply with quote

this is right up there with the special CCS vartype
signed int1

Razz Cool Laughing
Johann17943



Joined: 11 Dec 2010
Posts: 11
Location: Germany

View user's profile Send private message

PostPosted: Tue May 13, 2014 8:44 am     Reply with quote

Hi!
Thanks a lot!
I have a quite old printed manual, but I'm using the Help-button from the Compiler. There is no range given for the float32.
I think, I should update my Compiler :-)

Thanks again!

Regards,
Johann
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