Questions tagged [decimal-point]

The character or glyph used to separate the integer part from the fraction part in a decimal number. Usually either a dot or a comma.

378 questions
11
votes
4 answers

Sorting 'numbers' with multiple decimal points

I've got a bunch of "numbers" that have multiple decimal points (so they're really strings). However, I want to sort them as if they were numbers. 1.1.1 10.2.3 2.6.7 21.10.4 3.10.12 4.11.5 4.1.16 6.4.23 I want them to sort by the first set of…
thugsb
  • 19,348
  • 6
  • 28
  • 43
10
votes
7 answers

Determine the decimal precision of an input number

We have an interesting problem were we need to determine the decimal precision of a users input (textbox). Essentially we need to know the number of decimal places entered and then return a precision number, this is best illustrated with…
Quinten
  • 101
  • 1
  • 1
  • 3
10
votes
2 answers

Most elegant way to load csv with point as thousands separator in R

NB: To the best of my knowledge this question is not a duplicate! All the questios/answers I found are either how to eliminate points from data that are already in R or how to change the decimal point to a comma when loading it. I have a csv with…
vonjd
  • 3,530
  • 3
  • 36
  • 57
10
votes
2 answers

How can I set the decimal separator to be a comma?

I would like to read and write pi as 3,141592 instead of 3.141592, as using the comma is common in many European countries. How can I accomplish this with iostreams? In other words cout << 3.141592; should print 3,141592 to standard output.
Ralph Tandetzky
  • 20,730
  • 9
  • 61
  • 117
9
votes
4 answers

Javascript restrict input once 2 decimal places have been reached

I currently have a number input script that behaves similar to a calculator with the way numbers are displayed, but I want to stop the adding of additional numbers to the series after two numbers past the decimal point. Here is what I have so far,…
cloudseeker
  • 175
  • 1
  • 1
  • 12
9
votes
6 answers

Sorting records from Oracle with multiple decimal points (.)

UPDATE: ORACLE VERSION 10G I have a list of records in Oracle as follows, these are actually sections of various books The records are generated in the below format [main topic].[sub topic].[first level section] ..... .[last level…
Sangeet Menon
  • 8,737
  • 8
  • 37
  • 56
9
votes
7 answers

Align Decimal Data in table column by decimal point, HTML5, CSS3

I am building a wordpress plugin which is generating an HTML table and sending to gravityforms html block via shortcode. My problem is that cell contents can contain: 23.24 1,234.665 123.4 etc... Notice the differing number of decimal places. Is…
Gravy
  • 11,344
  • 21
  • 112
  • 184
8
votes
5 answers

How to fix an application that has a problem with decimal separator

This post is about C# and .Net, but some info is valuable for other techonolgies. Since I can remember, I've been having problems with apps or games that crash because of a different style of parsing decimal numbers. It happens very often, from CAD…
Lukasz Madon
  • 13,748
  • 13
  • 58
  • 93
8
votes
8 answers

In Java, why does the decimal separator follow the Locale's language, not its country, and, more importantly, how does one override it?

I'm working on an international project and have observed that, in Java, the choice of the decimal separator is based on the Locale's language, not its country. For example: DecimalFormat currencyFormatter = (DecimalFormat)…
Mark Hanes
  • 89
  • 1
  • 1
  • 2
8
votes
2 answers

printing a variable value to 2 decimal places

I am trying to create a currency converter that prints a final value out to 2 decimal places. I have created the entire program and this is just a small portion of it but I can't get the program to print to 2 decimal places. I have tried using…
user2633836
  • 121
  • 3
  • 5
  • 13
8
votes
4 answers

Limiting both the fractional and total number of digits when formatting a float for display

I need to print a float value in area of limited width most efficiently. I'm using an NSNumberFormatter, and I set two numbers after the decimal point as the default, so that when I have a number like 234.25 it is printed as is: 234.25. But when I…
BartoNaz
  • 2,293
  • 2
  • 24
  • 41
7
votes
2 answers

rounding decimal points

Possible Duplicate: Round a double to 2 significant figures after decimal point I am trying to work with converting a decimal degree (23.1248) into a minutes style degree(23 7'29.3"). this is what I have so far: double a=23.1248; int…
Paul Robert Carlson
  • 169
  • 1
  • 2
  • 14
7
votes
1 answer

Can you make a TextField accept both , and . as decimal separator?

In a Wicket app, I have a decimal number text field: TextField f = new TextField("f", new PropertyModel(model, "share")); I want it to always accept both . (dot) and , (comma) as decimal separator…
Jonik
  • 74,291
  • 66
  • 249
  • 356
7
votes
6 answers

Replace dot(.) with comma(,) using RegEx?

I am working on a C# application. I want to change number decimal figure with comma(,) where i have dot(.) using regular expression. For example: Price= 100,00.56 As this international rule of representing numeric values but I Sweden they have…
Mohsin JK
  • 561
  • 2
  • 8
  • 18
7
votes
2 answers

How to display a fixed number of digits in C++ without rounding

I have this code (very basic): #include #include using namespace std; int main() { float a = 0.0, b = 0.0, c = 0.0; cout<<"Input a: "; cin>>a; cout<<"input b: "; cin>>b; cout<
user2529011
  • 557
  • 3
  • 7
  • 17
1 2
3
25 26