Questions tagged [decimal]

Decimal is the name for our common base-ten numeral system. It may also refer to non-integer values expressed with a decimal point.

Decimal is the base-10 positional numeral system. It is the ordinary numeral system we use; it can be used to represent both integers and (using a decimal point) non-integer values.

Related tags

7532 questions
3
votes
1 answer

Proper way to define and initialize Decimal in Managed C++/CLI

This seems like it should be really simple but I'm having trouble finding the answer online. What's the proper way to define a Decimal variable and initialize it with constant value in C++/CLI? In C# it would be: decimal d = 1.1M; In C++/CLI I've…
user645280
3
votes
1 answer

Entity Framework 5 - Decimal Save Issue - Conversion Overflows

If I have a table in SQL 2008 R2 with a nullable column of type Decimal(35,18) and pull that into the edmx. The largest decimal value I can successfully save to the DB without getting a Conversion Overflows error is 79,228,162,514 This is very odd…
AndyBufNY
  • 238
  • 2
  • 11
3
votes
3 answers

mySQL format number output , thousands separator

I have a mySQL query which is outputting decimal fields with a comma. SELECT Metals.Metal, FORMAT(Fixes.GBPam, 3) AS AM, FORMAT(Fixes.GBPpm, 3) AS PM, DATE_FORMAT(Fixes.DateTime, '%d-%m-%y') AS Date FROM Fixes, Metals WHERE Metals.Id =…
Gravy
  • 12,264
  • 26
  • 124
  • 193
3
votes
2 answers

Ruby decimal precision

Sorry if this is obvious, but I search Google, Stack Overflow, and the Ruby documentation and I couldn't find it. How would I go about making a higher precision decimal? For example, in IRB, irb(main):001:0> 3.14159265358979323846 =>…
tckmn
  • 57,719
  • 27
  • 114
  • 156
3
votes
2 answers

C# Decimal to Numeric(?,?)

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…
Polo
  • 1,770
  • 4
  • 18
  • 29
3
votes
7 answers

IP address conversion to decimal and vice versa

Suppose my decimal number is 9766322441 so its corresponding is 70.30.65.9 but when this IP address IC converted back, its gives some different decimal number 1176387849... and when I convert the IP address pf google.com i.e 64.233.187.99 then it…
akshay1728
  • 373
  • 2
  • 6
  • 15
3
votes
4 answers

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?
Richochet
3
votes
3 answers

Convert binary string to integer string c++

Possible Duplicate: Converting string of 1s and 0s into binary value I would like to convert a binary string to an integer string in c++. e.g: "000000000010" becomes "2" I have the following constraint: i can not convert this string to an integer…
jav974
  • 1,022
  • 10
  • 22
3
votes
4 answers

How do I round the number in a textbox to 2 decimals in C#?

I have a price textbox and I want to get a decimal value with 2 decimals, no matter the original string is a already a decimal or an integer. For example: input = 12 --> output = 12.00 input = 12.1 --> output = 12.10 input = 12.123 --> output =…
Barbara PM
  • 512
  • 2
  • 8
  • 29
3
votes
3 answers

Convert Decimal value to Date - Informix DB

I am trying to convert decimal value to date in select statement SELECT user_id, extend(dbinfo("UTC_TO_DATETIME",min(creationdate)), year to fraction) AS earned_date FROM message But I am getting this error Value exceeds limit of INTEGER…
Ahmad Alkhawaja
  • 529
  • 2
  • 12
  • 29
3
votes
2 answers

ATM style decimal places

I'm working on getting an old piece of code working, from 2003. I'm trying to replicate an ATM style decimal textbox. This code claims to have worked for someone, but I am having trouble implementing it. Maybe someone has a better way of achieving…
puppyman
  • 31
  • 2
3
votes
3 answers

Converting from `NSDecimal` or `NSDecimalNumber` to C#'s `decimal` type

I've got an NSDecimalNumber from StoreKit's SKProduct class, and I want to convert it to C#'s decimal type to minimize loss of precision. Is there a straightforward way to do such a thing? I figure my two choices are: Assume that I understand the…
sblom
  • 26,911
  • 4
  • 71
  • 95
3
votes
1 answer

How to convert a string containing an exponential number to decimal and back to string

I'm converting code between delphi and c#. Values are stored as strings in a text file from the delphi app. An example of the stored value is : '4.42615029219009E-5' Now in my c# app I need to read in that string value and then later have the…
Eminem
  • 7,206
  • 15
  • 53
  • 95
3
votes
2 answers

Access 2007 export table to csv decimal

I have some tables in Access that I'm trying to export to csv so that I can import to Oracle. I don't use the export via ODBC because I have 70K - 500K records in some of these tables and that feature takes way to long as I have about 25 tables to…
user441521
  • 6,942
  • 23
  • 88
  • 160
3
votes
9 answers

C/C++ rounding up decimals with a certain precision, efficiently

I'm trying to optimize the following. The code bellow does this : If a = 0.775 and I need precision 2 dp then a => 0.78 Basically, if the last digit is 5, it rounds upwards the next digit, otherwise it doesn't. My problem was that 0.45 doesnt…
Milan
  • 15,389
  • 20
  • 57
  • 65