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
7
votes
2 answers

double string conversion and locale

A common international issue is the conversion of double values represented in strings. This stuff is found in a lot of areas. Starting with csv files which are either called comma separated or character separated because sometimes they are stored…
Totonga
  • 4,052
  • 1
  • 23
  • 30
6
votes
10 answers

Limiting text field entry to only one decimal point

I have created a text field to enter an amount of money. I want the user to be able to enter only one decimal point. I implemented that in the -(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range…
utsabiem
  • 890
  • 4
  • 10
  • 21
6
votes
2 answers

pd.read_feather problems with decimal / thousands separator and rounding problems for floats

I'd like to use .ftr files to quickly analyze hundreds of tables. Unfortunately I have some problems with decimal and thousands separator, similar to that post, just that read_feather does not allow for decimal=',', thousands='.' options. I've tried…
TiTo
  • 451
  • 3
  • 17
6
votes
1 answer

How to format float decimals when using Value With Pattern binding?

I have an NSTextField, which is bound to a float value through Interface Builder via "Value with Pattern" field. The default display pattern is %{value1}@ Is there any way I can modify that line to have my output formatted to 2 decimal places? Or is…
anna
  • 2,725
  • 4
  • 25
  • 36
6
votes
3 answers

How to specify the decimal separator in Google Charts?

Is there a way to specify the decimal separator in Google Charts? By default it seems to be based on the locale, however the need I have is to have the decimal separator to be a "dot" rather than the comma for some locales (my users are in a locale…
Eric Grange
  • 5,591
  • 1
  • 35
  • 55
6
votes
1 answer

Linq to SQL: Why decimal field get truncated on Insert?

I have a column defined as decimal(10,6). When I try to save the model with the value 10.12345, in the database I saved as 10.123400. The last digit ("5") is truncated. Why is the number default to only 4 digits in LINQ (for decimal) and how can I…
Emanuel
  • 5,832
  • 17
  • 55
  • 74
6
votes
5 answers

How to properly display a price up to two decimals (cents) including trailing zeros in Java?

There is a good question on rounding decimals in Java here. But I was wondering how can I include the trailing zeros to display prices in my program like: $1.50, $1.00 The simple solution of String.format("%.2g%n", 0.912385); works just fine, but…
denchr
  • 3,734
  • 11
  • 44
  • 51
6
votes
1 answer

How to calculate decimal digits of precision based on the number of bits?

I am learning about floating point formats (IEEE). In the single precision floating point format ,it is mentioned that the mantissa has 24 bits and so it has 6 1/2 decimal digits of precision (as the per the book "understanding the machine") , and…
Yogi
  • 95
  • 1
  • 3
  • 8
5
votes
4 answers

In Perl, how can I limit the number of places after the decimal point but have no trailing zeroes?

This question is similar to "dropping trailing ‘.0’ from floats", but for Perl and with a maximum number of digits after the decimal. I'm looking for a way to convert numbers to string format, dropping any redundant '0', including not just right…
Brian Carlton
  • 7,151
  • 5
  • 36
  • 47
5
votes
0 answers

Change comma to period in decimal pad ignoring current device locale

I have a UITextField and its keyboard type is DecimalPad. The app only supports one language (italian) and the decimal pad displays a comma instead of a period as a decimal separator. I need to change that comma to a period, so that, whatever locale…
user5273262
5
votes
2 answers

Ruby Regex to round trailing zeros

I'm looking for a regex to remove trailing zeros from decimal numbers. It should return the following results: 0.0002300 -> 0.00023 10.002300 -> 10.0023 100.0 -> 100 1000 -> 1000 0.0 -> 0 0 -> 0 Basically, it should remove…
sa125
  • 25,703
  • 36
  • 105
  • 149
5
votes
1 answer

Python PANDAS write to csv: how to set decimal point (".", or ",")?

I can't seem to find the option to set the decimal point for floats (".", or ",") when WRITING a DataFrame to a csv file. (Reading is no problem.) My task/problem: I'm publishing a program/script and want all users independent of their OS and…
tryptofame
  • 292
  • 6
  • 17
4
votes
4 answers

Matlab: How to read in numbers with a comma as decimal separator?

I have a whole lot (hundreds of thousands) of rather large (>0.5MB) files, where data are numerical, but with a comma as decimal separator. It's impractical for me to use an external tool like sed "s/,/./g". When the separator is a dot, I just use…
Marek Kurdej
  • 1,256
  • 1
  • 14
  • 31
4
votes
1 answer

Pandas dataframe with float64 incorrectly exported by to_json() function

This issue is about exporting the dataframe with float64 datatype, using the to_json() function from Pandas. The source code is attached below. import pandas if __name__ == "__main__": d = {'col1': [11111111.84, 123456.55], 'col2': [3, 4]} …
E. S.
  • 117
  • 7
4
votes
1 answer

How to round the double value upto two decimal points in dart?

I have made this method that was called to perform functionality and do calculation but return number in double format for some calculations upto more than 10 decimal points. How can i make this code to show only upto 2 or 3 decimal…
Umair
  • 1,033
  • 2
  • 10
  • 27