decimal

How do I set the correct decimal separator in IIS 6.0?

Hello everybody, I hope you can help me here... I have a conflict with the decimal separator on my host's dedicated server. The DB (SQL SERVER 2005) uses dot as decimal separator. As a fact, if you query it directly using SQL Server Management you would get dots. However, when the application (.NET C# MVC 2) is running it uses comma inst...

Binary to standard digit?

I'm going to make a computer in Minecraft. I understand how to build a computer where it can make binary operations but I want the outputs to be displayed as standard integer numbers. How you "convert" the binaries into standard digits? Is there any chart for that? And the digits will be shown like in old calculators; with 7 lines. -- ...

OleDB Read Excel decimal value

I am using OleDB Ace 12 to read an Excel (xslx) sheet containing a column with decimal values. When I open the Excel sheet on my PC a decimal value is correctly formatted as 1.850,50 (NLD culture with comma as decimal separator) When I'm reading out the Excel sheet using OleDB (C#4.0), the string value of this field is always 1,850.50 (...

How do I fix this Perl code so that 1.1 + 2.2 == 3.3?

How do I fix this code so that 1.1 + 2.2 == 3.3? What is actually happening here that's causing this behavior? I'm vaguely familiar with rounding problems and floating point math, but I thought that applied to division and multiplication only and would be visible in the output. [me@unixbox1:~/perltests]> cat testmathsimple.pl #!/usr/...

C# How to check is there any value before converting ToString()

Hi, I have some dataset with values and now I need to put that values into textbox but there is some decimal and double type values so I need to cast them toString() and it happens that sometime dataset values are empty so before casting toString() I need to check Is there any value ??? This is sample line: I need something like this...

MySql: convert a float to decimal produce more decimal number then the stored in back.sql file

Hi at all, i want to understand this: i have a dump of a table (a sql script file) from a database that use float 9,2 as default type for numbers. In the backup file i have a value like '4172.08'. I restore this file in a new database and i convert the float to decimal 20,5. Now the value in the field is 4172.08008 ...where come from the...

hexadecimals to integer.

I know how to convert hexadecimals to integers when i only have one hexadecimal character. but im getting a string of two characters. I'm converting both characters to hex with: String.Format("{0:x2}", (uint)System.Convert.ToUInt32(tmp.ToString())) so then lets say i have 01, and 3f as my two length characters. how am i supposed to ...

Conversion from decimal to binary in Ocaml

I am trying to convert a given decimal value its corresponding binary form. I am using Ocaml about which I don't know much and am quite confused. So far I have the following code let dec_to_bin_helper function 1->'T' | 0->'F' let dec_to_bin x = List.fold_left(fun a z -> z mod 2 dec_to_bin_helper a) [] a ;; I must include h...

How do I configure Rails to output decimals to the correct precision in form fields?

I want to store currencies in my (sqlite and mysql) databases. I'm trying to use the decimal column type, with :scale => 2. This isn't behaving as expected. If I save a record with :rate => 10.50, it is stored in my sqlite db as 10.5. In addition, when I output the value in a form field, it is displayed as 10.5. I don't want to do hack...

objective C get Decimal from Json object.

I am trying to parse a json value to a decimal with no success. I am using the following framework http://code.google.com/p/json-framework/ and my code is as follows NSDecimal RRP = [[jProduct objectForKey:@"Price"] decimalValue]; NSLog(@"%@", RRP); I get Program received signal: “EXC_BAD_ACCESS”. Just to test I thought I would t...

PHP: MySql Data Type for monetary values.

What is the best way to store monetary values in MySql. I've seen this: decimal(5,2) but then you can't enter in more than $999.99 for the amount. I mean I know you can change the 5 to something else but this doesn't seem like the most appropriate way to do this.. then again I'm not sure that's why I'm posting. I've also seen storing ...

Float to text behavior of MATLAB's fprintf()

When using fprintf to convert floats to text in a decimal representation, the output is a series of decimal digits (potentially beginning with 0). How does this representation work? >>fprintf('%tu\n',pi) >>1078530011 >>fprintf('%bu\n',pi) >>04614256656552045848 Apologies if this is very trivial; I can't find an answer elsewhere, in ...

sql server remove trailing zeros in decimal

Is there an easy way to strip trailing zeros from decimals so that select amount from table gives you 2.5 instead of 2.50 or 3 instead of 3.00? Thanks, Tom ...

Limit a double to two decimal places without trailing zeros

I read this and that. I want this exactly: 1.4324 => "1.43" 9.4000 => "9.4" 43.000 => "43" 9.4 => "9.40" (wrong) 43.000 => "43.00" (wrong) In both questions the answers points to NSNumberFormatter. So it should be easy to achieve, but not for me. - (void)viewDidLoad { [super viewDidLoad]; UILabel *myLabel = [[UI...

Rounding a number using non standard rules

Hi. Consider the following C# code: Decimal number = new decimal(8.0549); Decimal rounded = Math.Round(number, 2); Console.WriteLine("rounded value: {0}", rounded); will produce the output: 8.05 Math.Round's algoritm only checks the next digit beyond the decimals number taken as parameter. I need a algoritm that checks all the d...