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

Sum of floats: unexpected result

The following output surprised me: 1.1 + 2.2 => 3.3000000000000003 An unexpected small digit came up from the sum. The same does not happen for other addends, e.g.: 3.0 + 0.3 => 3.3 I tried both in Python 2.7 and in 3.4, but the result is the…
Marco
  • 3,053
  • 5
  • 27
  • 29
2
votes
2 answers

How to add digits to a long value

So I have this variable long hashvalue and I want to add digits to it if something is true. I have this array int arr[3][3] with the numbers -1, 1, 0, 0, -1, 1, 0, 0, -1 in it I need something like this: if(array[i][j] == -1){ //add digit 2 to…
user3566608
  • 353
  • 3
  • 15
2
votes
2 answers

Check whether the input is digit or not in C programming

I am currently reading this book: The C Programming Language - By Kernighan and Ritchie (second Edition) and one of the examples I am having trouble understanding how to check whether the input is digit or not. The example is on Page 22, explaining…
harrisonthu
  • 454
  • 3
  • 7
  • 18
2
votes
2 answers

Math round Java issue 2.495 to 2 digits = 2.49

First off this is the code I use : public static float roundAt(float value , int digits) { double pow = Math.pow(10, digits); double retvalue; retvalue = (value * pow); retvalue = Math.round(retvalue); retvalue = retvalue /…
2
votes
1 answer

How do i find the highest digit in a multi-digit number?

Okay so I have an exercise to do I need to find the highest and the lowest digit in a number and add them together.So I have a number n which is 5368 and the code needs to find the highest (8) and the lowest (3) number and add them together (11).How…
Oktavix
  • 151
  • 1
  • 2
  • 9
2
votes
1 answer

regular expression match digit and characters

How can I create a regex expression that will match only characters and numbers? this regex matched width digit: /\D/g how can add characters like - , _ , * and etc to it?
user3748973
  • 449
  • 2
  • 8
  • 24
2
votes
1 answer

Ruby - See if a multiple of a number has the exact same digits as the original number (re-arranged)

I have a number, and would like to see if I multiply the number by a real number, if the new number has the exact same digits as the previous number, only re-arranged. For example, if I wanted to multiply a number by 2 and see if the digits remained…
user3821080
2
votes
3 answers

C++ how to avoid trailing zeroes?

If you do double number; cout.precision(3) cout<
user3290180
  • 4,260
  • 9
  • 42
  • 77
2
votes
1 answer

Matlab does not display enough digits on plot

I would like to plot a graph in MATLAB but it displays x-axis as x10^6 ! How can I make it display it 10 000 000 ? See image below. …
Bhoke
  • 468
  • 6
  • 22
2
votes
1 answer

Making a table which is difference of 2 table by eliminating first char

I have 2 table as ebl_old and ebl. Both table has 1 column called imei. I have also an empty table called ebl_test. I want to add the rows which exists in ebl_old and not exists in ebl into ebl_test. But my problem is: the data format in ebl_old and…
abidinberkay
  • 1,857
  • 4
  • 36
  • 68
2
votes
3 answers

How to get the second digit of a number or string in python?

Is there any good idea how to get the second digit of a string? For example: aaa = 122 bbb = 333 rest = bbb-aaa if rest[:2] == 1: do something..
hawer183
  • 109
  • 1
  • 4
  • 13
2
votes
2 answers

Find all variations of a digit sum

Can anyone please direct me to an algorithm/formulae that says how to calculate all variations of a digit sum with a certain upper limit So for example, if my digit sum is 6 and the upper limit is 123, then all variations for that digit sum would…
user1047833
  • 343
  • 2
  • 7
  • 17
2
votes
2 answers

how to classifying that is a single digit or multiple digit

I have an image that contain digits. there are: 1, 153, 25, 50, 23, and 40 For every single digit, I have no problem with digit recognition. I can recognize there are 1, 1, 5, 3, 5, 0, 2, 5, 2, 3, 4, 0. Now, I want to made them become 1, 153, 25,…
lulu
  • 75
  • 1
  • 1
  • 9
2
votes
5 answers

Regex : Phone number starting with 06 or 07

I have this function which works only for 10 digits. function telValide( tel ) { var reg = new RegExp('^[0-9]{10}$', 'i'); return reg.test(tel); } I would like to check phone number starting with 06 or 07. Ex : 06 01010101 : true 07…
Steffi
  • 6,835
  • 25
  • 78
  • 123
2
votes
4 answers

What is the fastest algorithm for checking if a 14 digit number is prime?

I need the fastest possible program for primality check on a 14 digit(or bigger) number. I searched on multiple sites but i'm not sure the ones I found will work with numbers as big as this.