double

problem with select Double in Hibernate

Hi every one, I have problem when want read object with where (double variable) this is my Code : BranchBuilding Table: @Entity @Table(name = "branchbuilding", uniqueConstraints={@UniqueConstraint(columnNames={"buildingname","branch_fk"})})//uniqueConstraints={@UniqueConstraint(columnNames={"username","buildingname"})} public class Bra...

decimal vs double! - Which one should I use and when?

I keep seeing people using doubles in C#. I know I read somewhere that doubles sometimes lose precision. My question is when should a use a double and when should I use a decimal type? Which type is suitable for money computations? (ie. greater than $100 million) ...

Convert String to Double - VB

Is there an efficient method in VB to check if a string can be converted to a double? I'm currently doing this by trying to convert the string to a double and then seeing if it throws an exception. But this seems to be slowing down my application. Try ' if number then format it. current = CDbl(x) current = Math.Round(curren...

add two double given wrong result

I'm using the following piece of code and under some mysterious circumstances the result of the addition is not as it's supposed to be: double _west = 9.482935905456543; double _off = 0.00000093248155508263153; double _lon = _west + _off; // check for the expected result Debug.Assert(_lon == 9.4829368379380981); // sometimes i get 9.48...

floating point precision

I have a program written in C# and some parts are writing in native C/C++. I use doubles to calculate some values and sometimes the result is wrong because of too small precision. After some investigation i figured out that someone is setting the floating-point precision to 24-bits. My code works fine, when i reset the precision to at le...

VB.NET Double Question

Hello Currently I have a Double which looks like 12.53467345 .. Now I would like to remove the numbers after the dot so i just get "12" , how could i do this? I guess with TryParse, but don't really understand how to do it. Thanks! ...

Problem in double.Parse in Managed C++

I am getting a weird problem while parsing a double value in managed C++. It may be that I am doing something wrong. When I do: double value = 0.006; result = Math::Parse( value) The output of result is 0.006000000000001. Why it is appending a 1? Also when I go an round the value to 5 decimal places, it fails. I am doing: result...

next higher/lower IEEE double precision number

I am doing high precision scientific computations. In looking for the best representation of various effects, I keep coming up with reasons to want to get the next higher (or lower) double precision number available. Essentially, what I want to do is add one to the least significant bit in the internal representation of a double. The ...

[C#] Access member of second parent (inheritance)

Hello :) Here is my current layout: (the question is the comment) class A { int foo; } class B : A {} class C : B { void bar() { //I want to access foo base.foo; // Doesn't work base.base.foo // Doesn't work, of course } } As you can see, I cannot access members of A by using base in C. H...

PHP static variables in double quotes

Hi, How can I get PHP to evaluate a static variable in double quotes? I want to do something like this: log("self::$CLASS $METHOD entering"); I've tried all sorts of {} combos to get the variable value of self::$CLASS, but nothing has worked. I've currently settled with string concatenation but it is a pain to type: log(self::$CLA...

Converting a Double to an Integer for GetHashCode in Delphi

Delphi 2009 added the GetHashCode function to TObject. GetHashCode returns an Integer which is used for hashing in TDictionary. If you want an object to work well in TDictionary, you need to override GetHashCode appropriately such that, in general, different objects return different integer hash codes. But what do you do for objects c...

Creating SelectionBorder: Bit in the face by decimal rounding?

I am currently implementing a class called SelectionBorder in WPF. It's derived from the Shape class. It basically looks like this: public class SelectionBorder : Shape { public Point StartPoint {get; set;} public PointCollection Points {get; set;} public double StrokeLength {get; set;} protected override Geometry Definin...

Back Button of the Firefox Browser working after double click

Hi, My application is in Perl. Here, for some pages the request is getting submitted twice, that is causing browser's back button history. I am able to see two requests for the same page in the back button's history. Hence, not able to go back in a single click. This issue is coming only for FireFox and not consistent. Can you please su...

Marshaling a pointer to an array of types (managed C# -> unmanaged C++)

I am having some trouble settling on a way to represent a structure that contains a pointer to an array of shorts in my managed code. The struct looks like this: typedef struct { short size; unsigned short** shortValues; } UnmanagedStruct; memory for 'shortValues' is allocated inside unmanaged code -- therefore even though th...

c++ rounding of numbers away from zero

Hi i want to round double numbers like this (away from zero) in C++: 4.2 ----> 5 5.7 ----> 6 -7.8 ----> -8 -34.2 ----> -35 What is the efficient way to do this? ...

Fixed-width Floating-Point Numbers in C/C++

int is usually 32 bits, but in the standard, int is not guaranteed to have a constant width. So if we want a 32 bit int we include stdint.h and use int32_t. Is there an equivalent for this for floats? I realize it's a bit more complicated with floats since they aren't stored in a homogeneous fashion, i.e. sign, exponent, significand. ...

Check if input is blank when input is declared as double [C++]

I have three variable declared as doubles: double Delay1 = 0; double Delay2 = 0; double Delay3 = 0; I Then get their values from the user: cout << "Please Enter Propogation Delay for Satellite #1:"; cin >> Delay1; ... But when I check these values to see if they are null (user just hit enter and did not put a number) it doesn't w...

C#: How do I parse a string with a decimal point to a double?

I guess this is a very easy question, but I wasn't able to find a question with Google or the MSDN examples. I want to parse a string like "3.5" to a double. However, double.Parse("3.5") yields 35 and double.Parse("3.5", System.Globalization.NumberStyles.AllowDecimalPoint) (something I tried in my desperation ;) ) which compiles...

Java - int/long, float/double

I understand that "2.5" is automatically a double, and to make it a float, I need to do "2.5F" (or should the F be lowercase?), and that I should use a float, say, if I had a constant that only ever needed 2 decimal spaces (like "0.08F" for Ontario PST tax), but I'm not sure whether "12" is an int or a long, but I know "12L" is a long, b...

C++ difference between 0 and 0.0

Is there a difference between 0 and 0.0 in C++? Which should you use for initializing a double? Thanks ...