double

Converting 8 bytes to double [duplicate]

大兔子大兔子 提交于 2019-12-20 06:48:26
问题 This question already has answers here : How to convert a byte array into double in C? (3 answers) Closed 5 years ago . I am facing some problem with converting 8 bytes to a double. I have following byte array 0x98 0xf9 0x38 0x4e 0x3a 0x9f 0x1c 0x43 And I am trying to do following for (int i = 1; i < 8; i++) mult[i] = 256 * mult[i - 1]; double out= buf[7] * mult[7] + buf[6] * mult[6] + buf[5] * mult[5] + buf[4] * mult[4] + buf[3] * mult[3] + buf[2] * mult[2] + buf[1] * mult[1] + buf[0] * mult

Can't put Double number in BigDecimal variable

好久不见. 提交于 2019-12-20 06:39:57
问题 I'm using a Double variable which holds the Item price. That variable is stored in postgresql database under a column of money type. I use setBigDecimal(position,value) SQL function.In other part, i'm using a JSpinner as input. Double current = 0.0; Double min = (double) Integer.MIN_VALUE; Double max = (double) Integer.MAX_VALUE; Double step = 0.1; JSpinner priceSpinner = new JSpinner(new SpinnerNumberModel(current, min, max, step)); When the user clicks on a button, I get the value entred by

Take different values from a String and convert them to Double Values

故事扮演 提交于 2019-12-20 06:32:18
问题 In my code, I'm asking the user to input three different values divided by a blank space. Then, those three different values I would like to assign them to three different Double variables. I have tried by assigning the first character of such string to my double variables but I haven't been able to succeed. Any suggestions? Thank you! Here is what I'm trying to do: int decision = message(); String newDimensions; double newHeight, newWidth, newLength; if(decision == 1){ newDimensions =

Java convert double to date format

十年热恋 提交于 2019-12-20 05:38:21
问题 I have made a little app in ios+firebase, now I am trying to connect android. In ios I save date as double (for example: -242528463.775282), but then I trying to retrieve same double in java it giving me another date. in IOS - 01.07.2009 in Java - 29.12.1969 double myDouble = date; long myLong = (long) (myDouble); System.out.println(myLong); Date itemDate = new Date(itemLong); String myDateStr = new SimpleDateFormat("dd-MM-yyyy").format(itemDate); editTextDate.setText(myDateStr); Is it

Excel VBA Double Addition Error

泄露秘密 提交于 2019-12-20 04:37:23
问题 I'm having a hard time explaining this one. The following function is being used as a worksheet formula. A value of "empty" simply means that the cell was empty and, therefore, there is no value. Given the values {empty, empty, 0.8, 0.2}, the following function is sometimes returning off the wall values like 5.55111512312578E-17. In the debugger, it looks like everything is correct until the last value in the ParamArray (in this case 0.2) is processed. Any thoughts? Private Function

sql double count in join statement

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-20 04:33:03
问题 I have these two SQL statements and what I need to do is join them into one statement, but when I do it, result is inappropriate. :/ select nieruchomosci.nieruchomoscnr, count(wynajecia.nieruchomoscNr) as wynajecia from nieruchomosci, wynajecia where nieruchomosci.nieruchomoscnr = wynajecia.nieruchomoscNr GROUP BY nieruchomosci.nieruchomoscnr; select nieruchomosci.nieruchomoscnr, count(wizyty.nieruchomoscnr) as wizyty from nieruchomosci, wizyty where wizyty.nieruchomoscnr = nieruchomosci

Java Math.pow() Rounding Error

早过忘川 提交于 2019-12-20 04:29:10
问题 I'm having trouble with (what I suspect is) a rounding error. I have a string, 0.686357E-01 , which I'm trying to convert to a double. I've been able to split it up using the Pattern.split() function, and I'm capturing the base and the exponent values just fine. However, once I try to multiply them appropriately, I get this as a result: 0.06863570000000001 . Here's my relevant code: pattern = Pattern.compile("E\\+?"); String[] number = pattern.split(string); double base = Double.parseDouble

variant double subtype exceed max value

为君一笑 提交于 2019-12-20 04:25:36
问题 when I'm looking at the "Variant Data Type" documantation, it says that variant with subtype of double can support a positive value of maximum "1.79769313486232E308" (15 digits) and that "An error occurs when Variant variables containing Currency, Decimal, and Double values exceed their respective ranges." However, when I'm running the following code: y = 999999999999999999999999999 y = CStr(CDBL(y)) MsgBox y I do not recive an error, instead I am getting a msgbox with the following output:

Stuck at “Exception in thread ”main" java.util.NoSuchElementException

烈酒焚心 提交于 2019-12-20 04:22:13
问题 I wrote a program with a separate class but I keep getting the same error right after the user inputs the three sides. The main code is: package interactiveTriangleWithAClass; public class InteractiveTriangleProgramClass { public static void main (String [] args) throws Exception { IAclass nums = new IAclass(); double perimeter; double area; explain(); nums.getNumbers(); perimeter = nums.calcPer(); area = nums.calcArea(); outputResults(nums, perimeter, area); } public static void explain() {

64-bit unsigned integers which cannot map onto a double [duplicate]

▼魔方 西西 提交于 2019-12-20 04:19:45
问题 This question already has answers here : Are all integer values perfectly represented as doubles? [duplicate] (5 answers) Closed last year . Are there any 64-bit unsigned integer values which cannot be represented with a double-precision floating-point type? (As a double is also 64-bit wide there must be some.) If so, how can I calculate all of them? (In a not brute force way, maybe?) 回答1: Every integer from 0 to 2^52 inclusive is representable exactly, from 2^52 to 2^53 only every even