Questions tagged [digit]

Anything related to numerical digits, i.e. the symbols used to write the representation of a number in a number system, such as decimal, hexadecimal, octal or binary systems.

Anything related to numerical digits, i.e. the symbols used to write the representation of a number in a number system, such as decimal, hexadecimal, octal or binary systems.

See Wikipedia page on numerical digits.

375 questions
5
votes
2 answers

How and why is string.isdigit() locale dependent?

Python has the function for string to test whether all characters are digits: string.isdigit(). In the manual is written: For 8-bit strings, this method is locale-dependent How is this method locale-depedent? In what locales are there digits that…
Peter Smit
  • 27,696
  • 33
  • 111
  • 170
4
votes
4 answers

Java: Specifying how many numbers after the decimal point

I have a GUI Java code for calculating the range of data for example if two values entered 2.444 and 3.555 the result will be a long double 1.11100000... etc. How do I specify how many digits after the decimal point it should display? (ex:…
Aisha S
  • 87
  • 1
  • 1
  • 10
4
votes
2 answers

sed inserting dash into string

I have 14-character line containing digits. How do I insert a char into it at the specific location, i.e. at 4th? So, if I have string like this: xxxxxxxxxxxxxx how do I change it to something like this: xxxx-xx-xxxxxxxx ? (x = digit) Thanks! irek
irek
  • 1,075
  • 2
  • 11
  • 9
4
votes
2 answers

0.5 displays as 0.5 even when I use round(0.5,2)

I have a number like 0.5, I would like to keep two digits in order to make the number 0.50. While the last digit is zero, so it always cannot appear. I have used round(0.5,2) but it doesn't work
Eva
  • 917
  • 4
  • 18
  • 23
4
votes
1 answer

Three digits real number in Pascal

I have code in Free pascal, I have real number 3.285714287142857E+000 from a/b. program threedigits; var a,b:real; begin a:=23; b:=7; writeln(a/b); end. How to change the number to three digits after comma (3.286)?
user7271590
4
votes
1 answer

QLCDNumber numbers can't be centered

Why QLCDNumber numbers can't be centered when the number of digits is lower than the number of digits allowed in the parameters of QLCDNumber ? Can I bypass this ?
user4473281
4
votes
3 answers

How to normalize Unicode digits in Java

Is there any Java API to normalize Unicode digits into ASCII digits? There is a normalization API in JDK and ICU4J which seems not to able to handle this kind of normalization (since it's probably not called normalization by Unicode standard) What I…
Mohsen
  • 3,512
  • 3
  • 38
  • 66
4
votes
1 answer

write.table with different number formatting for each column

I want to write some long tables in R and would like to be able to control the number of digits and formatting of each column. Controlling digits in R have earlier been discussed here, but I want some columns with two digits, and other columns…
jensjorda
  • 183
  • 2
  • 3
  • 10
3
votes
3 answers

How can I implement digit grouping input mask using InputFilter?

I am using InputFilter class to make a masked EditText supporting digit grouping. For example when the user inserts" 12345" I want to show "12,345" in EditText. How can I implement it? This is my incomplete code: InputFilter IF = new…
Bob
  • 22,810
  • 38
  • 143
  • 225
3
votes
1 answer

How to distinguish exponent and ordinary number

The following two expressions return True '2'.isdigit() chr(178).isdigit() the later is exponent. I am looking for a way to distinguish them for all numbers
user1700890
  • 7,144
  • 18
  • 87
  • 183
3
votes
3 answers

Can you help me to understand what "significant digits" means in floating point math?

For what I'm learning, once I convert a floating point value to a decimal one, the "significant digits" I need are a fixed number (17 for double, for example). 17 totals: before and after decimal separator. So for example this code: typedef…
markzzz
  • 47,390
  • 120
  • 299
  • 507
3
votes
2 answers

Python code for digit-to-digit invariants

I have written code that determines which natural numbers less than or equal to 1 000 000 are perfect digit-to-digit invariants (they can be written as the sum of their digits each raised to a power equal to the digit; see…
1123581321
  • 209
  • 2
  • 4
  • 9
3
votes
2 answers

Why is the last element of my array being replaced with a 0

I have a function: function splitToDigits(n) { var digits = ("" + n).split("").map(function(item) { return parseInt(item, 10); }); console.log(digits); } console.log(splitToDigits(123456784987654321)); This is returning digits…
Griffin Obeid
  • 87
  • 1
  • 9
3
votes
3 answers

How do you isolate the digits following a decimal in R?

For example: I have the number 123.456 and want to return 456. The function trunc() basically isolates (truncates) the numbers before the decimal. Is there a function to isolate just the digits after the decimal? Two follow-up questions: Is there a…
theforestecologist
  • 4,667
  • 5
  • 54
  • 91
3
votes
1 answer

"digits=2" doesn't work for one of arguments

A script from R Cookbook: q <- seq(from=0,to=3,by=0.5) tbl <- data.frame(Quant=q, Lower=pnorm(-q), Upper=pnorm(q)) print(tbl,digits=2) results in: Quant Lower Upper 1 0.0 0.5000 0.50 2 0.5 0.3085 0.69 3 1.0 0.1587 0.84 4 1.5 0.0668 0.93 5 2.0…
bitit1994
  • 362
  • 2
  • 4
  • 10
1 2
3
24 25