This is stupid!!!!
I have looked everywhere (in books, google, online....) to find out how
to raise a number to a power and I can't find it!!!
For example:
given x = 10
y = x ^ 2;
y would then be 100 (10 squared is 100).
Why can't I find such a basic operation!?
Steve 6 9670
Sorry,
I need this in C#
Steve
Steve Kershaw wrote:
This is stupid!!!!
I have looked everywhere (in books, google, online....) to find out how
to raise a number to a power and I can't find it!!!
For example:
given x = 10
y = x ^ 2;
y would then be 100 (10 squared is 100).
Why can't I find such a basic operation!?
Steve
Math.Pow(x, y)
--
Manohar Kamath
Editor, .netBooks www.dotnetbooks.com
"Steve Kershaw" <st***********@yahoo.comwrote in message
news:11**********************@s13g2000cwa.googlegr oups.com...
This is stupid!!!!
I have looked everywhere (in books, google, online....) to find out how
to raise a number to a power and I can't find it!!!
For example:
given x = 10
y = x ^ 2;
y would then be 100 (10 squared is 100).
Why can't I find such a basic operation!?
Steve
It might be useful to point out that the x stands for the number
to be raised and that the y stands for the power to which the x is raised.
i.e., the return value of Math.Pow(x, y) is the number x raised to the power y. http://msdn2.microsoft.com/en-us/lib....math.pow.aspx
Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Manohar Kamath" <mk*****@REMOVETHISkamath.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Math.Pow(x, y)
--
Manohar Kamath
Editor, .netBooks www.dotnetbooks.com
"Steve Kershaw" <st***********@yahoo.comwrote in message
news:11**********************@s13g2000cwa.googlegr oups.com...
>This is stupid!!!!
I have looked everywhere (in books, google, online....) to find out how to raise a number to a power and I can't find it!!!
For example:
given x = 10 y = x ^ 2; y would then be 100 (10 squared is 100).
Why can't I find such a basic operation!?
Steve
Unlike VB, C# has no exponentiation operator built into the language. You
have to use the Math class (Math.Pow).
--
David Anton www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C#/VB to C++ converter
C# Code Metrics: Quick metrics for C#
"Steve Kershaw" wrote:
This is stupid!!!!
I have looked everywhere (in books, google, online....) to find out how
to raise a number to a power and I can't find it!!!
For example:
given x = 10
y = x ^ 2;
y would then be 100 (10 squared is 100).
Why can't I find such a basic operation!?
Steve
Which is where it should be.
<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/
"David Anton" <Da********@discussions.microsoft.comwrote in message
news:F4**********************************@microsof t.com...
Unlike VB, C# has no exponentiation operator built into the language. You
have to use the Math class (Math.Pow).
--
David Anton www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C#/VB to C++ converter
C# Code Metrics: Quick metrics for C#
"Steve Kershaw" wrote:
>This is stupid!!!!
I have looked everywhere (in books, google, online....) to find out how to raise a number to a power and I can't find it!!!
For example:
given x = 10 y = x ^ 2; y would then be 100 (10 squared is 100).
Why can't I find such a basic operation!?
Steve
Using that same argument you could say that we should also have Logical.Or
instead of || and Math.Multiply instead of *. It's debatable what should be
built in operators and what shouldn't.
--
David Anton www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C#/VB to C++ converter
C# Code Metrics: Quick metrics for C#
"clintonG" wrote:
Which is where it should be.
<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/
"David Anton" <Da********@discussions.microsoft.comwrote in message
news:F4**********************************@microsof t.com...
Unlike VB, C# has no exponentiation operator built into the language. You
have to use the Math class (Math.Pow).
--
David Anton www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C#/VB to C++ converter
C# Code Metrics: Quick metrics for C#
"Steve Kershaw" wrote:
This is stupid!!!!
I have looked everywhere (in books, google, online....) to find out how
to raise a number to a power and I can't find it!!!
For example:
given x = 10
y = x ^ 2;
y would then be 100 (10 squared is 100).
Why can't I find such a basic operation!?
Steve
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Helmut Jarausch |
last post by:
Hi,
what does Python do if two objects aren't comparable (to my opinion)
If I've understood "Python in a Nutschell" correctly it should raise an
exception but it doesn't do for me.
Here are...
|
by: Grant Edwards |
last post by:
I've read over and over that Python leaves floating point
issues up to the underlying platform.
This seems to be largely true, but not always. My underlying
platform (IA32 Linux) correctly...
|
by: Thomas LeBlanc |
last post by:
I copied an example from the help:
CREATE FUNCTION somefunc() RETURNS integer AS '
DECLARE
quantity integer := 30;
BEGIN
RAISE NOTICE ''Quantity here is %'', quantity; -- Quantity here is 30...
|
by: Mauricio Rendon |
last post by:
Hi,
If I have a Label in a Form and need to raise the MouseUp
event on the label to the Form ( Parent Control ), What
must I do ?
Thanks !!!
|
by: Robin Tucker |
last post by:
Does anyone have a VB.NET IPersistStream COM interface description I can
cadge please? If I remember rightly, you have to "flatten" inherited COM
interfaces (I think IPersistStream derives from...
|
by: abcd |
last post by:
this is simple VB question but its not clicking me right now...the code is
as below
Private Sub Command1_Click()
On Error Resume Next
MsgBox calculate
|
by: Robbie Hatley |
last post by:
For your enjoyment, a function that expresses any integer with
absolute value less-than-or-equal-to nine quintillion in any
base from 2 to 36. (For larger bases, you could expand the
"digit"...
|
by: David T. Ashley |
last post by:
What is the most economical test in 'C' for "integer is a power of 2"?
For example, something better than:
void is_2_pow(int arg)
{
return((x == 1) || (x == 2) || (x == 4) || (x == 8) || (x...
|
by: ryanwpenfold |
last post by:
Hi,
The variable _intBlogID changes from -1 to 0 when the Mode_Get method
is called. I don't understand why this happens. I included default
property values, and that didn't help. I wrote and...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
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...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |