decimal

validating decimal numbers in culture

妖精的绣舞 提交于 2019-12-11 09:37:47
问题 can anyone please explain why, in 'en-GB' culture formatting, the decimal.Parse() function would return 15 for 1,5? I see the same result for 'de' culture when inputting 1.5, the return is 15. I know this is programmatically correct, I'm just trying to understand why this is correct. I've Googled this and come up with nothing :( i'm trying to validate user inputs against culture, and populating the input field with a 0 when the parse fails, but populating the field with 15 when they've

Convert HEX to Decimal value? w/ an example

回眸只為那壹抹淺笑 提交于 2019-12-11 09:22:37
问题 My professor has assured me this example is correct but I can not back into it. I need to convert the mac of my printer to decimal so I can find the decimal value. In the example he gave me, I have tried this on several online converters and I can not replicate it. What am I missing here, I searched stack I see some examples but I can not reproduce this so this is no duplicate. MAC = AA:BB:CC:00:11:22, converted to decimal would be 170.187.204.0.17.34 回答1: A mac address has a size of 6 byte.

[Java]How to correct the overflowing variables generated from the situation we capture the single byte of data from files?

左心房为你撑大大i 提交于 2019-12-11 09:20:03
问题 As tilte, I tried to capture the file size info which is saved in 4 bytes of data from bitmap's file code, but if I use byte[] to save it and any byte of file exceeds 127, it'd be misjudged as negative values, in this case how could we correct these kind of values? My book just simply plus 256 to it, but could it fixedly be -128? if not, then the result still isn't correct. I know we can just use int[] or larger array for it, just wanna know how to deal with these kind of problems! Thanks a

get datediff hours in decimal sql server

让人想犯罪 __ 提交于 2019-12-11 09:12:53
问题 i need query to get total hours in decimal value this is my query so far: declare @start as time; declare @end as time; declare @total as decimal(18, 2); set @start = '17:00:00' set @end = '18:30:00' set @total = datediff(minute, @start, @end)/60 print @total the query give me integer value, although the @total parameter is a decimal. I don't know how to get the decimal value. please help me, and thank you in advance. 回答1: Try divide by 60.0. This will provide the required precision An int

Delphi: Delphi and Microsoft SQL Server 2005 bad calculations from function values

会有一股神秘感。 提交于 2019-12-11 08:58:25
问题 When i send this query on SQL Server 2005 with the Microsoft SQL Server Management Studio SELECT dbo.MOV('Hi',10,2) + dbo.MOV('Hi2',8,2) The query returns 400 The result of anything send to the function will return 200 except if the last two parameter where 0 the value of return will be 100 and the value type of return from the function its Decimal(12,2) the problem, comes when I do the query on Delphi Query.SQL.Add('SELECT dbo.MOV(''Hi'',10,2) + dbo.MOV(''Hi2'',8,2)'); Query.Open; Query.Next

Why can I represent an int larger than MAXINT in hexadecimal, but not decimal?

♀尐吖头ヾ 提交于 2019-12-11 08:50:47
问题 As far as I am aware, decimal and hexadecimal are simply representations of (let's say) an int . This means that if I define an integer, x I should be able to print x as: a decimal: printf("%d", x); a hexadecimal: printf("%x", x); What I don't understand is how this behaves when x exceeds MAXINT. Take the below code for example: #include<stdio.h> int main(int argc, char** argv) { // Define two numbers that are both less than MAXINT int a = 808548400; int b = 2016424312; int theSum = a + b; //

Excel Print number with correct decimal Seperator

喜欢而已 提交于 2019-12-11 07:49:51
问题 I use the print function to export a Cell Value to csv file. I use this macro on several PCs with different Localization Settings. The problem i am experiencing is, that on some PCs the Output is 4,11 and 4.11 on others. Is there any Format Method, that allows me always write a Number with a semicolon as decimal Seperator? 回答1: As far as I'm aware, there is no format method for changing the decimal separator. Instead your options are temporarily telling Excel to use a special character or

Specify default format for Decimal.ToString() method

人盡茶涼 提交于 2019-12-11 07:43:26
问题 I have an application with a lot of calls to Decimal.ToString(void). The default format is not what is needed. I could change these calls to one of the other Decimal.ToString overloads, but it would be nicer if I didn't have to. So, is there a way to specify a different format for the Decimal.ToString(void) method so that I don't have to modify any of the calls to this method? Update As the answer below indicates, it is possible to do what I want, but I should not do so as it is not good

Why does Excel (xlsx) save some values in xml with additional values? [duplicate]

依然范特西╮ 提交于 2019-12-11 07:36:29
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Floating point inaccuracy examples I am working with parsing xlsx files and came across this behaviour. I don't know how to explain it without describing the steps to reproduce the issue. 1. Create new blank Excel file (xlsx) 2. Type '8.8' into cell A1 3. Save file 4. Close Excel, rename file with .zip extension and open 5. Find sheet1.xml and open 6. Value for 8.8 in A1 will be saved as '8.8000000000000007'

Python - Convert negative decimals from string to float

无人久伴 提交于 2019-12-11 07:18:16
问题 I need to read in a large number of .txt files, each of which contains a decimal (some are positive, some are negative), and append these into 2 arrays (genotypes and phenotypes). Subsequently, I wish to perform some mathematical operations on these arrays in scipy, however the negative ('-') symbol is causing problems. Specifically, I cannot convert the arrays to float, because the '-' is being read as a string, causing the following error: ValueError: could not convert string to float: Here