double

Why doesn't this code demonstrate the non-atomicity of reads/writes?

Reading this question, I wanted to test if I could demonstrate the non-atomicity of reads and writes on a type for which the atomicity of such operations is not guaranteed. private static double _d; [STAThread] static void Main() { new Thread(KeepMutating).Start(); KeepReading(); } private static void KeepReading() { whil...

Very hard to capture double tap on UIButton subclass. (time delay to capture double tap)

Im talking about two separate touches on the screen with the same finger I think i have the coding right for this. but it is almost impossible for me to actually generate a double tap on my iPad. Is it possible to increase the time interval between a single and double tap, so it is easier to trigger. I do a double tap very fast and it c...

Underlining Text in an <input> Box

I've gotten a request from a client to underline text in a text field. Both single and double lines. Is this even possible? I assume with some obscure plugin but I haven't found it yet. :P I've thought about there being 2 possibilities, if this is possible. 1) Underlining the text in the actual field. 2) Doing some crazy hack with tex...

What's the least (negative) integer value that can be exactly represented by Double type in all major x86 systems?

What's the least (negative) integer value that can be exactly represented by Double type in all major x86 systems? Especially in (simultaneously) JVM, MySQL, MS SQL Server, .Net, PHP, Python and JavaScript (whatever corresponding type it uses). The reason why I ask about this is because I'd like to choose a value to use to represent an ...

BigDecimal from Double incorrect value?

I am trying to make a BigDecimal from a string. Don't ask me why, I just need it! This is my code: Double theDouble = new Double(".3"); System.out.println("The Double: " + theDouble.toString()); BigDecimal theBigDecimal = new BigDecimal(theDouble); System.out.println("The Big: " + theBigDecimal.toString()); This is the output I get? ...

Int and Double in one array in Java

Is there a way to put an int and a Double in the same array. I want to have an array (p1[]) where the first (p1[0]) is an int and all the rest of the elements are doubles. Is this possible? ...

Why see -0,000000000000001 in access query?

I have an sql: SELECT Sum(Field1), Sum(Field2), Sum(Field1)+Sum(Field2) FROM Table GROUP BY DateField HAVING Sum(Field1)+Sum(Field2)<>0; Problem is sometimes Sum of field1 and field2 is value like: 9.5-10.3 and the result is -0,800000000000001. Could anybody explain why this happens and how to solve it? ...

Arithmetic precision with doubles in Matlab

I am having a bit of trouble understanding how the precision of these doubles affects the outcome of arithmetic operations in Matlab. I thought that since both a & b are doubles they would be able to carry out operations up to that precision. I realize there can be round-off error but since these numbers are well within the 64-bit number...

Double to string -- formatter missed?

Hello all, I have to convert a double to string with the following rules: If decimal point position is -1 (or another non-existing value meaning 'Auto'), fractional part of the number should be output with all significant digits (all zeroes at the end should be trimmed). If the double is integer, its fractional part shouldn't output a...

double problem in xcode or me doing something wrong

Hi I would guess it's the simplest thing but it's really confusing me. I'm sure I've successfully used doubles before but now I'm having trouble. I just made a new 'test' project to see if I can get it working, but all I'm trying to do is set a double value. So in the View Controller's viewDidLoad i've typed: double z = 2938.09; NSL...

Hibernate type used to map java.lang.Double

Hello, I am using "double" in Hibernate .hbm.xml files, and when I generate classes with Hibernate Tool I get class property which has primitive type double. I want this property to be java wrapper type Double. How can I achieve this? If I change this manually in my classes, is it going to give any issues to hibernate? Thanks ...

Issue with NSNumber -initWithDouble and resulting values

Hi all, I'm using NSNumber to store various values, but sometimes run into issues when doing calculations with the values and initializing new NSNumber objects for the results. I've figured out how to overcome it, but I couldn't for the life of me explain why it works and since my grasp on numerical values in computer environments (doub...

Difference among Double.MIN_NORMAL and Double.MIN_VALUE

May I know what is the difference among Double.MIN_NORMAL (introduced in 1.6) and Double.MIN_VALUE? JavaDoc of Double.MIN_NORMAL: A constant holding the smallest positive normal value of type double, 2-1022 JavaDoc of Double.MIN_VALUE: A constant holding the smallest positive nonzero value of type double, 2-1074 ...

How to display NSTimeInterval binding as NSDate in InterfaceBuilder?

I handle a lot of time stamps that I store as NSTimeInterval. NSDateComponents* comps = [[NSDateComponents alloc] init]; [comps setYear: .... NSDate* date = [gregorian dateFromComponents:comps]; NSTimeInterval timeStamp = [date timeIntervalSinceReferenceDate]; Interface Builder has a table view binding to the variable of the time stam...

C++ Bubble sorting a Doubly Linked List

I know bubble sort is probably not the fastest way to do this but its acceptable. i'm just having trouble with adjusting the algorithm to double link lists from arrays. My double linked lists have a type int and a type string to hold a number and a word. My list was sorted with an insertion sort that I wrote to sort alphabetically, now ...

Storing .NET double value in Oracle DB

I'm using ODP.NET to access Oracle DB from C# .NET. Please see following code: OracleConnection con = new OracleConnection(); con.ConnectionString = "User Id=user;Password=pass;Data Source=localhost/orcl"; con.Open(); /* create table */ DbCommand command = con.CreateCommand(); command.CommandType = CommandType.Text; try ...

Receiving HTTP 404 when validating a Double property with min constraint in Grails

Hi, For a simple class like, class Person { String Name Double incomeFromWork = new Double(0.0) static constraints = { incomeFromWork(min:0d) } } However on the GSP page I get an "HTTP ERROR: 404" error when I enter alphabets for incomeFromWork value. What constraints should I use to accept a valid Double v...

Dealing with Doubles imprecision other than using Decimals

I'm having the doubles imprecision problem with the common mathematical operations. It's the one where a simple addition would append a 00000000x to my double. I've read from another question that decimals should be used instead. But the app I'm using this for is statistics related and performance is an issue. I've read somewhere that...

Java: Double % formatting question for printf

%s is a string in printf, and %d is a decimal I thought...yet when putting in writer.printf("%d dollars is the balance of %s\r\n", bal, nm); ..an exception is thrown telling me that %d != lang.double. Ideas? ...

Double my money: my framework uses doubles for monetary amounts

I've inherited a project in which monetary amounts use the double type. Worse, the framework it uses, and the framework's own classes, use double for money. The framework ORM also handles retrieval of values from (and storage to) the database. In the database money values are type number(19, 7), but the framework ORM maps them to dou...