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

find number in string, add 1 and replace

I need to write a code where a string contains a number, then this number is incremented by 1, and then printed out within the initial string input. It should work like this >>>addNumber('I slept 3 hours') what number would you like to increment?…
April
  • 213
  • 1
  • 3
  • 15
3
votes
5 answers

How can I limit the amount of digits in an input?

I'm a student doing a computer science course and for part of the assessment we have to write a program that will take 10 digits from the user and used them to calculate an 11th number in order to produce an ISBN. The numbers that the user inputs…
Kai McClymont
  • 55
  • 1
  • 1
  • 5
3
votes
1 answer

Change the digits of numbers in Venndiagram

I don't know why but somehow when I use digits in the venn diagram visualization using VennDiagram package, the overlap parts show different numbers of digits as below I have used both R and excel to calculate these data (they are actually…
MYjx
  • 4,157
  • 9
  • 38
  • 53
3
votes
3 answers

Digit-count of a boost::multiprecision::cpp_int

What is an efficient way get the digit count of a boost::multiprecision::cpp_int? The log10() function is apparently not compatible with multiprecision integers and I can't figure out any other way to do this.
user1892304
  • 617
  • 1
  • 6
  • 11
3
votes
2 answers

Regex Counting By 3s

I'm teaching myself regular expressions, and found a quizzing site that has been helping me find more applications for them and has been helping me expand my knowledge of how they work. I found a question asking me to form a regex to match 10 digit…
Humus
  • 95
  • 1
  • 7
3
votes
5 answers

The particular digit in the number of total

When you have such a definition: int variable = 253243243; Can I somehow refer for example to the third digit in this number? Something along the lines of vector or array? I need this to compare whether a certain digit in the number corresponds to…
Jake
  • 633
  • 1
  • 7
  • 19
3
votes
3 answers

How can I remove a certain number of digits in a number so the number obtained is minimal?

How can I remove a certain number of digits in a number so the number obtained is minimal? Specifically, I want to write a function int remove_digits(int large, int num_digits_to_remove) such that: Any num_digits_to_remove digits are removed from…
boa_in_samoa
  • 587
  • 7
  • 16
3
votes
2 answers

How come CGFloat is making up significant digits?

Possible Duplicate: CGFloat addition bug? I have a CGPoint (which is just a struct around two CGFloats). Can someone explain to me how these two lines of code: player.position = CGPointMake(player.position.x + 12.8f, player.position.y +…
InkGolem
  • 2,662
  • 1
  • 15
  • 22
3
votes
6 answers

Reducing the digits of a Double in C++

I need a function that reduces the precision (number of digits) of my doubles. I need it for calculation, not for output on the screen. What I have so far, is: double setDigits(double _number, int _digits) { double tenth =…
bjar-bjar
  • 737
  • 1
  • 8
  • 21
3
votes
3 answers

Trimming a float

Possible Duplicate: Leave only two decimal places after the dot Formatting a float to 2 decimal places If I have a float that consists of something like 153.2154879, is there any way to convert it to string but only show 4 decimal places? I know…
TheGateKeeper
  • 4,420
  • 19
  • 66
  • 101
2
votes
2 answers

Use of datatype for 10-20 digit value - PostgreSQL

Im currently developing an application that needs to store a 10 to 20 digit value into the database. My question is, what datatype should i need to be using? This digit is used as an primary key, and therefore the performance of the DB is important…
user1226868
  • 1,708
  • 5
  • 18
  • 29
2
votes
5 answers

how to compare last digit for int and remove items that have the same last digit?

this is a very specific question, but i also have very specific details on what i'm looking for. i currently do not have (and cannot find) a good method for accomplishing this. please help if you can. i have an integer list that will always contain…
ikathegreat
  • 2,311
  • 9
  • 49
  • 80
2
votes
2 answers

Strange work RegExp in javascript

I want validate user input. User may input four digit only. I use RegExp for checking and see strange work. Javascript not understand \d var expr1 = new RegExp("^\s*[0-9]{4,4}\s*"); var year = "1984"; alert (expr1.test(year)); var expr2 = new…
GraDea
  • 588
  • 7
  • 23
2
votes
3 answers

java Regex: replace all numerical values with one number

I have a simple line of text which might include numbers like "12.3" or "1983" or "5/8". Whenever any number appears, I just need to replace with a fixed character, say the digit "8". I've been fiddling about with Regex in Java, with things like…
user961627
  • 12,379
  • 42
  • 136
  • 210
2
votes
6 answers

Limit Numbers after Decimal on Key Press Event

I am using the following code to take only digits from user and only one decimal point , that is working fine for me on KeyPress Event : if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && e.KeyChar != '.') { e.Handled = true; } if…
Shahid Ghafoor
  • 2,991
  • 17
  • 68
  • 123