Top "Double" questions

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

How can I truncate a double to only two decimal places in Java?

For example I have the variable 3.545555555, which I would want to truncate to just 3.54.

java double truncate decimalformat
Scanf/Printf double variable C

Let's say I have this following bit of code in C: double var; scanf("%lf", &var); printf("%lf", var); …

c double printf stdout stdin
Rounding a double to turn it into an int (java)

Right now I'm trying this: int a = round(n); where n is a double but it's not working. What am …

java double int rounding
Formatting a double to two decimal places

I have been trying to make the answer this prints out to be to two decimal places. All the math …

c# format double
Convert double to float in Java

I am facing an issue related to converting double to float. Actually, I store a float type, 23423424666767, in a database, …

java double floating
How can I divide two integers to get a double?

How do I divide two integers to get a double?

c# math int double
Convert double to BigDecimal and set BigDecimal Precision

In Java, I want to take a double value and convert it to a BigDecimal and print out its String …

java double bigdecimal
How do I round a double to two decimal places in Java?

This is what I did to round a double to 2 decimal places: amount = roundTwoDecimals(amount); public double roundTwoDecimals(double d) { …

java double
Convert float to double without losing precision

I have a primitive float and I need as a primitive double. Simply casting the float to double gives me …

java floating-point double
C++ string to double conversion

Usually when I write anything in C++ and I need to convert a char into an int I simply make …

c++ string file double