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

decimal number Power

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



Joined: 18 Nov 2008
Posts: 281
Location: Athens, Greece.

View user's profile Send private message

decimal number Power
PostPosted: Thu Jan 09, 2020 3:42 am     Reply with quote

Hello!

If I try to raise a decimal number to a power I get the following error:
Only integers are supported for this operation


Code:

void MyTest(){

   float Number=5.5;
   float Result=0;
   
   Result=Number^0.885;

}


Any ideas?
_________________
George.
temtronic



Joined: 01 Jul 2010
Posts: 9226
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Jan 09, 2020 6:07 am     Reply with quote

hmm... I don't see how you use the POW() function...


oopsy.. I figured it out( 2nd pot of coffee.)

the '^' is the bitwise OR operator in CCS C, not the X to the power of Y operator....


While your project is open, press F11 and the CCS manual pops up, serch the functions list, find POW(), there's a description/example there.

add code lke this...

#INCLUDE <math.h>;
...
...
result=POW(number,0.885);


Jay
georpo



Joined: 18 Nov 2008
Posts: 281
Location: Athens, Greece.

View user's profile Send private message

PostPosted: Thu Jan 09, 2020 6:32 am     Reply with quote

temtronic Thanks for the tip!!!

Smile
_________________
George.
Ttelmah



Joined: 11 Mar 2010
Posts: 19509

View user's profile Send private message

PostPosted: Thu Jan 09, 2020 8:48 am     Reply with quote

Actually XOR, not OR. Very Happy
temtronic



Joined: 01 Jul 2010
Posts: 9226
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Jan 09, 2020 9:57 am     Reply with quote

sigh, I was waiiting for the 2nd pot to be made.
Mr. T is right, again....
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