473,385 Members | 1,640 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Math.Pow() bug?

Bo
double v = -0.17665577379401631
double f = 0.016666666666666666
Math.Pow(v, f) returns me NaN.

What should I do now?
Nov 16 '05 #1
5 4999
On 3 Dec 2004 13:41:15 -0800, bo*****@yahoo.com (Bo) wrote:
double v = -0.17665577379401631
double f = 0.016666666666666666
Math.Pow(v, f) returns me NaN.

What should I do now?


Read the documentation?
--
http://www.kynosarges.de
Nov 16 '05 #2
"Bo" <bo*****@yahoo.com> wrote in message
news:a7**************************@posting.google.c om...
double v = -0.17665577379401631
double f = 0.016666666666666666
Math.Pow(v, f) returns me NaN.

What should I do now?


Use different numbers? f = 1/60, so you are asking for the 60th root
of v, or, what number when multiplied by itself 60 times will equal v.

But no number can, because, as 60 is even, any number raised to the 60th
power will be positive. In fact, Math.Pow is documented as refusing to
calculate the root of any negative number. The Calculator app that comes
with Windows operates the same way.

--
Truth,
James Curran
[erstwhile VC++ MVP]
Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com

Nov 16 '05 #3
Where?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #4

"Bo" <bo*****@yahoo.com> wrote in message
news:a7**************************@posting.google.c om...
double v = -0.17665577379401631
double f = 0.016666666666666666
Math.Pow(v, f) returns me NaN.

What should I do now?


Create a Complex type?
Nov 16 '05 #5
Bo Dong <bo*****@yahoo.com> wrote:
Where?


In MSDN, for Math.Pow. In particular, the line which states that if x
(v in your case) is < 0, and y (f in your case) is between 0 and 1
exclusive, the result is NaN.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #6

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

Similar topics

5
by: Clueless Moron | last post by:
Why do they act differently with respect to complex numbers? Python 2.2.2 (#1, Feb 24 2003, 19:13:11) on linux2 Type "help", "copyright", "credits" or "license" for more information. >>>...
1
by: limelight | last post by:
I have discovered a math error in the .NET framework's Log function. It returns incorrect results for varying powers of 2 that depend on whether the program is run from within the IDE or from the...
4
by: Tony | last post by:
Using Math.pow(10000000,10) or Math.pow(10000*1000,10) returns: 9.999999999999999e+69 (Mozilla 0.8) 1e+70 (Opera 8 & Explorer 6) Is this a Mozilla bug? Ten million is a power of ten, isn't...
3
by: David | last post by:
Here is some code. I am trying to figure out how to raise, say, x to the yth power. I know that isn't explicitly what is in the code but that is the idea I am trying to solve. See the 2nd for...
33
by: Darius Fatakia | last post by:
Hi, I seem to be having trouble with some of my math functions (pow, sqrt, acos). They're the only ones I use in my code and they prevent the program from compiling. I get a "undefined reference...
7
by: a.dheeraj.kumar | last post by:
i know that there is a function to find the logarithm of a number, sin, cos, tan etc. but are there which can find sin^-1, cos^-1, tan^-1 and antilog of a given number? PS: sin^-1 means sin...
1
by: Andy | last post by:
Hi, I noticed when migrating a 2002 application to 2003 that the system changed to a different usage for pow(2,-15). In 2002, it used double pow(double,double). In 2003, it is using double...
5
by: Nondisclosure007 | last post by:
Hello. If this is the wrong group for this, please let me know. I'll post it somewhere else. I've been doing data imports into MS Excel (ver 2007) and using the CORREL function. What I was...
5
by: Tzury Bar Yochay | last post by:
What is the reason math.pow yields OverflowError while python itself can calculate these large numbers. e.g: 1e+308 Traceback (most recent call last): File "<stdin>", line 1, in <module>...
17
by: Lenni | last post by:
Hi, I'm currently writing a web application for bicycle wheel builders that calculate the spoke length for all sorts of variations of hubs and rims. I have translated the formula from an...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.