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
3
votes
1 answer

C++: digits vs bits?

I am trying to understand the difference of vocabulary used in the C++ language between digits and bits as in : CHAR_BIT; std::numeric_limits::digits; Is there a conceptual difference? Maybe for weird architectures? If so, what would be…
Vincent
  • 57,703
  • 61
  • 205
  • 388
3
votes
1 answer

Controlling digits / rounding as argument in base functions

In scientific paper writing, values are typically reported as rounded values with one, two or three digits, often depending on the type of value reported. This means that everytime when e.g. including an inline mean value in Rmarkdown I have to add…
jmjr
  • 2,090
  • 2
  • 21
  • 31
3
votes
3 answers

vb.net string contains only 4 digit numbers(or a year)

how can i check if a string only contains 4 digit numbers ( or a year ) i tried this Dim rgx As New Regex("^/d{4}") Dim number As String = "0000" Console.WriteLine(rgx.IsMatch(number)) // true number = "000a" …
user2653652
  • 57
  • 1
  • 10
3
votes
2 answers

How do I replace newlines only between numbers and a sentence?

I want to remove newlines in some special cases. I have this text: 0 15.239 23.917 Reprenem el debat que avui els oferim entorn de les perspectives d'aquest dos mil set. <ehh> Estavem parlant concretament dels temes 30.027 de la…
Sergi
  • 417
  • 6
  • 18
3
votes
1 answer

streaming pi decimal digits generator algorithm

the idea is to implement RFC3091 ("Pi Digit Generation Protocol") over HTTP. I've been having trouble finding a streaming (and/or spigot) algorithm that actually yields the correct decimal expansion. Yes, there are a lot of implementations out…
3
votes
2 answers

Python - Number of Significant Digits in results of division

Newbie here. I have the following code: myADC = 128 maxVoltage = 5.0 maxADC = 255.0 VoltsPerADC = maxVoltage/maxADC myVolts = myADC * VoltsPerADC print "myADC = {0: >3}".format(myADC) print "VoltsPerADC = {0: >7}".format(VoltsPerADC) print…
russ
  • 31
  • 1
  • 2
3
votes
1 answer

Fixed digits number in floats

I read a lot of discussion about this on SE, but still can't find the right one. I want to plot some numbers, of various lengths, with the same number of digits. For example I have: 12.345678, 1.2345678. Now, since I have to plot them with their…
Py-ser
  • 1,860
  • 9
  • 32
  • 58
3
votes
2 answers

C++ precision of numbers and truncation with fstream

I have a file.txt with hundreds of numbers. They have many digits (max 20) after the point and I need to get them all without truncation, otherwise they introduce errors in the following computations. I made these numbers with matlab so it has a…
user3290180
  • 4,260
  • 9
  • 42
  • 77
3
votes
0 answers

Low accurracy on handwritten images when using MNIST as a training set

We are working on a term project and we are using MNIST training set. Although our classifier works well on MNIST test set (>94% accuracy), its performance is significantly low on our prepared dataset. Details of our prepared dataset as follows: We…
Baskaya
  • 7,651
  • 6
  • 29
  • 27
3
votes
3 answers

How to keep n decimal places in Java

Hi All it might be a trivial question but as for now I could not find any solution.So asking for your help! What I am trying to get is a specific encoding table that looks like this: 0.000 0.100 0.200 I need to keep track of zeroes as I will use…
madbitloman
  • 816
  • 2
  • 13
  • 21
3
votes
2 answers

convert English digits to Arabic digits in html documents

I want to convert English digits (0,1,2,3,...) to Arabic digits (۰,۱,۲,۳,...) in content of some HTML document using a PHP function. I wrote this function: function en2ar($str) { $ends = array('0','1','2','3','4','5','6','7','8','9'); $ards…
Pourbahrami
  • 319
  • 1
  • 16
3
votes
1 answer

how can i measure more than 16 digits after zero with python?

i want to measure about 1000 digits after zero of a number, but i don't know what to do with it to print all of the numbers because it just prints the first 16 numbers what should i do to have them all printed? i tried to change it to string but the…
Omid Karami
  • 2,675
  • 2
  • 13
  • 17
3
votes
3 answers

Tesseract has trouble reading this extremely simple string of numbers

I'm currently writing a script in python that requires the use of tesseract to read a number like this: Using digits only and -psm 6 (or 7) it outputs 5.551 I have had some success with other numbers (5.700 works) but this particular number is…
Loocid
  • 6,112
  • 1
  • 24
  • 42
3
votes
3 answers

Simple grep for anything year

I know I'm doing something boneheaded here, but a regex cheat sheet given to us in my Unix/Linux class implied (by my reading) that this should find lines in a text file that contain years (numbers from 0000 to 9999): grep \d{4} file.txt Why does…
Lenoxus
  • 545
  • 1
  • 4
  • 19
3
votes
4 answers

Converting Arabic numerals to Arabic/Persian numbers in html file

I am trying to convert the plain text Arabic Numerals into Eastern Arabic digits. So basically taking 1 2 3... and converting them into ١‎ ٢‎ ٣‎.... The function converts all numbers, including any numbers contained within tags, i.e. H1. private…
KF2
  • 9,887
  • 8
  • 44
  • 77