473,378 Members | 1,688 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,378 software developers and data experts.

Converting text in exponential form to double

Hi,

I have the text "5.21e-09" and I want to convert it to a double. atof()
does not seem to work, does anyone know how to convert it?

Michael

Oct 23 '05 #1
4 3132
I figured this out myself. Strangely enough when I included stdlib.h
the problem was fixed.

I wonder what atof() function it was using without including this file?

Michael

Oct 23 '05 #2
Michael McGarry wrote:
I figured this out myself. Strangely enough when I included stdlib.h
the problem was fixed.

I wonder what atof() function it was using without including this file?

Michael


Sounds like you're using C rather than C++. In that case, atof() would
be an implicit int function.
Oct 23 '05 #3
On 22 Oct 2005 18:05:02 -0700, "Michael McGarry"
<mi*************@gmail.com> wrote in comp.lang.c++:
I figured this out myself. Strangely enough when I included stdlib.h
the problem was fixed.

I wonder what atof() function it was using without including this file?

Michael


DON'T use atof(), or other ato... functions. They are dangerous. They
produce undefined behavior if the converted value is outside the range
of the destination type. Also you can never tell if a value of 0 is
the result of an actual representation of 0 in the character string,
or because the string was not convertible.

If you are using stdlib.h functions, use the strto... series. They
have defined behavior for all inputs other than a null pointer, and
offer facilities for error checking.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Oct 23 '05 #4
Thanks for the tip.

Nov 2 '05 #5

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

Similar topics

1
by: Ryoga | last post by:
How can I print out the value of a large double in plain decimal form without the exponential notation? For example (quick code): PlainPrint.java: --------------- public class PlainPrint {...
2
by: Rod Brick | last post by:
I'm trying to print a Double in straight decimal form, not exponential. I can't seem to accomplish this. This seems like it should be simple enough. The output I'm looking for is "0.00001", not...
8
by: Scott | last post by:
How do I convert the contents of a textbox to a double for mathmateical operations? I'm using a form to collect values and when the user clicks OK, the vlaues are used for calcualtions... but they...
1
by: Tomá¹ Machala | last post by:
Hi, If i use method Convert.ToString(anyDouble) to convert double to string, it sometimes return something like "2.45e6". Is there any other method that always return string in natural format? Eg....
12
by: Frederik Vanderhaeghe | last post by:
Hi, I have a problem converting text to a double. Why doesn't the code work: If Not (txtdocbedrag.Text = "") Then Select Case ddlBedrag.SelectedIndex Case 0 Case 1
10
by: Ron | last post by:
I want to calculate the surface area of a sphere from an inputed radius with option strict on. I guess I am not converting something correctly. Here is what I am doing: I have a textbox...
25
by: Blasting Cap | last post by:
I keep getting errors that pop up when I am trying to convert an application from dotnet framework 1.1 to framework 2.0. The old project was saved in sourcesafe from Visual Studio 2003, and I have...
3
by: ananth | last post by:
Hi All, I need to convert a Double value to String.The requirement is as follows Double do=1234567890123456.12; String str=Double.toString(do); when i execute it i am getting the...
4
by: b4ukiran | last post by:
Hi all, I have a requirement to print large double values without the exponential notaion. The double value can be a declared variable or any calculated value within the code. In any case, I...
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
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$) { } ...
0
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...
0
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
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.