Forum     

Go Back   Digit Technology Discussion Forum > Software > Programming
Register FAQ Calendar Mark Forums Read

Programming The destination for developers - C, C++, Java, Python and the lot


Closed Thread
 
LinkBack Thread Tools Display Modes
Old 27-02-2008, 09:46 PM   #1 (permalink)
Right Off the Assembly Line
 
Join Date: Jun 2006
Location: Ranchi
Posts: 10
Exclamation C/C++ Programming


Related to pow() function in C/C++. The Syntax is : pow(x,y). If the y part of the function is a fraction it gives an error. What should be the Syntax for such a function that there is no error?
pacificboy is offline  
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 27-02-2008, 10:18 PM   #2 (permalink)
Commander in Chief
 
QwertyManiac's Avatar
 
Join Date: Jul 2005
Posts: 6,658
Default Re: C/C++ Programming

Pow(x,y) has always worked perfectly for me with fractional y.

Does this program give you an error? Doesn't for me.

Code:
#include<math.h>
#include<stdio.h>

int main(void)
{
    (void)printf("%f\n",pow(4,0.75));
    return 0;
}
Note: If using GCC to compile, do link the math.h by passing -lm parameter.
__________________
Harsh J
www.harshj.com
QwertyManiac is offline  
Old 28-02-2008, 03:43 AM   #3 (permalink)
Fresh Stock Since 2005
 
Join Date: Feb 2005
Posts: 1,015
Default Re: C/C++ Programming

The return is double.. so make sure you use double for the variable...
__________________
http://www.khattam.info
khattam_ is offline  
Closed Thread

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unix(shell Programming) and TCP/IP programming tutorials Matrix Programming 4 08-04-2008 09:54 PM
PLC Programming amit2005 Programming 1 26-10-2007 10:50 AM
C Programming Ishan Programming 2 08-12-2006 07:44 PM
[Help] C Programming prasadzmultiplex Programming 76 08-04-2005 11:01 AM
C programming help godsownman Programming 4 07-03-2005 07:01 PM

 
Latest Threads
- by Charan
- by Sarath
- by clmlbx

Advertisement




All times are GMT +5.5. The time now is 12:52 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2