decimal

Is there a way to change SQL 2005 server's maximum decimal precision?

Help says: By default, the maximum precision returns 38. Examples: SELECT @@MAX_PRECISION Of course it is. That should mean, you can somehow change it, right? But I can't find an option for it. Is there some hidden crypted registry key or something? The problem is that not all applications support precision > 24 and treat...

Determine which function to call based on length of decimal

In C#, I have a situation where I have two possible numbers in a textbox control. The numbers can be either: a) .xxxx or b) .xx How do I write a condition that says, "If the textbox has 4 decimal places, then call this function, otherwise, if the textbox has 2 decimal places, then call this function." Seems easy, but I don't know h...

How to best aproach rounding up decimals in c#

Hello, I've decimal value 18.8. Values that are stored in this variable can be of any kind. For example it can be 1.0000000 or 1.00004000 or 5.00000008. I would like to write a method so that i can pass decimal to it and get rounded up string. This wouldn't be a problem if i would know decimal places i would like to get. But what i wou...

How to can I strip zeros and decimal points off of decimal strings?

The following code currently outputs: 12.1 12.100 12.1000 12.00 12 12.0000 How can I change it so it outputs: 12.1 12.1 12.1 12 12 12 Math.Round seems to be the thing, but it makes me define how many decimal places I want, but I want them to be variable as above. If there is no mathematical way to do it, I'll just strip the zeros ...

Display feet decimals in feet and inches (javascript)

Original question: this bit of javascript code will convert centimeters to feet. But the feet are displayed as decimals, I would like it to display as 5'10 instead of 5.83. SOLUTION: <script type="text/javascript"> function start(){ document.getElementById('hauteur_cm').onmouseup=function() { if(isNaN(this.value)) { alert('numbers o...

Ruby on Rails - Currency : commas causing an issue.

Looking on SO, I see that the preferred way to currency using RoR is using decimal(8,2) and to output them using number_to_currency(); I can get my numbers out of the DB, but I'm having issues on getting them in. Inside my update action I have the following line: if @non_labor_expense.update_attributes(params[:non_labor_expense]) pu...

Convert decimal feet to feet and inches?

How would I go about converting a measurement from, for example, 12.5 feet to 12ft 6in? How would I created that second number which reads only the decimal place when multiplying by 12? right now I have double Measurement01 using other variables and some math to get me the feet in decimals. I send that to a textview with farf.setText(Me...

How to determine whether a variable is a decimal and it is less than 0.01 in PHP?

How to determine whether a variable is a decimal and it is less than 0.01 in PHP? If I write if($balance<0.01) Will a true value be returned if $balance is not a decimal at all? ...

Change SQL decimal delimiter

Hello! I am trying to import data into my table using INPUT INTO The problem is my decimals is using , as a delimiter, and it expects .. So it won't work! How can i change this? Search and replace in the input file is not an option! I am using SQL Anywhere 10 ...

How to import latitude/longitude data correctly into MySQL?

Hi, I've got a dataset of city names with their corresponding latitudes/longitudes that I've loaded into a MySQL table, like so: city_id | city_name | latitude DECIMAL(9,6) | longitude DECIMAL(9,6) Typical latitude/longitude coordinates might look like this: 54.284758 / 32.484736. However, I'm only getting values with a scale of 2 to...

Will Decimal or Double work better for translations that need to be accurate up to .00001?

I'm an inspector at a machine shop. I have an html report generated by another inspector that has some problems I need to fix. This isn't the first time: I need something better than PowerShell and RegEx. (Fear not internet warriors, I know I shouldn't use RegEx for html. I'm using HtmlAgilityPack now.) I'm aware there are a lot of simi...

How can I convert a decimal code of a character into a Unicode string in C++?

How can I convert a decimal code of a character into a Unicode string in C++? For example, I give it the integer 241, that is the '' spanish letter, and I want to convert it to a Unicode string. ...

Parse a decimal value from a String in Ruby

I have a Ruby String that contains decimal-containing numbers. What's the best way to convert this into a decimal (fixed-point)? "Best" means: Reliable given a wide range of input options Simple to write Easy to read DRY ...in roughly that order. ...

hexadecimal to decimal using NASM

I am trying to write a function to convert hexadecimal values to decimal values using Nasm. The basic method would be to take the hex number and multiply by 16 to the power of the place you are in (tens {0}, hundreds {1}, etc). I cannot think of how to write this in the assembler. ...

asp.net compare validators to allow comma and dot (both!) as decimal separator

I am using a compare validator, which validates that the entered number is a valid double and also validates it against a given value (greater than zero). I am validating money amounts. Because of the location where the app is used, the locale sets the comma as the decimal separator. The problem is that when a user enters the value using...

Using Decimal parameters in Firebird stored procedures

I have a Firebird stored procedure that accepts Decimal(9,6) values for Latitude and Longitude parameters. It's used to create a contact profile for a user. When I try to create and use these decimal parameters, I get a conversion error: Value was too large or too small for an Int32. Here's how I create the ADO.Net connection: Fb...

Decimal validation + PHP ?

How to do decimal number validation in PHP? :) (The decimal point is optional) it should accept ... 0 , 1 , 2 , 0.123 , 0.2 , 12.34 etc. ...

How to increase a decimal's smallest fractional part by one?

Hi I want to increase a decimal's smallest fractional part with one so that for example decimal d = 0.01 d++ d == 0.02 or decimal d = 0.000012349 d++ d == 0.000012350 How do i do this? ...

Actionscript Build Hex String

Hi all, basically i want to build a colour hex value using 3 decimal values. for clarities sake, the 3 decimals i have are 255 254 253 and i want to generate the hex string: 0xFFFEFD how would i do that? ...

Why does .NET decimal.ToString(string) round away from zero, apparently inconsistent with the language spec?

I see that, in C#, rounding a decimal, by default, uses MidpointRounding.ToEven. This is expected, and is what the C# spec dictates. However, given the following: A decimal dVal A format string sFmt that, when passed in to dVal.ToString(sFmt), will result in a string containing a rounded version of dVal ...it is apparent that decim...