i have a list of double values...
1.23, 1.24, 1.78, 1,74...
so i want to calculate the differences between the successor -> only adding (negative values should be firstly positive)... above 4 values would be 0,01 +0,53 (-)-0,04
(-) -> to make it positive...
with an for-loop, it is easy... any idea how to solve it with linq?
...
A C program spits out consecutive doubles into a binary file. I wish to read them into Python. I tried using struct.unpack('d',f.read(8))
EDIT:
I used the following in C to write a random double number
r = drand48();
fwrite((void*)&r, sizeof(double), 1, data);
The Errors are now fixed but I cannot read the first value. for an all 0.0...
I use an acceleration sensor to calculate the current accelerations and it returns the double value.
However I would like to compare the current acceleration with value 9.8. Before doing that i have to round the value received from the sensor so the question is: How to round a doble value to a selected number of decimals in .NET?
...
I have a function getSlope which takes as parameters 4 doubles and returns another double calculated using this given parameters in the following way:
double QSweep::getSlope(double a, double b, double c, double d){
double slope;
slope=(d-b)/(c-a);
return slope;
}
The problem is that when calling this function with arguments for examp...
An 64-bit double can represent integer +/- 253 exactly
Given this fact I choose to use a double type as a single type for all my types, since my largest integer is unsigned 32-bit.
But now I have to print these pseudo integers, but the problem is they are also mixed in with actual doubles.
So how do I print these doubles nicely in Jav...
I think there's a lot for me to learn about data types.
Why this happens
double result = ((3/8)*100).ToString();
it gives zero .. should be 37,5 ... :(
...
for (iy = 0; iy < h; iy++)
{
double angy = (camera.fov_y / h) * iy;
for (ix = 0; ix < w; ix++)
{
double angx = (camera.fov_x / w) * ix;
//output[ix,iy].r = (int)Math.Round(255 * (angy / camera.fov_y);
//output[ix,iy].b = (int)Math.Round(255 * (angy / camera.fov_y);
...
I'm trying to convert a string to a double value but it's not returning me what I expect...
double dbl;
Double.TryParse("20.0", out dbl);
That piece of code is returning 200.0 (instead of 20.0) as a double value. Any idea why?
...
This is driving me crazy. I have the following string in a ASP.NET 2.0 WebForm Page
string s = "0.009";
Simple enough. Now, if my culture is Spanish - which is "es-ES" - and I try to convert the string to Double, I do the following:
double d = Double.Parse(s, new CultureInfo("es-ES"));
what I'd expect is 0,009. Instead, I get 9. I ...
Hello,
How do I convert a ruby float/double to high endian order hex with high bytes and low bytes.
EXAMPLE:
start with 99.0
end up with
40 58 C0 00 00 00 00 00
high bytes low bytes
...
I want to know the first double from 0d upwards that deviates by the long of the "same value" by some delta, say 1e-8. I'm failing here though. I'm trying to do this in C although I usually use managed languages, just in case. Please help.
#include <stdio.h>
#include <limits.h>
#define DELTA 1e-8
int main() {
double d = 0; // c...
I am very new to C# (just started learning in the past week).
I have a custom DLL written in C with the following function:
DLLIMPORT void test_function (double **test)
What I am looking to do is have a pointer from C# for the array 'test'.
So, if in the DLL function I have test[0] = 450.60, test[1] = 512.99 etc. I want to be able t...
I have this string "1.79769313486232E+308" and am trying to convert it to a .NET numeric value (double?) but am getting the below exception. I am using Convert.ToDouble(). What is the proper way to do this conversion?
OverflowException: Value was either too large or too small for a Double
...
What is the double type(C++) in C#?
double experience;
At first,I thought its UInt32,but its not.
How to declare it in C#?
...
Sorry if this is a noob question :( .
Piece of C code.
int array[5];
int cnt;
for(cnt = 0; cnt <= 10; cnt+=1)
{
array[cnt] = cnt;
}
Should give an error, right? No! Works fine!
But why is that? It seems that -in the first line- an array of more than the double size (11) is defined. You can even access array[5 to 10] later on....
DecimalFormat parses Double.toString() representation (which could be in scientific and financial format).
Why Sun has chosen this approach, instead of direct converting double to String?
PS:
To be more concrete. Why DecimalFormat internally uses Double.toString() in order to format Double, instead of formatting internal representation...
Hi All,
Just wondering what the difference between a signle precision floating point operation and double precision floating operation is.
I'm especially interested in practical terms in relation to video game consoles, for example does the nintendo 64 have a 64 bit processor and if it does then would that mean it was capable of double...
Hi all,
I was wondering if there was a way to get the number of results from a MySQL query, and at the same time limit the results.
The way pagination works (as I understand it), first I do something like
query = SELECT COUNT(*) FROM `table` WHERE `some_condition`
After I get the num_rows(query), I have the number of results. But th...
Hi guys
I am having some issues trying to convert a double to C++ string. Here is my code
std::string doubleToString(double val)
{
std::ostringstream out;
out << val;
return out.str();
}
The problem I have is if a double is being passed in as '10000000'. Then the string value being returned is 1e+007
How can i get th...
Duplicate
http://stackoverflow.com/questions/803225/when-should-i-use-double-instead-of-decimal
.. and many more...
We use the C# and SQL Server decimal datatypes throughout our apps because of their accuracy. Never had any of those irritating problems where the total doesn't add up to the detail, etc.
I was wonderi...