Questions tagged [numeric]

This tag is for questions concerning problems using numbers which either cannot be exactly solved, or where the exact solution may be much more difficult to acquire than by using numerical methods.

This tag is for questions concerning problems using numbers which either cannot be exactly solved, or where the exact solution may be much more difficult to acquire than by using numerical methods.

It includes questions about algorithms, precision and accuracy of underlying numbers, advantages and disadvantages of several methods, error propagation, problems with the underlying numbers and data structures.

2593 questions
11
votes
3 answers

How to get numeric keypad arrows working with java applications on Linux

The arrow keys on the numeric keypad do not work with Java applications on Linux. Strangely enough, the Home, End, PgUp, PgDn, Ins, Del all work. This is especially annoying when using Intellij for programming. How do you get the arrow keys…
Peter L
  • 2,921
  • 1
  • 29
  • 31
11
votes
1 answer

Quickly and efficiently calculating an eigenvector for known eigenvalue

Short version of my question: What would be the optimal way of calculating an eigenvector for a matrix A, if we already know the eigenvalue belonging to the eigenvector? Longer explanation: I have a large stochastic matrix A which, because it is…
5xum
  • 5,250
  • 8
  • 36
  • 56
11
votes
7 answers

PHP: Is_numeric returns false on 0

Is_numeric() as well as is_int() returns false if the value is 0. What can i do instead to verify that a specific value is numbers only in PHP? Are we heading straight for the Regular Expressions camp, or are there some nice, handy feature for this…
Industrial
  • 41,400
  • 69
  • 194
  • 289
11
votes
1 answer

How to select integer values only from a varchar column in PostgreSQL

How to select integer values only from a varchar column in PostgreSQL? If the column contains: abc 70 3g 71 1.5 I'd like to select only: 70 71 I'm struggling to find functions like: is_numeric, is_integer, to do something like this: SELECT…
Tom
  • 233
  • 1
  • 2
  • 8
11
votes
2 answers

Number values include comma -- how do I make these numeric?

I have a whole column of numbers that include comma separators at the thousands. When I try to create a numeric column out of them, anything over 999 becomes NA. I used cbind: df <- cbind(df, var2 = as.numeric(as.character(df$var1))) and wound up…
Amanda
  • 12,099
  • 17
  • 63
  • 91
11
votes
4 answers

Encoding a numeric string into a shortened alphanumeric string, and back again

Quick question. I'm trying to find or write an encoder in Python to shorten a string of numbers by using upper and lower case letters. The numeric strings look something like…
Ryan Martin
  • 1,613
  • 3
  • 24
  • 36
10
votes
4 answers

Converting time format to numeric with R

In most cases, we convert numeric time to POSIXct format using R. However, if we want to compare two time points, then we would prefer the numeric time format. For example, I have a date format like "2001-03-13 10:31:00", begin <- "2001-03-13…
Frank Wang
  • 1,462
  • 3
  • 17
  • 39
10
votes
3 answers

IsNumeric returns true for strings containing a D character

I had a strange error in a VB6 app this morning and it all stems from the fact that IsNumeric is not working as I expected. Can someone shed some light on why? To me this seems like a bug. This code displays 4.15877E+62 in a message box: Dim…
Matt Wilko
  • 26,994
  • 10
  • 93
  • 143
10
votes
4 answers

How do I check and handle numbers very close to zero

I have some math (in C++) which seems to be generating some very small, near zero, numbers (I suspect the trig function calls are my real problem), but I'd like to detect these cases so that I can study them in more detail. I'm currently trying out…
Petriborg
  • 2,940
  • 3
  • 28
  • 49
10
votes
1 answer

Make JSpinner completely numeric

I've a Jspinner that can vary from minimum to maximum at steps of 0.1. This is working perfectly fine. Now, I set the editor of JSpinner as NumberEditor as the user can edit the textbox and I want only numeric values from this. This is also working,…
Balanivash
  • 6,709
  • 9
  • 32
  • 48
10
votes
4 answers

How to check if a string is numeric Julia

Been scouring the internet trying to figure this out. Tried isnumeric, but that only works for an AbstractChar. I'd prefer not having to use tryparse if possible, but if that's the only solution so be it... If it is, why hasn't a function for…
Masterfoxify
  • 103
  • 1
  • 6
10
votes
4 answers

Pandas convert strings to numeric if possible; else keep string values

I have a Pandas Dataframe which has columns which look something like this: df: Column0 Column1 Column2 'MSC' '1' 'R2' 'MIS' 'Tuesday' '22' '13' 'Finance' 'Monday' So overall, in these columns are actual strings…
JanB
  • 179
  • 2
  • 2
  • 10
10
votes
3 answers

Double precision (64-bit) representation of numeric value in R (sign, exponent, significand)

R FAQ states that: The only numbers that can be represented exactly in R’s numeric type are integers and fractions whose denominator is a power of 2. All other numbers are internally rounded to (typically) 53 binary digits accuracy. R uses IEEE…
989
  • 12,579
  • 5
  • 31
  • 53
10
votes
4 answers

React Native Input component takes ony numeric values

In React-Native project, I have an Input component from Native Base and I want to this component to take only numeric values 0-9 and give this field default value, I looked for other questions about this issue, I do not know maybe those answers are…
Ali Zeynalov
  • 2,867
  • 8
  • 30
  • 54
10
votes
9 answers

How can I check if form input is numeric in PHP?

I need to be able to see if a form input in PHP is numeric. If it is not numeric, the website should redirect. I have tried is_numeric() but it does not seem to work. Code examples will be nice. I am developing a shopping cart that accepts an…
Travis