?
Solved

silli question about double AND strings

Posted on 2003-03-20
3
Medium Priority
?
220 Views
Last Modified: 2010-04-15
I have a simple function in C# that takes a number and power it by 2 like this
nr=Math.Pow(nr,2);

ok this might seem like a silly question, but what I want to do is return this number but in normal format, what I get now is something like 1,23459E+23
but what i realy want it 123456897,33

How can I do this
0
Comment
Question by:rustebbi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 1

Expert Comment

by:tpatten
ID: 8178401
How is that number declared? Go with decimal and you should get what you are looking for.
0
 
LVL 18

Accepted Solution

by:
testn earned 150 total points
ID: 8178730
It depends on how you print it...

you might use
Console.WriteLine("{0:D}",nr);

or convert nr to string by

string nrvalue = nr.toString("D");
0
 

Expert Comment

by:ChuckP
ID: 8185546
Alternatively you could explicitly convert it:

Convert.ToDouble(Mth.Power(nr,2));
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question