Questions tagged [double]

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

Filter by
Sorted by
Tagged with
-1 votes
0 answers
50 views

Trouble converting SQLite TEXT to double in ASP.NET Core

When I try to retrieve decimal values from my database I get back and Int. Ex: '2,0' stored in DB as TEXT returns 2 in ASP.NET. The property that set the value to in my class is set to a double. Why ...
ollkar's user avatar
  • 1
0 votes
0 answers
36 views

How to parse a binary 64-bit double timestamp in node.js

I am working with binary data that is passed btween two diffrent envrionments (Node and Python) On the first end a stimestamp is packed using python strcut library as a 8-byte double as shown bellow: ...
zedsa's user avatar
  • 1
0 votes
1 answer
117 views

Why explicit Integer conversion doesn't apply as expected

Please be aware that my question is not "Why do floating numbers lose precision" I am aware that not all fractional parts of a number can sit in binary form. What's really stored is actually ...
MarlonB's user avatar
  • 23
-1 votes
0 answers
61 views

Unit test fails even though values are equal [duplicate]

How can I resolve the following issue? #include "pch.h" LennardJones lj(Constants::EPSILON, Constants::SIGMA, Constants::KB); TEST(TestCaseName, TestName) { Vec3 diatance(4.0, 4.0, 4....
user366312's user avatar
1 vote
0 answers
11 views

What's special about the double precision floating point value 1.4210854715202004e-14?

In a library of mine, I recently saw an assertion error where the expected (double precision floating point) value is zero but the actual value is 1.4210854715202004e-14. Googling this value I get ...
runeks's user avatar
  • 1,755
0 votes
0 answers
21 views

The letter d at the end of min and max value of double in java [duplicate]

While I am doing some exercise with double variable in java. I saw that 4.94065645841246544e-324d has the letter d at the end. Can someone explain it for me please ? I was trying to look up on google ...
Nguyen Truong Giang K18 HCM's user avatar
-1 votes
0 answers
19 views

Comparing Double value and got unexpected result [duplicate]

Recently, I have encountered a problem when comparing the value of 2 String. At the first glance, I use Double class for parsing the string to double and do comparison. However, it got unexpected ...
jkwli's user avatar
  • 49
-1 votes
1 answer
75 views

Turn 0.5 to 1 instead of 0

My cyclomatic complexity in this C program is supposed to be 1, so I can't write if else statements. #include <stdio.h> int main() { int U,V; scanf("%d %d",&U,&V); ...
Atomhype's user avatar
-2 votes
0 answers
22 views

How Can I add a squaring a value, obtaining the cube of a value, and obtaining the percentage of a value in my Calculator GUI using Java

package medinacalc; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor....
Sean060778's user avatar
9 votes
1 answer
233 views

Weird behavior in Visual C++ in reading stream to a double

I am encountering a weird issue in visual studio 2022 (version 17.7.1). In the following program: #include <iostream> #include <sstream> using namespace std; int main() { ...
user1998863's user avatar
2 votes
3 answers
102 views

Calculating decimal exponent of double quickly and accurately

edit: To clarify, by "decimal exponent of a double" I mean the magnitude of the value or the base 10 exponent of the value. For instance 3456.7 -> 3.4567E3 -> Scientific Exponent = 3 I ...
Adam Bujak's user avatar
0 votes
0 answers
34 views

Double to string with arduino::String prints format instead of value?

I've been experiencing this in a project where I'm doing a large volume of double and float to string conversions, but I've whittled it down to something very small that showcases the problem. void ...
Twagnah's user avatar
0 votes
3 answers
110 views

How can a double be converted to bytes to be stored in c++?

I am trying to write a program that can take a list of a specific type for example a double or float and convert it into bytes and write it to a file that can be converted back into that original list....
Sam Moldenha's user avatar
0 votes
1 answer
31 views

_TypeError (type 'int' is not a subtype of type 'double' in type cast)

Future<void> _fetchChartData() async { final response = await http.get(Uri.parse( 'https://finnhub.io/api/v1/stock/candle?symbol=${widget.symbol}&resolution=${widget.resolution}&...
Not.Existt's user avatar
0 votes
0 answers
51 views

Confusion around using double to represent very big numbers [duplicate]

I have a requirement to represent 256 bit whole numbers. Right now i'm using __uint128_t[2]. Check out the below code. #include <stdio.h> int main() { __uint128_t a = 0xffffffffffffffff; a&...
Knm's user avatar
  • 59
-1 votes
3 answers
74 views

Double to Int with removing precision point dynamically [closed]

Is there a way in Kotlin, or Java to parse Double to Int knowing that all the doubles will not exceed the Int memory limit? examples: Double Int 1,123 1123 1,1 11 1,12345 11234 0,12345 1234 I ...
ibrahiem Mohamed's user avatar
0 votes
0 answers
28 views

How can I export Stata files into CSV while keeping double format?

I am exporting variables from Stata into csv file, but the variables using "double" format/storage only shows 0's while in fact they should be decimal numbers. Is there a way to save these &...
nbotor's user avatar
  • 1
-3 votes
1 answer
42 views

For loop double the result just for a certain item in an array

So I use a for loop but somehow it loops 2 times for the first and the last item in the array. I tried and it apparently just happens when the len_a bigger than the rest (len_b and len_c) So here's my ...
user22311919's user avatar
0 votes
0 answers
18 views

Cygwin printf double variable seems to waste memory

I try to run a simple program that print a double value in infinite loop. When monitoring I see that memory increase from few Mb to 1 Gb!? I run it under CYGWIN_NT-10.0-19045 DESKTOP-U1587BG 3.4.7-1....
natan's user avatar
  • 11
-2 votes
1 answer
27 views

f=sym('f',[1 4]) q=zeros(1,4) for i=0:3 f(1,i+1) = (@(x)(exp(-x).*(x.^0.5).*x.*laguerreL(i,0.5,x))) %g(1,i+1)=quadgk(f(1,i+1),0,1) end

what is the problem of this code? please discribe the problem for me f=sym('f',[1 4]) q=zeros(1,4) for i=0:3 f(1,i+1) = (@(x)(exp(-x).*(x.^0.5).*x.*laguerreL(i,0.5,x))) %g(1,i+1)=quadgk(f(1,i+1),0,1) ...
shiva's user avatar
  • 1
0 votes
2 answers
156 views

Why can't C# cast an object containing a boxed int to a double?

In C#, why does Example 1 work: int myValue1 = 11; double resultDirectlyFromInt = myValue1; But Example 2 does not: int myValue2 = 22; object myObject2 = myValue2; double resultFromBoxedInt = (double)...
Gilles jr Bisson's user avatar
1 vote
1 answer
44 views

Zingchart single curve, double y-axis on left and right

I'm using zingchart do draw a line. I would like to have a line chart with two y-axix with same values (like duplicated axis) one on left side and one on right side, to make a easy graph read. I'm ...
makksi's user avatar
  • 11
0 votes
1 answer
94 views

How do you scale floating point numbers accurately in Haskell?

I want to scale some numbers with four decimal places to integers. Will using round (or ceiling) while scaling these numbers cause inaccuracies for some numbers? In ghci: Expecting 1009 ghci> let x ...
pseuyi's user avatar
  • 11
0 votes
1 answer
51 views

Add float/double days to Date?

There are similar questions but all of them about adding integer number of days to date. But what if I need to add 0.5 day for example? In other words the following code won't work let days: Double = ...
Gargo's user avatar
  • 1,134
0 votes
0 answers
30 views

Which is the right version when comparing between two doubles? [duplicate]

double d = 0.0; if (d == 0.0) { cout << "yes" << endl; } else { cout << "nope" << endl; } If I have a double of d, and when I ...
f1msch's user avatar
  • 527
1 vote
3 answers
47 views

Rounding off double to closest (minimum) value

I have a method which sometimes returns 0.28 / 0.23 . I am using the below class DecimalFormat df2 = new DecimalFormat("#.#"); but here I need this code to return me 0.2 every-time , but ...
Zoso619's user avatar
  • 167
0 votes
0 answers
45 views

Kotlin Convert Double to Long using A Swift TimeStamp

When sending a Swift timeStamp to FirebaseRTDB I use a Double (seconds): let timeStamp = Date().timeIntevalSince1970 // eg 1633598017.489507 When reading the value on an iOS device I use let ...
Lance Samaria's user avatar
1 vote
1 answer
35 views

Division of Integers as Double in Scala

I have a file with information about the age of people and the number of friends they have. I'm using Spark RDD's and Scala to calculate the average number of friends by age like this: val ...
jakeis's user avatar
  • 29
0 votes
1 answer
51 views

Excel VBA using Double to do math on numbers with 3 decimal places

I am using Excel 2010 I am having trouble with math in some VBA code. I am adding and subtracting some figures in a column according to some criteria and when I do this with figures entered containing ...
Ramses505's user avatar
1 vote
0 answers
46 views

Why is there no loss of precision in direct assignment of floating point numbers? [duplicate]

We know that floating-point numbers have precision loss problems due to memory layout. In mathematics, binary cannot be 100% mapped to decimal decimals. Scientific notation may ignore some small ...
feilong gao's user avatar
0 votes
2 answers
47 views

[Spring Data JPA]: @Column(scale) parameter has no effect

I have the following DAO that is supposed to model bank accounts. @Entity @Getter @Setter @ToString @NoArgsConstructor @AllArgsConstructor @Table(name = "ACCOUNT") public class AccountDao { ...
Jason's user avatar
  • 2,515
1 vote
2 answers
64 views

Formatting doubles with highest possible precision

A number such as 0.1 cannot be precisely represented using binary floating point, so I want to print it out with the highest possible precision. I know that the 64-bit double type only gives ...
k314159's user avatar
  • 5,141
0 votes
1 answer
49 views

Ensure there are at least N distinct even steps between IEEE 754 double precision floating point numbers

If I have two arbitrary double precision floating point numbers A and B, where A is <= B, is there a way to determine whether the range A to B can be divided into N evenly spread (ignoring rounding ...
Daniel Resnick's user avatar
0 votes
0 answers
20 views

Is there an in-built support to add epsilon as an input parameter for double comparsions with mvel dialect?

I am using mvel dialect for defining rules for drools rule engine. It may comprise of arithmetic expressions like in the when part as shown below rule "Test rule" dialect "mvel"...
Ramya Loganathan's user avatar
1 vote
1 answer
65 views

Kotlin. How to use Double.fromBits?

I have an exponent and a fraction and I want to convert them into Double. Here is how I am trying to do that private const val FRACTION_BITS_COUNT = 52 private const val EXPONENT_BITS_COUNT = 11 ...
Semyon Tikhonenko's user avatar
0 votes
1 answer
43 views

Why BigDecimal.Zero exist in Java where as Double.zero doesn't

I am curious to understand why do we see BigDecimal.Zero but not Double.Zero, so if we need to assign a double variable as Zero then we need to cast it to (double) 0. Any specific reasons creators ...
Raj Saraogi's user avatar
  • 1,800
0 votes
2 answers
42 views

Adding a second time frame selection

I am trying to create an indicator where time frames are selectable. Everything is working except I cannot pick a second time frame on inputs. this is the code: The base of this code was created by ...
Ricardo Rodrigues's user avatar
3 votes
2 answers
121 views

Are %f and %lf interchangeable when using printf? [duplicate]

In an article on the w3resource.com, I've seen the following code: double x, y; pr1 = sqrt(pr1); x = (-b + pr1)/(2*a); y = (-b - pr1)/(2*a); printf("Root1 = %.5lf\n", x); printf("Root1 =...
Anik Sen's user avatar
0 votes
0 answers
7 views

I don't want to show saved data in my dropdown because user select this as twice which is not right

i have multi select dropdown, it shows saved data in input filed which is good but when i go for dropdown then allow the user to select the same option which is already saved in the database or ...
Avinash kumar's user avatar
0 votes
0 answers
26 views

Can't save R notebook because error: "Error creating notebook: 'list' object cannot be coerced to type 'double'. See line 417"

I cannot figure out why I'm getting this error. It is preventing me from saving and rendering my notebook. Line 417 looks blank. Copy of code (lines 411-415): CF_full %>% filter(CF_elig == 1) %&...
Caroline's user avatar
0 votes
3 answers
52 views

regEx to match all double quotes wrapped in brackets

Looking for some help on this one. I need to match all double quotes between {} brackets. Then I will escape these double quotes. (37, "2012 Fall", null, null, 0, 1, "1420", {"...
Terry Owen's user avatar
0 votes
1 answer
112 views

The argument type 'double' can't be assigned to the parameter type 'double'

I have a function that takes double as input and I'm passing a double value. I then get the error message: The argument type 'double' can't be assigned to the parameter type 'double' for (var i = 0; i ...
maerlyn's user avatar
  • 83
0 votes
1 answer
85 views

Wrong product multiplying a double and an int. What am i doing wrong?

This code should divide a screen in a certain number of parts, and then compute the size of various drawings knowing how much "parts" each drawing needs. #include <iostream> using ...
Parduz's user avatar
  • 642
0 votes
3 answers
81 views

How to understand this strange behavior of double in Java? [duplicate]

I am trying to understand floating-point numbers more deeply. I know that binary (base 2) floating-point numbers cannot represent some decimal numbers exactly. But I am confused in this strange ...
zhoudu's user avatar
  • 623
0 votes
2 answers
71 views

Swift Converting Data to double give me wrong value

I have a Data with a list of bytes : [64, 69, 207, 65, 61, 225, 199, 151] hex string is equals : 4045cf413de1c797 I'm getting bytes with this function : var bytes: [UInt64] = data.map { UInt64(...
tamtoum1987's user avatar
  • 1,957
0 votes
0 answers
11 views

.pcap file cannot be read using vlpgrabber

I am having another (below) issue while reading .pcap file using vlpgrabber: double free or corruption (out) Aborted (core dumped) void VLP16::Start(std::string pcapName) { mVlpGrabber = boost::...
Zaki's user avatar
  • 1
0 votes
0 answers
22 views

How to change IEnumerable Visualizer culture info?

I have a array of numbers, which some of them are double. when I debug the program, the decimal seperator is dot(.) but in visual studion IEnumerable Visualizer the seperator is comma(,) How to change ...
Parsa's user avatar
  • 8,155
-2 votes
2 answers
67 views

IF Statement is not returning a result. Android Studio in Java

to summarise this function pulls data from TextView value. It then converts it into a double then is supposed to perform an if statement which identifies which value is higher than the other. Updated ...
HSN I's user avatar
  • 1
0 votes
0 answers
43 views

NestJS @mongoosejs/double Property Declaration

I am currently working on a code first NestJS/Graphql API. I am running into a common issue where the API will save a number as an Int32 if the number contains no decimals. This is not an acceptable ...
c.walker.79's user avatar
0 votes
0 answers
23 views

ag-grid grouping group row display 0.0 for double type columns

I use AgGridReact's group feature. In the grid, I have double and bool type columns. After using group by, I noticed that there is "0.0" displayed at group row for double column, same for ...
Hong Yu's user avatar

1
2 3 4 5
167