Questions tagged [digits]

Questions dealing with getting, manipulating, or changing the digits of numbers

Use this tag for questions dealing with getting, manipulating, or changing the digits of numbers. More about digits on wikipedia

1098 questions
7
votes
5 answers

Create char array of integer using digits as size

I am trying to create a char array in C, to fill it with the digits of an int, but the int can be of any number of digits. I'm using a created function called getDigits(int num), that returns a number of digits the int has. char…
anairinac
  • 559
  • 4
  • 6
  • 18
7
votes
4 answers

Simple Number to Array with Individual Digits

I am exceptionally new to programming, but I am working on improving my skills as a programmer. Currently, I am working on a problem I gave myself where I am trying to take a variable number and make each of its digits a separate number in an array.…
user2049256
7
votes
3 answers

r keeping 0.0 when using paste or paste0

This is a simple question but it is starting to annoy me that I cant find a solution.... I would like to be able to keep the 0.0 when using it as an output when using paste or paste0 so if i have the following: y <-…
h.l.m
  • 13,015
  • 22
  • 82
  • 169
6
votes
2 answers

do I have to specify integer length when creating an id field in MySQL through phpMyAdmin?

I saw someone not set the length in a tutorial but it was specifically for counting the total number of users and just set to auto-increment. I've been of the habit of always specifying a length because I thought it was mandatory, but I wanted to…
Simon Suh
  • 10,599
  • 25
  • 86
  • 110
6
votes
2 answers

python pandas get first digits of column values

I need to get for each row of a daframe, the first two digits of a number stored in another index (or column after a reset_index()). How can I do it? My dataframe: value index1 110202 1 223168 5 850484 2 298008 …
user9187374
  • 299
  • 1
  • 3
  • 11
6
votes
9 answers

How to keep 2 decimal places in Delphi?

I have selected columns from a database table and want this data with two decimal places only. I have: SQL.Strings = ('select '#9'my_index '#9'his_index,'... What is that #9? How can I deal with the data I selected to make it only keep two decimal…
spspli
  • 3,128
  • 11
  • 48
  • 75
6
votes
2 answers

How do I show more digits of haskell's pi?

I'd like to take more digits of the Prelude pi value. Prelude> take 4 $ show pi "3.14" But Prelude> take 17 $ show pi "3.141592653589793" Prelude> take 170 $ show pi "3.141592653589793" Is the pi constant just stored this truncated? Is there an…
Mittenchops
  • 18,633
  • 33
  • 128
  • 246
6
votes
7 answers

PHP Leftmost digit

let's say I have a variable containing an integer or a float (since integers might overflow into a float in PHP). I want to run some operation to get the leftmost digit and the rest of the remaining digits. To explain better:
Jean Paul Galea
  • 1,321
  • 4
  • 18
  • 26
6
votes
3 answers

Finding a number at a particular digit in a number

I want to get number present at the specific index. Suppose the number is "123456789" and i need to return the number at position 3 from left. Should I convert this number to a string and re-convert the char at specific index to integer to get the…
Underoos
  • 4,708
  • 8
  • 42
  • 85
6
votes
1 answer

Rounding to n significant digits

I'm trying to write code in MATLAB that will round number to certain (as I ask) significant digits. I'm not sure how to do it. Any suggestions?
saharz
  • 77
  • 1
  • 1
  • 5
6
votes
5 answers

Wrong PHP string equality

For some reason, PHP decided that if: $a = "3.14159265358979326666666666" $b = "3.14159265358979323846264338" $a == $b is true. Why is that, and how can I fix that? It ruins my code.
6
votes
2 answers

cv::Mat matrix, HOW TO Reduce digits to the right of the decimal point in cv::Mat?

I have an app that prints a 3x3 cv::Mat on the iPhone screen. I need to reduce the decimals, as the screen is not so big, see: [1.004596557012473, -0.003116992336797859, 5.936915104939593; -0.007241746117066327, 0.9973985665720294,…
marcelosalloum
  • 3,481
  • 4
  • 39
  • 63
6
votes
1 answer

Android Tesseract OCR 7 Segment Digits

I have been implementing an Android OCR tool using tesseract to ocr digits only. So far, it is giving quite high accuracy with normal digit fonts. However, the accuracy is terrible when it comes to 7 segment digits (those found on LCDs) . I have…
laurie7
  • 61
  • 1
  • 2
5
votes
1 answer

why does guid have special formats?

Possible Duplicate: Why is the GUID structure declared the way it is? i've been looking a GUID generation and handling and is wondering why Microsoft has decided these "strange" formats. A single format specifier that indicates how to format the…
BerggreenDK
  • 4,915
  • 9
  • 39
  • 61
5
votes
3 answers

Difference in digits10 between GCC and MSVC

I have the following code: #include #include int main() { std::cout << std::numeric_limits::digits10 << std::endl; return 0; } GCC 4.4 returns 19 MS VS 9.0 returns 18 Can someone please explain…
Rikardo Koder
  • 672
  • 9
  • 16