double

Where does C++ standard define the value range of float types?

As far as I know floating point values are of the form n * 2^e, with float range being n = -(2^23-1) - (2^23-1), and e = -126 - 127, double range being n = -(2^52-1) - (2^52-1), and e = -1022 - 1023 I was looking through the C++ standard, but failed to find the place where the standard specifies this, or mandates the association of t...

About the Double combobox

please visit my link and select the source for my libray page, to bring up the coding, as this post will not allow me to paste the coding. http://ittookamiracle.ca/library.html Sorry for the mess.....my problem is that when you select for instance the pioneer writings, and then click select on a book (ex:3 Angels-Revelation 14 by J. N ...

Reason for peculiar ordering of division and multiplication in C++

I'm in the middle of porting some c++ code to java, and I keep running across instances where whoever wrote it kept doing the following: double c = (1.0/(a+1.0)*pow(b, a+1.0)); double d = (1./(integral(gamma, dmax)-integral(gamma, dmin)))*(integral(gamma+1, dmax)-integral(gamma+1, dmin)); Instead of: double c = pow(b, a+1.0)/(a+1.0);...

Single vs Double datatypes

Are there any situations where it would make more sense to use a single datatype instead of a double? From my searching, the disadvantage to a double is that it requires more space, which isn't a problem for most applications. In that case, should all floating point numbers be doubles? A little background info: I'm working with an app...

Cast as an NSNumber doubleValue adding extra [phantom] precision

iPhone sdk 3.2.1 NSMutableDictionary *myDict = [NSMutableDictionary dictionaryWithCapacity:2]; [myDict setObject:[NSNumber numberWithDouble:0.1f] forKey:@"testDoubleObject"]; [myDict setValue:[NSNumber numberWithDouble:0.1f] forKey:@"testDoubleValue"]; Printing the description of myDict to the console yields this: Printing descrip...

Format double with no decimal point

Hi, I've to convert double to 10 digits + 4 decimal. so let say: I have a double 999,56. I've to get 00000009995600 -> without comma! What I have is: string.format("{0:0000000000.0000}", value) but what I get is: 0000000999,5600 so what I can do now is to search for the comma and delete it, but I would like to know if there is anoth...

show decimal or double with zeros

hi i get price values from DB. now whenever the price is perhaps 5, I want to show 5.00 if its 4.3 it should be 4.30. how to convert that? thanks ...

Regular Expression issue.

I have an issue regarding the use of the following regular expression: private Regex _regexDecimals = new Regex(@"[^.,0-9]"); when I use above the result is dat I can use 1 0,5 ,5 1.0 but when I enter .5 it results in an error trying it to convert it to a double. Now I've made the following regular expression: private Regex _regex...

How to convert string (containing double max) to double

I have no problem converting "normal" double values, but I can't convert numeric_limits<double>::max() or DBL_MAX string representations? std::string max = "1.79769313486232e+308"; std::istringstream stream(max); double value; // enters here, failbit is set if (!(stream >> value)) ...

mysql query adding to a decimal doubles value of the addend for some reason

I am trying to add a value ($credit) to the value of a decimal (9,2 max length) field in a mysql database. The problem is that when I do this, it doubles the $credit and then adds it for some reason. I just want it to add it. The code I am using is: mysql_query("update $table set earnings = earnings +$credit where username = ('$member')...

Double variable keeping wrong value.

Simimilar problem to http://stackoverflow.com/questions/1957801/math-atan2-or-class-instance-problem-in-c and http://stackoverflow.com/questions/1193630/add-two-double-given-wrong-result It is something that simple lines: public static String DegreeToRadianStr(Double degree) { Double piBy180 = (Math.PI / 180); Dou...

javascript single double quote problem

Hello guys, I have this rather classic problem when interacting with databases of handling single quotes and special characters. In PHP I am escaping the single quote with another single quote and regex syntax characters with preg_quote and they are working as a pro. The problem is with javascript, there are some points in my s...

jQuery + parseDouble problem

I have an AJAX-request that returns a json object containing a few values with two decimals each, but since it's json these values are strings when returned. What I need to do is to perform addition on these values. Just a simple a+b = c, but they concatenate instead becoming ab. I was hoping I could use parseDouble in jQuery just like...

Why is my return value wrong?

Hi all, I have a vector class in C# (a fragment below). My issue is that when I call GetMagnitude(), it always returns 0.0f - even with the debugger running and I check that Sq has a valid value, as soon as it gets passed back into other function (eg: Normalize() ), it has return 0.0f. Can someone explain this and help me fix it? My gue...

ASP.NET Page Double Event Firing

Details: Page has asynch true Double event does not fire every time. Page has a long running process. The double event can be simulated with a thread.sleep() Steps have been taken to prevent double post back. The second event often will fire 10 or 20 minutes after the first event. May not happen on development server Site is running ...

float vs double on graphics hardware

I've been trying to find info on performance of using float vs double on graphics hardware. I've found plenty of info on float vs double on CPUs, but such info is more scarce for GPUs. I code with OpenGL, so if there's any info specific to that API that you feel should be known, let's have at it. I understand that if the program is mov...

Is there a method to find out if a double is a real number in c#?

So there is a method for NaN, but divide by zero creates infinity or negative infinity. There is a method for Infinity (also positive infinite and negative infinity). What I want is IsARealNumber function that returns true when the value is an expressible number. Obviously I can write my own... public bool IsARealNumber(double test) ...

convert very small double to a String

hi, I have a very small number and I want to convert it to a String with the full number, not abbreviated in any way. I don't know how small this number can be. for example, when I run: double d = 1E-10; System.out.println(d); it shows 1.0E-10 instead of 0.000000001. I've already tried NumberFormat.getNumberInstance() but it format...

JSON to C# : convert an arraylist of doubles to an array of ints ?

I have an arraylist of doubles returned by a JSON library. After the JSON parser's decode method is run, we have this in the C# locals window: Name Value Type myObj Count=4 object {System.Collections.ArrayList} [0] 100.0 object {double} [1] 244.0 object {double} [2] 123.0 ...

Can I return double * in function?

Can I do something like this? Will this work? double *vec_subtraction (char *a, char *b, int n) { double *result; int i; for(i=0; i<n; i++) result[i] = a[i]-b[i]; return result; } and then in main: double *vec=vec_substraction(a, b, n); for(i=1; i<n; i++) printf("%d", vec[i]); a and b are v...