We're a community of 1.1M IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,080,464 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

invalid operands to binary ^ (have ‘float’ and ‘float’)

double a,b;
printf("%f",a^b);

error occurs as shown in heading.
any alternative method?

3
Contributors
4
Replies
1 Hour
Discussion Span
2 Years Ago
Last Updated
5
Views
Question
Answered
vineeshvs
Light Poster
46 posts since Jan 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Before looking for ways to do this, maybe you should consider why you want to do it in the first place. Bitwise operations not working on floating-point isn't much of an issue because most of the time it's nonsensical.

Narue
Bad Cop
Team Colleague
15,460 posts since Sep 2004
Reputation Points: 6,483
Solved Threads: 1,407
Skill Endorsements: 55

by a^b i mean 'a raised to b' (bth power of a). not bitwise operations.

vineeshvs
Light Poster
46 posts since Jan 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Where you got the idea ^ means raised to the power in C is a great question.

Belaying that, look in the math.h header for the function pow()

WaltP
Posting Sage w/ dash of thyme
Team Colleague
11,404 posts since May 2006
Reputation Points: 3,421
Solved Threads: 1,055
Skill Endorsements: 37

thanks... i was converting matlab to c. so didnt notice...

vineeshvs
Light Poster
46 posts since Jan 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
Question Answered as of 2 Years Ago by Narue and WaltP

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page generated in 0.0745 seconds using 2.74MB