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.
Questions tagged [decimal-point]
378 questions
27
votes
3 answers
Int to Decimal Conversion - Insert decimal point at specified location
I have the following int 7122960
I need to convert it to 71229.60
Any ideas on how to convert the int into a decimal and insert the decimal point in the correct location?
![](../../users/profiles/1144118.webp)
Baxter
- 5,033
- 21
- 64
- 104
24
votes
5 answers
Decimal point or decimal comma in Android
Is there an easy way to read back if the language set uses a decimal comma or a decimal point?
![](../../users/profiles/679201.webp)
patrick
- 1,252
- 4
- 19
- 36
24
votes
3 answers
How to get the numbers after the decimal point? (java)
double d = 4.321562;
Is there an easy way to extract the 0.321562 on it's own from d? I tried looking in the math class but no luck. If this can be done without converting to string or casting to anything else, even better.
![](../../users/profiles/656963.webp)
David
- 14,313
- 26
- 100
- 149
23
votes
1 answer
pandas to_csv arguments float_format and decimal not working for index column
Background
I am doing some simulations resp. a system analysis by variing parameters (in this case rpm only) and append every last line of a results dataframe results_df to a summarizing dataframe df containing giving the baviour of my system in…
![](../../users/profiles/3991125.webp)
albert
- 6,188
- 6
- 37
- 71
22
votes
2 answers
Change decimal separator in MySQL
Is it possible to change the decimal comma from "." (dot) to other character (comma) in MySQL output? I don't want to use functions like FORMAT, I just want to use all the queries I normaly use without any modification. I'm looking for some setting…
![](../../users/profiles/684229.webp)
Tomas
- 52,167
- 46
- 207
- 345
20
votes
14 answers
Split double into two int, one int before decimal point and one after
I need to split an double value, into two int value, one before the decimal point and one after. The int after the decimal point should have two digits.
Example:
10.50 = 10 and 50
10.45 = 10 and 45
10.5 = 10 and 50
![](../../users/profiles/1014436.webp)
Scott Parker
- 229
- 1
- 2
- 7
18
votes
9 answers
Python, Determine if a string should be converted into Int or Float
I want to convert a string to the tightest possible datatype: int or float.
I have two strings:
value1="0.80" #this needs to be a float
value2="1.00" #this needs to be an integer.
How I can determine that value1 should be Float and value2…
![](../../users/profiles/1958457.webp)
ManuParra
- 1,221
- 6
- 14
- 33
16
votes
4 answers
how can i show an irrational number to 100 decimal places in python?
I am trying to find the square root of 2 to 100 decimal places, but it only shows to like 10 by default, how can I change this?
![](../../users/profiles/486086.webp)
clayton33
- 3,916
- 10
- 43
- 64
15
votes
3 answers
Converting base of floating point number without losing precision
Terminology
In this question I am calling "floating point number" "decimal number" to prevent ambiguation with the float/double Java primitive data types. The term "decimal" has no relationship with "base 10".
Background
I am expressing a decimal…
![](../../users/profiles/3990767.webp)
SOFe
- 7,134
- 4
- 28
- 57
14
votes
3 answers
Python - random float with limited decimal digits
I just found out how to make random numbers in Python, but if I print them out, they all have 15 decimal digits. How do I fix that?
Here is my code:
import random
import os
greaterThan = float(input("Your number will be greater than: "))
lessThan =…
![](../../users/profiles/5149431.webp)
SALZKARTOFFEEEL
- 151
- 1
- 1
- 4
14
votes
5 answers
Truncating Double with VBA in excel
I need to truncate the amount of decimal places of my double value for display in a textbox. How would one achieve this with vba?
![](../../users/profiles/1373525.webp)
Ehudz
- 543
- 9
- 18
- 33
13
votes
4 answers
Rails 3 Float or decimal for GPS coordinates
I need to store GPS coordinates in a database. I've heard that floats are less accurate than decimals. Is that true? If so, what reason is there to ever use floats?
![](../../users/profiles/1423009.webp)
jac
- 221
- 3
- 7
12
votes
2 answers
How can I make a "working" repeating decimal representation of a rational number?
I've figured out how to display the repeating part of a repeating decimal using OverBar.
repeatingDecimal doesn't actually work as a repeating decimal. I'd like to make a variation of it that looks and behaves like a repeating decimal.
Question
How…
![](../../users/profiles/638130.webp)
DavidC
- 3,036
- 1
- 17
- 30
12
votes
7 answers
String.Format - How can I format to x digits (regardless of decimal place)?
I need to format a floating point number to x characters (6 in my case including the decimal point). My output also needs to include the sign of the number
So given the inputs, here are the expected outputs
1.23456 => +1.2345
-12.34567 =>…
![](../../users/profiles/355657.webp)
Simon
- 8,517
- 13
- 64
- 107
11
votes
5 answers
Format a number containing a decimal point with leading zeroes
I want to format a number with a decimal point in it with leading zeros.
This
>>> '3.3'.zfill(5)
003.3
considers all the digits and even the decimal point. Is there a function in python that considers only the whole part?
I only need to format…
![](../../users/profiles/918011.webp)
3eee3
- 135
- 1
- 2
- 7