double Questions

6

Solved

I'm trying to unit test a getprice method using NUnit. I am stuck with parsing the rawprice into double. My cultureinfo is en-US but I set it to de-DE for this test. Double parsing with numberstyle...
Firefly asked 8/9, 2017 at 5:8

3

Solved

I get an exception when I try to deserialize to an object from a JSON string. Input string '46.605' is not a valid integer. Path 'LatitudeCenter' It's really weird because JsonConvert tries to de...
Caisson asked 29/12, 2015 at 18:15

3

I have a problem with double output! It irritates me. It happens with every output. Please help!
Woodyard asked 15/6, 2018 at 9:24

8

Solved

When I have such piece of code in C#: double a = 0.003; Console.WriteLine(a); It prints "0,003". If I have another piece of code: double a = 0.003; Console.WriteLine(a.ToString(CultureInfo.Inv...
Remit asked 4/10, 2012 at 14:46

3

I want to convert string to double. Here's example of what I do : string line = "4.1;4.0;4.0;3.8;4.0;4.3;4.2;4.0;"; double[] values = line2.Split(';').Select(double.Parse).ToArray(); But an ...
Evince asked 18/5, 2015 at 13:50

5

Solved

In Swift, how can one check if a string is a valid double value? I have been using the following extension from this question (but as a float) but if the value cannot be converted, it simply return...
Landmark asked 19/5, 2015 at 2:23

4

If I try to compile this code... fun main(args: Array<String>) { for (i in 1.0..2.0) { println(i) } } ... I get the error saying For-loop range must have an 'iterator()' method If I add ...
Annabellannabella asked 1/6, 2017 at 19:49

3

Solved

I want to convert a long double to string without scientific notation in Dart, I thought just doing a .toString() would do the trick but it's not the case. Here's my code: void main() { double nu...
Hupp asked 20/7, 2020 at 6:19

8

I tried to convert a double to its binary representation, but using this Long.toBinaryString(Double.doubleToRawLongBits(d)) doesn't help, since I have large numbers, that Long can't store them i.e ...
Celsacelsius asked 15/6, 2011 at 15:1

10

Solved

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 var...
Mulkey asked 12/8, 2009 at 15:53

2

Solved

I have been looking at some code which had a weird optimisation fault and, in the process, stumbled upon a fault condition in strtod(), which has a different behaviour to strtof(), right on the edg...
Blackbird asked 19/1 at 16:28

7

Solved

What is the function that removes trailing zeros from doubles? var double = 3.0 var double2 = 3.10 println(func(double)) // 3 println(func(double2)) // 3.1
Treenatreenail asked 10/4, 2015 at 11:51

2

Solved

I'm wondering if there is an easier way to write these two initializers as a generic Initializer public required init(_ value : Double) { super.init(value: value, unitType: unit) } public requir...
Copeck asked 28/5, 2015 at 13:25

19

Solved

I need to store a double as a string. I know I can use printf if I wanted to display it, but I just want to store it in a string variable so that I can store it in a map later (as the value, not th...
Mottle asked 1/12, 2008 at 20:35

3

Solved

I have written the code: int x = 18; x *= 0.90; System.out.println(x); This code printed 16 However, when I wrote int x = 18; x = x * 0.90; System.out.println(x); it gave me the following...
Paymar asked 8/12, 2023 at 4:15

12

Solved

Comparing those two values shall result in a "true": 53.9173333333333 53.9173
Pralltriller asked 31/5, 2010 at 15:3

10

Solved

I was wondering if there was a way to get the number of results from a MySQL query, and at the same time limit the results. The way pagination works (as I understand it) is to first do something li...
Idyllic asked 4/5, 2009 at 2:5

36

Solved

Can anyone tell me how to round a double value to x number of decimal places in Swift? I have: var totalWorkTimeInHours = (totalWorkTime/60/60) With totalWorkTime being an NSTimeInterval (doub...
Happening asked 7/12, 2014 at 1:27

7

Solved

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 flo...
Kwok asked 26/8, 2009 at 0:55

10

I've been trying to find out the reason, but I couldn't. Can anybody help me? Look at the following example. float f = 125.32f; System.out.println("value of f = " + f); double d = (double) 125.32...
Dhaulagiri asked 6/7, 2013 at 16:29

7

Solved

I need to truncate the amount of decimal places of my double value for display in a textbox. How would one achieve this with vba?
Lanate asked 5/7, 2012 at 15:33

8

Solved

I have to calculate some floating point variables and my colleague suggest me to use BigDecimal instead of double since it will be more precise. But I want to know what it is and how to make most o...
Adjudication asked 5/8, 2010 at 9:39

3

Solved

I know in C and Java, float's underlying representation is IEEE754-32, double is IEEE754-64. In expressions, float will be auto-promoted to double. So how? Take 3.7f for example. Is the process ...
Markowitz asked 25/8, 2012 at 2:47

1

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() { istringstrea...
Calamander asked 19/8, 2023 at 22:14

8

Solved

This program works, except when the number of nJars is a multiple of 7, I will get an answer like $14.999999999999998. For 6, the output is 14.08. How do I fix exceptions for multiples of 7 so it w...
Blouson asked 17/1, 2012 at 13:22

© 2022 - 2024 — McMap. All rights reserved.