decimal

SQL Server 2000 distinguishes between decimal zero 0.00 and -.00 while ADO.NET does not

We're using SQL Server Standard Edition 8.00.760 (SP3) on a Small Business Server 2003 platform. While tracking down an inexplainable System.Data.DBConcurrencyException for a Strongly Typed DataSet, I discovered the following problem: Given is this table: CREATE TABLE [dbo].[Auszahlung]( [auszahlungid] [int] IDENTITY(1,1) NOT NULL,...

xsl truncate a decimal

Hi I have an xml file with an xsl that I am trying to change the way the numbers are displayed. In the xml all the numbers are in the format 00:12:34 I need to remove the first 2 zeros and the colon and just display 12:34 I am not sure if I use a substring or a decimal format. I am pretty new to this so any help would be marvellous....

How can I accept strings like "$1,250.00" and convert it to a decimal in C#?

How can I accept strings like "$1,250.00" and convert it to a decimal in C#? Do I just do a replace("$", "") and (",", "") or is there a different way I should handle this kind of input? ...

Java DecimalFormat Scientific Notation Question

Hello. I'm using Java's DecimalFormat class to print out numbers in Scientific Notation. However, there is one problem that I have. I need the strings to be of fixed length regardless of the value, and the sign on the power of ten is throwing it off. Currently, this is what my format looks like: DecimalFormat format = new DecimalFor...

C# Decimal to Numeric(?,?)

Hello! I have a problem, i didn't found yet the solution so i am asking your help. In my database I have some int, decimal and string that needs to be convert in numeric with specific length and precision to include in a flat file. ex: integer 123 to numeric(8,0) ==> 00000123 decimal 123,123 to numeric(8,8) ==> 0000012312300000 String...

How to set a constant decimal value

Hi guys I'm using C# to set a default value for a decimal value in my config class public class ConfigSection : ConfigurationSection { [ConfigurationProperty("paymentInAdvanceAmount", **DefaultValue = 440m**)] public decimal PaymentInAdvanceAmount { get { return (decimal)base["paymentInAdvanceAmount"...

Java BigDecimal remove decimal and trailing numbers

Hello all, I'm new to Java and trying to take a BigDecimal (for example 99999999.99) and convert it to a string but without the decimal place and trailing numbers. Also, I don't want commas in the number and rounding is not needed. I've tried: Math.Truncate(number) but BigDecimal is not supported. Any ideas? Thanks very much. ...

Lua decimal sign?

I've used this in other languages, but lua seems to be lacking this rather useful function. Could one of you nice chappies provide me a lua function to get the sign of the number passed to it? ...

After reading in bytes from file, most are right except 1 is wrong and negative

In Java, I just read a file into a ByteBuffer. When I started checking to make sure that the ByteBuffer contained the right bytes, I noticed that it had mostly the correct start and end bytes, except for the 3rd byte, it has -117 instead of what emacs says should be 139 (8b in hexl-mode). What gives? Does this have something to do with B...

Extract decimal separator

Hello Everybody: I'm importing a csv file in C#, sometimes with '.', sometimes with ',' as decimal separator. Is there a best way of determinate the decimal separator better than counting from the last char down to the first apperance? Thanks in advance. Franklin Albricias. ...

Parsing a decimal from a DataReader.

Hey all, I found a workaround for this error, but am now really curious as to why this would be happening, was wondering if anyone else has had this error. My function is as follows: public void Blog_GetRating(int blogID, ref decimal rating, ref int voteCount) { // Sql statements // Sql commands if(DataReader.Read()) ...

(Java) Write decimal/hex to a file, and not string

If I have a file, and I want to literally write '42' to it (the value, not the string), which for example is 2a in hex, how do I do it? I want to be able to use something like outfile.write(42) or outfile.write(2a) and not write the string to the file. (I realize this is a simple question but I can't find the answer of google, probably ...

Converting hex string stored as chars to decimal in C

I'm given a string hex_txt containing a 4 digit hex number in the way outlined in the code, split up in two array entries. I need to convert it to decimal. The following is the way I'm doing it. unsigned char hex_txt[] = "\xAB\xCD"; unsigned char hex_num[5]; unsigned int dec_num; sprintf(hex_num, "%.2x%.2x", (int)hex_txt[0], (int)hex_t...

PHP round numbers, add decimal numbers

I'm using a simple loop to echo back some numbers <?php $inc = 0.25; $start = 0.25; $stop = 5.00; ?> <?php while($start != ($stop + $inc)){ ?> <option><?php echo $start ?></option> <?php $start = $start + $inc; ?> <?php } ?> However 5.00 appears as 5 and 4.50 appears as 4.5 How would i get this script to display 5.00, 4.00, 3.00, 3...

Handling decimal item quantities

I am currently working on developing a program that stores Quantity as a decimal with four digit places for the very small minority of products that are sold in part (eg 100ml liquid being sold in variable amounts like 1mg-3.5mg). I dislike this design as it causes problems for the entire program in deciding how to present the quantity a...

Formatting Decimals to strings for performance

I'm writing an app that needs to output Decimals of varying lengths, and varying scale to strings without the decimal point for writing to a flat file as input to another system. e.g. 12345 -> Length:10, Scale:2 -> 0001234500 123.45 -> Length:10, Scale:2 -> 0000012345 123.45 -> Length:10, Scale:3 ...

How to change decimal to binary and restore its bit values to an array?

For example: $result = func(14); The $result should be: array(1,1,1,0) How to implement this func? ...

Why aren't Floating-Point Decimal numbers hardware accelerated like Floating-Point Binary numbers?

Is it worth it to implement it in hardware? If yes why? If not why not? Sorry I thought it is clear that I am talking about Decimal Rational Numbers! Ok something like decNumber++ for C++, decimal for .NET... Hope it is clear now :) ...

How to round decimal value up to nearest 0.05 value??

Is there any way to round up decimal value to its nearest 0.05 value in .Net? Ex: 7.125 -> 7.15 6.66 -> 6.7 If its now available can anyone provide me the algo? ...

Javascript decimal to binary operation

var d = 7; in binary: 7 = (111) What I want to do is to set second place from right to 1 or 0 at disposal, and return the decimal value. For example,if I want to make the second 1 to 0,then after process should return a 5, because 5=(101). How to implement this in javascript? EDIT the answer should be something like this: funct...