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
28
votes
11 answers

Finding rows that don't contain numeric data in Oracle

I am trying to locate some problematic records in a very large Oracle table. The column should contain all numeric data even though it is a varchar2 column. I need to find the records which don't contain numeric data (The to_number(col_name)…
Ben
  • 2,058
  • 9
  • 29
  • 39
28
votes
2 answers

Is Java-8's DoubleStream.sum() method stable when run in parallel?

I'm curious about the following construct in Java 8: double[] doubles = //... double sum = DoubleStream.of(doubles).parallel().sum(); To cut to the chase: Will the value of sum always be the same, e.g. when run on different computers? More…
Luke Usherwood
  • 3,082
  • 1
  • 28
  • 35
28
votes
3 answers

Replacing commas and dots in R

I have a whole column of numbers that include dot separators at the thousands and comma instead of dot as an dismal separator. When I try to create a numeric column out of them, I lose all data. var1 <- c("50,0", "72,0", "960,0", "1.920,0", "50,0",…
Nils Olve
  • 287
  • 1
  • 4
  • 6
28
votes
6 answers

Keep only numeric value from a string?

I have some strings like this string phoneNumber = "(914) 395-1430"; I would like to strip out the parethenses and the dash, in other word just keep the numeric values. So the output could look like this 9143951430 How do I get the desired output…
meda
  • 45,103
  • 14
  • 92
  • 122
28
votes
6 answers

What is the radix parameter in Java, and how does it work?

I understand that radix for the function Integer.parseInt() is the base to convert the string into. Shouldn't 11 base 10 converted with a radix/base 16 be a B instead of 17? The following code prints 17 according to the textbook: public class Test…
Minh Tran
  • 783
  • 1
  • 9
  • 20
27
votes
6 answers

SQL Server : error converting data type varchar to numeric

I have a table: Account_Code | Desc 503100 | account xxx 503103 | account xxx 503104 | account xxx 503102A | account xxx 503110B | account xxx Where Account_Code is a varchar. When I create a query below: Select …
user1947840
  • 271
  • 1
  • 3
  • 4
26
votes
2 answers

What's the difference between std::partial_sum and std::inclusive_scan?

While reading about std::inclusive_scan, there does not appear to be any examples. It strikes me as very similar to std::partial_sum. partial_sum: template< class InputIt, class OutputIt > OutputIt partial_sum( InputIt first, …
Trevor Hickey
  • 36,288
  • 32
  • 162
  • 271
26
votes
4 answers

Convert currency with commas into numeric

I have a column in a dataframe as follows: COL1 $54,345 $65,231 $76,234 How do I convert it into this: COL1 54345 65231 76234 The way I tried it at first was: df$COL1<-as.numeric(as.character(df$COL1)) That didn't work because it said NA's were…
Nick
  • 833
  • 2
  • 8
  • 11
25
votes
2 answers

How to convert Varchar to Double in sql?

I have problem with my query when I was trying to convert the varchar field to double (numeric). I have this sql statement: SELECT fullName, CAST(totalBal as numeric(9,2) FROM client_info ORDER BY totalBal DESC Actually I want to display the values…
Jay Marz
  • 1,861
  • 10
  • 34
  • 54
24
votes
5 answers

Negative numbers are stored as 2's complement in memory, how does the CPU know if it's negative or positive?

-1 can be represented in 4 bit binary as (2's complement) 1111 15 is also represented as 1111. So, how does CPU differentiate between 15 and -1 when it gets values from memory?
MCG
  • 1,011
  • 1
  • 10
  • 21
22
votes
8 answers

How do I construct a std::string from a DWORD?

I have following code: Tools::Logger.Log(string(GetLastError()), Error); GetLastError() returns a DWORD a numeric value, but the constructor of std::string doesn't accept a DWORD. What can I do?
Weidling Christopd
22
votes
3 answers

How to make input field type both numeric and password?

I'm aware of this: and I'm aware of this: But I would like to use both. I want the numeric keypad to come up on iOS (specifically) but hide each character after it's typed. Is something like this…
kaleazy
  • 5,922
  • 2
  • 47
  • 51
22
votes
4 answers

How to convert time (mm:ss) to decimal form in R

I've imported a csv-file to R using RStudio where I am trying to plot points per game against minutes per game. However the minutes per game is in the format mm:ss and I'm having a hard time finding how to convert it to decimal form. Please help!
Joe
  • 983
  • 2
  • 7
  • 6
22
votes
3 answers

Checking for a numerical index in a javascript array

I'm receiving json data that is aggregated by numerical indexes. When I'm in my forloop, for example, the index might start at 1, which means in my forloop an error would occur because 0 doesnt exist. How do I check if a numerical index exists in…
somejkuser
  • 8,856
  • 20
  • 64
  • 130
22
votes
3 answers

Casting between number types in golang

Could someone please tell me if go supports automatic casting of numeric types. Right now I have to manually convert the results of all my computation to int or int64 and keep track of what numeric type I am using.
cobie
  • 7,023
  • 11
  • 38
  • 60