Invalid operands to binary ^ (have 'double' and 'double')

Hi all,
I've been trying to make some calculus like
double a, b, c;
b = 0.3;
c =0.35;
a = b^c;
but I get this error message: *"Invalid operands to binary ^ (have 'double' and 'double')"*. Does anybody know how to solve this?
Thanks in advance!

Yes I think Ray hit the nail on the head. It looks as if you wanted to perform and exponentiation operation, not a bitwise operation. So, just to expand on Ray's answer a bit, the carrot symbol (^) that you used in your statement is, in C, the bitwise XOR operator, and has nothing to do with exponentiation. There are numerous bitwise operators in C (bitwise AND (&), bitwise OR (|), bitwise XOR (^)), and they all deal with manipulating bits of data. If you were, in fact, trying to raising b to the power of c and assign that value back to a, then Ray's post was the perfect answer as to how to do that.
Many programmers that are new to C, especially ones coming from a language such as Visual Basic, where the carrot symbol is used for exponentiation operations, naturally try to use the same symbol for the same purpose in C, and are surprised to find that it doesn't do what they expected (understandably). As mentioned, this is because, in C, there is no exponentiation operator, and the carrot symbol does something completely different and unrelated to exponentiation. However, C does provide a predefined function in its standard library for exponentiation, and it is called the pow() function, which takes two double-typed arguments (the first is the number being risen and the second is the power that it is being raised to), and returns the result as a double. To use this function, all you have to do is write an include directive at the top of the file that you will be using the function in that tells the preprocessor to include the file math.h. See RayNewb's post for a solid example of how all this stuff would look in your source code, and, as he mentioned, open your Terminal and type in +man math+ or, for this particular function, +man pow+ to find out more about how this function works (you can page through the information with the spacebar or scroll down with the down arrow).
Hope this was of some help for you, and best of luck with everything!

Similar Messages

  • I have double IDs for Itunes.  How can I delete one without losing my music.  Also, I want to synce my new desktop computer with my older i4s.  All devices are registered to do so.  However, last time I tried I almost lost all music and Itunes BARELY supp

    I have double ID's for Itunes.  How can I keep all my music and get rid of the ID that I do not want.  It was an issue when I tried to transfer music ..  I contacted Itunes and they BARELY helped me get the music back.  They also would only allow me to chose one ID to replenish the music (wich was lost) to my new device.  So, I chose the ID that showed more music.  I am irritated that I still have 2 ID's and can't really figure out why they both have the same music.   Oldest to newest purchases are shown on both id's.  Also, I am afraid to sync now because they told me it was a one time deal.  When docked my phone to my new computer all of the music is shown on my computer now.  However not on my I phone. 

    I had the same problem. I solved by (I use Windows7, should be same for OSX):
    1. copying the library from the older computer to the new computer, at the usual itunes media location.
    2. on new computer's itunes preference (advance), uncheck the box "Copy files to iTunes media folder when adding to library"
    3. open up this folder of media copied over from old computer, just drag over to itunes library, cursor will turn into plus sign.
    4. since you unchecked the box for "Copy files to iTunes media folder when adding to library", you are in effect only growring the new computer's itunes library's database. Your media files are already under the folder on the new computer.
    Now when you connect iphone to this new computer and tells you it wants to erase your iphone's library in order to sync with this one, go ahead, click yes. Why is this ok now? Because you've copied all your files over to the new computer. So when you sync again, your existing files are there on the new computer.
    You should export play lists on the older computer to be imported on the new computer though.

  • HT1386 I have double and triples of photo's on my iPad. Not all my pics but most of them. I was told that I screwed up in synching with iTunes when I initally set up. How in the **** do I get rid of all the dups? I cannot delete them from my iPad. HELP ME

    I have double and triples of photo's on my iPad. Not all my pics but most of them. I was told that I screwed up in synching with iTunes when I initally set up. How in the **** do I get rid of all the dups? I cannot delete them from my iPad. HELP ME!

    If the shows are in fact still on the pad, they will be found in the videos app, not the music or I tunes app.  Look there and see if they are still there.
    If you don't see them there, go to the searchlight screen ( farthest left home page) and type in the name of one of the shows.  If it is on the pad, hiding somewhere, this will find it.
    If they are not there, they should not be using up space.
    To get them back onto your pad, plug in and sync again.  Make sure you transfer purchases first.   Before you sync, take a look at the video tab in your I tunes, and check what you want and don't want synced.

  • I have transfered some vynil albums to my ipod and for some reason some of the tracks have doubled up, why is this?

    i have transfered some vynil albums to my ipod and for some reason a few of the tracks have doubled up on some of the albums, why is this??

    It happens, just delete the duplicate files

  • My IPhone4 is secretly using alot of data even though I have double tapped Home button and closed all the apps running in the background.

    My Iphone4 is secretly using alot of data even after I have double tapped the home button and closed all the apps running in the background.
    This just started happening 3 days ago.
    When im out of home, the phone drains battery REALLY FAST, I lose 6% battery in 5 minutes.
    The phone also heats up and feels very warm after a few minutes.
    When I turn the data plan off, it becomes normal again, like I lose 1% every 30minutes even while listening to mp3.
    I can conclude that its secretly using the 3G at an alarming rate which causes the battery to die so quickly
    I have uploaded 2 pictures showing what happens before and after I turn on my WIFI.
    Notice that the ping spikes like crazy on my home network once I turn on my WIFI on my IP4
    WIFI OFF:
    WIFI ON:
    I hope someone can assist me with this!
    Thanks!!

    chuuburg wrote:
    My Iphone4 is secretly using alot of data even after I have double tapped the home button and closed all the apps running in the background.
    This just started happening 3 days ago.
    There is a common misconception that closing an app on the Quick Launch screen (it's real name) also kills the app's background process. This is not the case. First, all built in apps (mail, contacts, calendar, game center, notes, reminders, Genius, Photo Stream, etc) continue running their background processes even if killed in the Quick Launch screen. For apps from the App Store killing the foreground process also gives the app the option of killing its background process, but it doesn't have to. In addition, any app that has Notifications enabled can restart its background process if it receives a Notification.
    iOS 7 gives the user more control over background processes; you can selectively allow or deny any app to run in background. As you apparently have not upgraded this option is not available to you.
    As Chris has already told you, there's an app on your phone that is stuck in a loop. As you discovered killing foreground processes did not resolve the problem. One trick that sometimes resolves this is to let the battery run down until the phone shuts off and will not restart. Then charge to 100%.

  • I can't open the browser. I double click and nothing happens. I tried uninstalling and reinstalling but every time I do this it tells me I have to close Firefox first! I have restarted and then tried downloading to no avail b/c I get the same message.

    I can't open the browser. I double click and nothing happens. I tried uninstalling and reinstalling but every time I do this it tells me I have to close Firefox first! I have restarted and then tried downloading to no avail b/c I get the same message.

    Disable Yahoo Messenger (with the arrow on the right of your account name) in Yahoo mail.

  • When deleting photos that have double and or tripled they have not deleted-

    Ok I have posted here once before and have never resolved my problem and would really like to try and get resolved some how. I have four apple computers in my home network 1 eMac 1GHz, 1 G4 dual Processor 867MHz, 2G5 1.6GHz, 1.8GHz iMacs. All them have double if not triple photos from the same photo files from our external Hard drive that we have connect to our Apple air port extreme 802.11. now inside the external hard drive shows only one file that we all back up onto. But everyones machines were fine for awhile after doing a clean install of operating system. After a while slow but surely everyones machine started getting double and triple photos. all the same with the same id info. So I found a discussion on here before how to try and remedy this problem, but seems to have no effect and now my photos on all the machines are quadrupling for some reason cant figure it out but would like to get this fixed. I also would like to remove photos that have been deleted and clear up needed storage space.

    eMac Fan
    Do I undertsand you correctly? You are trying to share a library across 4 machines and you keep getting duplicates - or more?
    How have you this sharing set up? How do the various iPhotos access the pics? Do they have a single shared library? Or 4 seperte libraries sharing a single pool of pics?
    As much detail as possible please, but it sounds like there iPhotos are re-importing pics rather than actually sharing.
    Regards
    TD

  • I added album artwork and now I have doubles of those songs

    I added album artwork and now I have doubles of those songs on my ipod.
    I have my itunes set up to automatically update. Do I need to delete the versions of the songs without the album artwork from my ipod? How do I do this?

    See my reponse on your other post.

  • HT201320 cant send emails it says user name or password incorrect but i have double checked and its fine plus i can use the details on the main computer, so what is stopping me from sending?

    my email is saying cant send as the username or password is wrong, i have double checked and its excactly the same as what i use on my computer.

    I found the answer guys it was mysmpt.live.com the password was not the same whoo hoo

  • TS3899 I accidently turned ON contacts when I was turning ON my yahoo email account in settings and now all the emails from contacts have been merged to create SEPARATE contact right under the original contact name. Now I have double contacts for everyone

    I accidently turned ON contacts when I was turning ON my yahoo email account in Settings and now all the emails from contacts have been merged to create SEPARATE contact right under the original contact name. Now I have double contacts for everyone with an email address!!! how do I UNDO? it says all CONTACTS WILL BE DELETED...when I go to turn CONTACTS to OFF.

    Any contacts synced with the Yahoo account will be deleted from the phone if you turn it off. They will still be out there in Yahoo land, so if you turn it off and it deletes something you didn't want to, just turn it back on again.
    It's extremely unclear what you did when you say " I only created contacts and typed in emails that I had for those contacts.....so I am still not sure how to UNdo what I did without deleting anything"
    Undo WHAT, exactly? You said "I accidently turned ON contacts when I was turning ON my yahoo email account in Settings and now all the emails from contacts have been merged to create SEPARATE contact right under the original contact name."
    Just turn it off.

  • HT2905 Many (most) of my songs in my library have multiplied. I now have doubles and triples of my music. I don't know why it has done this or how to fix this problem. This is a new problem since I synced a new ipod touch this week.

    Many(most) of my songs in my library have multiplied. I now have doubles and triples of my music. This is a new problem that started this week when I synced my new ipod touch. Why did this happen and how do I get rid of it. I have around 1400 duplicates in my library now.

    I suspect in this case the problem is caused by your library and device having downloaded independent copies of the media, so that when the library connects to the device it copies over your purchases not realizing they are already in the library.
    When deduping use Shift > View > Show Exact Duplicate Items as this is normally a more useful selection. You need to manually select all but one of each group to remove. Sorting the list by Date Added may make it easier to select the appropriate tracks. If you have multiple entries in iTunes connected to the same file on the hard drive then don't send to the recycle bin. Use my DeDuper script if you're not sure, don't want to do it by hand, or want to preserve ratings, play counts and playlist membership. See this thread for background and please take note of the warning to backup your library before deduping.
    (If you don't see the menu bar press ALT to show it temporarily or CTRL+B to keep it displayed)
    tt2

  • In the libary of iPhoto I do have double pictures only in the year 2006. Can someone please tell me how to remove the double pictures. I did rebuilt the libary but that solution did not help me any further.

    In the libary of iPhoto I do have double pictures only in the year 2006. Can someone please tell me how to remove the double pictures. I did rebuilt the libary but that solution did not help me any further.

    I think the warning is very clear.
    What warning? Where do you say that this plan you suggest will lose at least some, and possibly a whole lot of metadata, plus  the original files of edited photos. This is significant dataloss. And you should warn people that this is the case.
    While your metadata and originals may not be important to you, that is not necessarily the case for other users.
    Fourthly, and last, cleaning the iPhoto library should be done at least once per year
    This is nonsense. The iPhoto Library has no need of "cleaning" and certainly not in any way that trashes a whole lot of data.
    I'm very impressed that you assess the application based on the sound of the name. It's not a common way to review applications, but I'm sure it has some merit.
    FWIW it has been recommended on this - and other - sites for many years and has proven safe and effective.
    Regards
    TD

  • Why do i have duplicate songs in most of my albums? using iTunes match, use computer to charge phone, it must have synced now have double songs

    I think when i was charging my iphone and syncing iphoto, itunes synced.  i never check the box that says "synce itunes when iphone connected' but this box somehow was checked. now i have double music, taking up a lot of space.  Having to manually remove all the duplicate songs.  this is the third time this has happened. I do not have the time to sit and manually do this.  Can anyone tell me why this is happening and is there an easier fix?  could turn off itunes match and turn it back on again, but then have to redownload my music individually, which is also time consuming.

    I had the exact same issue!! Seriously p*ssed me off when I checked out my ITunes purchased items (via my computer) and noticed that most of the additional tracks listed on my IPhone playlist was listed there too. However, I never authorized any purchases!!  (I have actually written Apple Support asking for a full refund of all tracks listed on my purchased list)
    Be careful when you swipe your finger to the left/right on those "additional" tracks on your IPhone playlist... I'm pretty sure that the cloud symbol is an option to download or automatically buy those tracks.
    Solution for the problem:
    1 - go to your IPhone settings
    2 - choose "iTunes & App Store"
    3 - go to "Show All" & "Music"
    4 - turn off "Music" by moving the bar to the left (it should be a white color once you turn it off)
    Should solve your problem :~)

  • Why do I have double of every movie??

    When I open the finder, I click on All Movies, and I'm able to see all my movies. The problem is I have double of every movie! Why is this? Can I delete one of each? If so, which one should I delete?? I'm just upset that it's taking up double the amount of memory it needs to. Thanks

    Id like help on this too
    Could be something to do with Iphoto&imovie....I import all my pics and movie clips into iphoto
    Then as you probably know when you open imovie and select 'iphoto videos' it spends a million years opening thumbnails of every movie clip...
    Its just a guess...but could this be actually duplicating every movie file?
    Whats the deal here....I'd really like a huge amount of disc space back

  • In one of my iPhoto 'event' files other photos from another event seem to have doubled up over a different photo!!!!!

    In one of my iPhoto 'event' files  (named Thailand) other photos from another event (named Filey) seem to have doubled in the Thailand event, but when I click on the image  (from filey) it shows the Thailand image!!!!!
    I hope this is understandable
    Thank you
    Sheena

    What is your iPhoto version and your MacOS X version on your MacBook Pro? It looks like the thumbnails of your photos were wrong. Make a backup copy of your iPhoto library and try to rebuild the thumbnails. in iPhoto '11 try this:
    Launch iPhoto with the key combination⌥⌘  (alt/option-command) held down and select "rebuild thumbnails" from the panel.

Maybe you are looking for