473,734 Members | 2,764 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Trouble calculating 5th root of a given number using C

Hi Friends

Please help me to write a C program to find the 5th (fifth) root of a given number.
Ex:(1) Input : 32
Output : 5th root of 32 is 2

Ex:(1) Input : 243
Output : 5th root of 243 is 3

Click here : www.c4swimmers.esmartguy.com to Test Your C Programming Strengths.
Waiting for your reply.

Regards
Kishor
Nov 14 '05
13 12744
Christopher Benson-Manica wrote:
32 (or any number other than 0) raised to the zero power gives 1.


http://mathworld.wolfram.com/ExponentLaws.html

The definition 0^0=1 is sometimes used to simplify
formulas, but it should be kept in mind that this
equality is a definition and not a fundamental
mathematical truth (Knuth 1992; Knuth 1997, p. 56).

<g>

Nov 14 '05 #11
Grumble wrote:
Christopher Benson-Manica wrote:
32 (or any number other than 0) raised to the zero power gives 1.

http://mathworld.wolfram.com/ExponentLaws.html

The definition 0^0=1 is sometimes used to simplify
formulas, but it should be kept in mind that this
equality is a definition and not a fundamental
mathematical truth


That's quite a weird statement, if you think about it. I know it's not
your statement but Mathworld's, but still.

To my surprise (and to get on-topic), C99 doesn't really say what
pow(0.0, 0.0) should be:

"The pow functions compute x raised to the power y. A domain error
occurs if x is finite and negative and y is finite and not an integer
value. A domain error may occur if x is zero and y is less than or equal
to zero. A range error may occur."
(Knuth 1992; Knuth 1997, p. 56).


Knuth Vol 1, third edition, seems to be giving more info on binomials
than I could ever care to know on page 56, but nothing about exponentials.

Best regards,

Sidney

Nov 14 '05 #12
Sidney Cadot <si****@jigsaw. nl> wrote:

To my surprise (and to get on-topic), C99 doesn't really say what
pow(0.0, 0.0) should be:


It does in Annex F (for IEEE floating-point).

-Larry Jones

Summer vacation started! I can't be sick! -- Calvin
Nov 14 '05 #13
la************@ ugsplm.com wrote:
Sidney Cadot <si****@jigsaw. nl> wrote:
To my surprise (and to get on-topic), C99 doesn't really say what
pow(0.0, 0.0) should be:

It does in Annex F (for IEEE floating-point).


So I see! F.9.4.4:

"pow(x,±0) returns 1 for any x, even a NaN."

The NaN clause is a surprise, to me at least.

Thanks and regards,

Sidney

Nov 14 '05 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
4964
by: Penn Markham | last post by:
Hello all, I am writing a script where I need to use the system() function to call htpasswd. I can do this just fine on the command line...works great (see attached file, test.php). When my webserver runs that part of the script (see attached file, snippet.php), though, it doesn't go through. I don't get an error message or anything...it just returns a "1" (whereas it should return a "0") as far as I can tell. I have read the PHP...
8
4351
by: Ricky Romaya | last post by:
Hi, I'm working on a file upload script. I need to calculate the CRC32 of the file(s) which are successfully uploaded. How can I do this? PHP only have CRC32 function for strings. However, the uploaded file(s) are mostly binaries, and assumed have large size (5-12 MB per file). Are there any ways other than CRC32 (which supported by default PHP installation) to generate a unique hash of an arbitrary files? (the users of my script are...
8
1414
by: ali | last post by:
Hi, I'm trying to work on a recursive function that will give me root valuefor a given number. What i mean by root value is, if given 13, the answer is 1+3 = 4. If given 65, the answer is 2, i.e, 6+5=11, and 1+1=2. The final answer is always less than 10. I've been able to work on the code, but i can get it to work for
4
15610
by: 21novembre | last post by:
Hi all, I got a quite strange problem when I tried to setup a database backup shell. I put it this way: "bin/mysqldump --opt --user=xxx --password=xxx DB > DB.bak" However, error 1045 came to me to say "Access denied for user 'xxx'@'localhost' (using password: YES) when trying to connect". None the less, I'm absolutely full of confidence on my correct username and password, simply because if I do it this way: "bin/mysqldump --opt...
14
20985
by: Protoman | last post by:
How do I write a function to calculate the nth root of a number; I'm sick of using pow() with a fractional exponent to do the job. Got any ideas on how to do this? Thanks for the help!!!
4
8489
by: sathyashrayan | last post by:
(This is not a home work question) Dear group, I want a program to find one number between a set of natural number.A program to guess a number in between a Natural number set.This should be a simple task but my mind suddenly got stuck. I am trying to implement a square root function as a practice. I am able to code for the perfect square
3
7167
by: weston | last post by:
I'm making a foray into trying to create custom vertical scrollbars and sliders, and thought I had a basic idea how to do it, but seem to be having some trouble with the implementation. My thinking was: (a) create a div for the slider / scroll nub to move within (b) attach event handlers which, onmousedown, specify the slider/nub is moveable, and onmouseup, specify it's not (c) attach an event handler to the contaning div which,...
6
2263
by: Gonzalo Monzón | last post by:
Hi all! I have been translating some Python custom C extension code into Python, as I need these modules to be portable and run on a PocketPC without the need of compile (for the purpose its a must 2.4 as it is the last PythonCE release with great improvements). But I've been stuck with a script wich does not work as expected once translated to python, 2.4
5
13376
matheussousuke
by: matheussousuke | last post by:
Hello, I'm using tiny MCE plugin on my oscommerce and it is inserting my website URL when I use insert image function in the emails. The goal is: Make it send the email with the URL http://mghospedagem.com/images/controlpanel.jpg instead of http://mghospedagem.comhttp://mghospedagem.com/images/controlpanel.jpg As u see, there's the website URL before the image URL.
0
8946
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8776
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9449
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9236
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4809
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3261
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2724
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.