Tags
 IOS SQL HTML C RUBY-ON-RAILS MYSQL ASP.NET DEVELOPMENT RUBY .NET LINUX SQL-SERVER REGEX WINDOWS ALGORITHM ECLIPSE VISUAL-STUDIO STRING SVN PERFORMANCE APACHE-FLEX UNIT-TESTING SECURITY LINQ UNIX MATH EMAIL OOP LANGUAGE-AGNOSTIC VB6

# How to convert a double to a string without using the CRT

By : Kjetil Tenold
Date : October 14 2020, 11:12 PM
should help you out Given that you state your question has no practical application, I figure you're trying to learn about floating point number representations.
Thus, if you're looking for a solution without using any library support, start with the format specification. From that you can discern the various "special" values (Infinity, NAN, etc) as well as decoding/calculating the actual numeric value. Once you have the significand and exponent, you know where to put the decimal point. You'll have to write your own itoa type routine. For radices which are a power of two, this can be as simple as a lookup table. For decimal, you'll have to do a little extra math.
code :

Share :

## Convert string/char to double and following calculation with the double

By : Jaquera Johnson
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further First of all, since you are using c_str, your strings cannot be of type char*; most likely they are std::string.
In addition, you don't need to create a copy of your string: std::string str = msg->data is superfluous (even though it doesn't hurt).
code :
``````ROS_INFO("I am making calculation: [%f]", fmsg + 1);
``````

## Convert string to double and then double to string without losing precision

By : Gaurav Singhal
Date : March 29 2020, 07:55 AM
hop of those help? Someone had the same problem as you had. Simply set the precision of the std::ostringstream to your desired size and return it as std::string.
Here is a reference to an older question which shows the implementation:

## convert object that holds a double to a string and then back to double

By : JeanB
Date : March 29 2020, 07:55 AM
To fix this issue I have a two Dimensional Object array (Object[][] data) that holds pairs of products-prices. , Try

## Manually convert string to double java without using parse double

By : lmjnelson
Date : March 29 2020, 07:55 AM
hop of those help? You could split on the '.', then loop through the left side, grab the next char digit, if the existing value > 0, multiply it by 10, then add the read digit (use a switch/case). You would end up growing the number out to the left.
Then process the right side of the '.' by going right-to-left and doing the same thing, except this time divide by 10 and add digit/10. You will grow the decimal to the right.

## In Java, how can I convert a string to a double (not Double)?

By : Nelson Ferreira
Date : March 29 2020, 07:55 AM
I wish did fix the issue. Use Double#parseDouble.
As you can see the static method returns a primitive double and not an object Double: