Questions tagged [double]

Double is a primitive data type used to store fractional numbers that holds a double-precision floating-point (often 64 bits).

In C and C++ double must be at least as large as float (another floating-point type), but its actual size can vary from system to system as it is implementation-defined. It is typically twice the size of float. Many systems store doubles in binary64, a format described in the IEEE 754 technical standard.

Java has a very strict definition for double, requiring it to be stored in binary64 (which is also called double-precision).

More information:

7762 questions
2
votes
2 answers

.NET primitive type addition oddities?

I was curious, so I ran a couple of tests to see how .NET handles overflow (I couldn't find it documented anywhere). I'd almost wish they spit out overflow errors instead of the results because honestly these results are just…
michael
  • 13,854
  • 24
  • 84
  • 167
2
votes
1 answer

Ghashtable storing double

Hello I was wondering if it was possible to store a double into a ghashtable considering there is no gdouble_to_pointer methdod. I am following a tutorial I found online by IBM http://www.ibm.com/developerworks/linux/tutorials/l-glib/section5.html …
howard
  • 55
  • 1
  • 6
2
votes
1 answer

Doctrine 2 - MySQL data type Double in YAML

I'm using codeigniter with Doctrine 2 with CodeIgniter2. I used YAML Schema files to define database schema. I want to define two columns in my table with MySQL data-type Double. Below is the YAML Mapping I tried Entities\Location: type: entity …
rineez
  • 710
  • 11
  • 29
2
votes
1 answer

Is there a double floating point data type in Godot shaders?

I'm trying to use shaders in Godot and I need a really precise calculation (more than float). Is it possible to have a double in Godot shaders? I searched the documentation but I found nothing... Edit: I've made a Mandelbrot set explorer and with…
Billy
  • 23
  • 5
2
votes
1 answer

How to unnest a cell array with nested data and text content if the row and column dimensions do not agree with each other in MATLAB Rb2020?

I have a (72x1 cell) which content is defined by the following block/section: COLUMN1 ROW1 Text Nr.1 ROW2 2345x3 double ROW3 Text Nr.2 ....times 24 to get the mentioned 72x1 cell array My goal now is to unnest the 2345x3…
2
votes
1 answer

How to fix a "big calculation error" in android?

I am working on a calculator app which works perfectly but starts giving wrong calculations if the output is bigger than 15 digit number. The following is an example code private double result = 0; edittext1 = (EditText)…
2
votes
1 answer

How do you subtract Double.pi and Float.pi in Swift?

I want to do Double.pi - Float.pi, but I am getting an error: Binary operator '-' cannot be applied to operands of type 'Double' and 'Float. When I typecast Float to Double or Double to Float (for example: Double(Float.pi)), the result is wrong.…
Sani
  • 45
  • 3
2
votes
1 answer

c# Random number between Double.MinValue and Double.MaxValue

I have searched google through and no answer yet. So question is, I need to create random generator API as following: public static Double Range(Double minValue, Double maxValue) { return random.NextDouble() * (maxValue - minValue) + minValue;…
Wrymn
  • 143
  • 1
  • 2
  • 13
2
votes
3 answers

Solve Integer division in floating point context

When doing: double a = 1000000000 / FPS; It gives me the warning: Integer division in floating point context. How can I solve this?
2
votes
2 answers

Prettier floats using yaml

Whenever I use yaml dump to dump floats, they start to look ugly. Input: a.yaml a: 0.000000015 When I read it in and then dump it to file again, it will look like: dumped.yaml a: 1.5e-08 Note that there's no fixed size I can go for, i.e. maybe…
PascalVKooten
  • 18,070
  • 15
  • 82
  • 140
2
votes
1 answer

Double to string conversion different for .NET Framework and .NET Core

Project File: Exe [see below]
mxscho
  • 1,586
  • 1
  • 12
  • 25
2
votes
1 answer

Recognize changes in SwiftUI TextField with double value

I am using a TextField to let the user add a price for something. To prevent the user adding other values as a number, I change the keyboard type to .decimalPad. The stringValue is updated correct with the binding on every character change. My…
m8xp0w3r
  • 39
  • 6
2
votes
2 answers

Is there a way that double d + 1 == d in java

I'm just curious if there's a way that d + 1 == d. If d is a double. Maybe someone can share some knowledge with me.
user11318028
2
votes
4 answers

printing the double number wrongly

I want to write code that, if I input a decimal number like 612.216, I can print it as a 612216 (actually convert it to integer). However, the program changes my number to something like 2162160000000000000000001 and I don't what to do about…
2
votes
1 answer

Java greater common divisor with big double values

I'm trying to implement a gcd with doubles. Here's my code: public static double doubleGcd(double n1, double n2) { if (n2 != 0) return doubleGcd(n2, n1 % n2); else return n1; } It works well, until I test it with some big…
L. Gangemi
  • 1,426
  • 14
  • 37
1 2 3
99
100