View previous topic :: View next topic |
Author |
Message |
georpo
Joined: 18 Nov 2008 Posts: 281 Location: Athens, Greece.
|
decimal number Power |
Posted: Thu Jan 09, 2020 3:42 am |
|
|
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
|
|
Posted: Thu Jan 09, 2020 6:07 am |
|
|
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.
|
|
Posted: Thu Jan 09, 2020 6:32 am |
|
|
temtronic Thanks for the tip!!!
_________________ George. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19509
|
|
Posted: Thu Jan 09, 2020 8:48 am |
|
|
Actually XOR, not OR. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9226 Location: Greensville,Ontario
|
|
Posted: Thu Jan 09, 2020 9:57 am |
|
|
sigh, I was waiiting for the 2nd pot to be made.
Mr. T is right, again.... |
|
|
|