FAQ Database Discussion Community


PostgreSQL - get all integer digits from double precision field for use in to_char function

postgresql,double,precision,numeric,to-char
As stated in the documentation of Postgres 9.0 the double precision data type has a precision of 15 decimal digits and a storage of 8 bytes, then an integer number larger than a normal bigint (8 bytes) stored in a double precision field is approximated. Correct me if I'm wrong,...

How to create a numeric triangle with user input in python?

python,numeric
I have to answer this question: Write a Python function triangle(n) that takes an integer argument n and print a numeric triangle of n layers as shown in the following examples. Test your answer the arguments: 1, 2, 5, 9 and 14. triangle(7) 1 12 123 1234 12345 123456 1234567...

Why is it Called iota? [duplicate]

c++,c++11,range,numeric,iota
This question already has an answer here: What does iota of std::iota stand for? 3 answers C++11 introduced a function called iota. Which "Assigns to every element in the range [first,last) successive values of val, as if incremented with ++val after each element is written." Can someone explain what...

Regain an original fractional numeric value that Excel has transformed to a date value

excel,date,formatting,numeric
I have an Excel workbook that contains numeric values and some of them have been transformed by Excel auto format feature into the date values. I do not know the original numeric values and neither do I have access to the .txt version of that file. Is there a way...

How to tell if a value is not numeric in Oracle?

sql,oracle,numeric
I have the following code that returns an error message if it is an invalid value. I would like give the same message if the value given is not numeric. IF(option_id = 0021) THEN IF((value<10000) or (value>7200000))THEN ip_msg(6214,option_name); return; END IF; END IF; In SQL Server, I used ISNUMERIC(). I...

Sort numerical only part of the file bash

bash,sorting,numeric
my input file is: b; 1 ; b; 1 a; 5 ; a; 5 g; 2 ; g; 2 i would like an output: b; 1 ; b; 1 a; 5 ; g; 2 g; 2 ; a; 5 Can somebody help me with this?...

How To Check Value Of String

javascript,css,string,numeric
<span id='amount'>0.00000000</span> <a class='button-withdraw' id='tombolco' href='#'>Checkout</a> <script> var amount = document.getElementById("amount").innerHTML; if (amount >= 0.001) { document.GetElementById("tombolco").style = "display:block"; } else { document.GetElementById("tombolco").style = "display:none"; } </script> Why my code doesn't work? What's wrong with it and how to solve it?...

Convert character longitude/lattitude into numeric

r,character,numeric
I have a dataset in R called Test with longitude latitude coordinates that now have the following format after having called str(Test): $ lat : chr "513.035.763.793.677" $ lon : chr "33.941.883.804.984" i would like to turn these into correct lon - lat coordinates. The following doens't work: as.numeric(Test$lat) as.numeric(gsub(".",...

Dealing with plus and minus signs in regexpr in R

regex,r,string,character,numeric
I would like to include the the minus or plus sign when extracting numeric data from a character string. The number is 8.81e+001. Using the following code I can get the e, but not the + and subsequent numbers. wg_co2 <- all_data[wg_co2 <- grep("Carbon Dioxide",all_data)] [3] wg_co2 <-regmatches(wg_co2, regexpr("[0-9]{1,9}.[e-e0-9]{1,9}",wg_co2)) wg_co2...

non linear least square fitting with the variable as the integration limit

python,physics,numeric,curve-fitting
I'm trying to make some non-linear fittings with python which involve an integral, and the limits of the integral depends on the independent variable. The code is the following: import numpy as np import scipy as sc import matplotlib.pyplot as plt from scipy.optimize import curve_fit from scipy.integrate import quad T,M=np.genfromtxt("zfc.txt",...

how to convert a factor variable into a numeric - using R

r,variables,numeric,data-type-conversion,recode
I have another problem and hope for your help. I googled already, asked a friend and tried to understand similar problems/questions around this website, but I still can't figure it out... Ok so here's my problem: I have a large data set that covers data from 1980-2012. I used the...

PHP function to determine if a variable is a number(not hex or other numericals that have letters in them)

php,double,numeric
is there a php function other than is_numeric that determines if a variable is a number(not hex). Because i a need to verify if a variable is a number/decimal, no hex or other type of numericals that have letters in them.

How to Quickly save/load 200,000 of double type into memory using iOS?

ios,memory,game-engine,numeric
I tried to use NSKeyedArchiver to save/load numerical data which has 200,000 of doubles. It took around 160 secs to save, and 1900 secs to load. When I changed to use Core Data, it is even slower. I couldn't find un-keyed archiver in iOS however. The code is like below:...

What is the risk of numerical instabilities when predividing denominators?

c,numeric,ieee-754
Supposing I want to divide one number into many. a /= x; b /= x; c /= x; ... Since multiplication is faster, the temptation is to do this tmp = 1.0f / x; a *= tmp; b *= tmp; c *= tmp; ... 1) Is this guaranteed to produce...

Valid batch file variable names?

file,variables,batch-file,numbers,numeric
I have the following problem with batch files. I simplify the problem below. Running the following batch file, foo.bat, returns word in standard out (in this case, command prompt window) instead of hey. foo.bat @SET 1word="hey" @ECHO %1word% However, executing echo %1word% from the command line returns hey. Is there...

Perl argument “user” isn't numeric in array element

arrays,perl,arguments,warnings,numeric
I always get the message that my argument in array isn't nummeric. It happens 5 times in this little code: my $mcnamequery = "SELECT mcID FROM tblMCName WHERE mcName = '".$mcname."'"; $mcid = dbSelect($mcnamequery); print $mcid->{mcID} . "\n"; my $userfsquery = "SELECT userFS FROM tblMcSubs WHERE mcFS = '".$mcid->{mcID}."'"; my...

How to handle a 32 digits numeric in Java and PostgreSQL?

java,postgresql,long-integer,numeric
I'm developing a little tool with JavaFX and a PostgreSQL-database. My task now is to handle a 32 digits numeric. I tried it with Long, but its to short / small. I remember that Postgres grumbled because I didn't use the correct datatype, that's why I'm asking here first, before...

What does illegal character in numeric field error concern for Cobol using Unix system?

average,numeric,cobol
How to solve the error: Execution error : file 'prog3.int' error code: 163, pc=177, call=1, seg=0 163 Illegal character in numeric field IDENTIFICATION DIVISION. PROGRAM-ID. prog3. ENVIRONMENT DIVISION. Input-output Section. File-Control. select input-file assign to "/home1/c/a/acsi203/realestate.dat". select output-file assign to "prog3out.dat" organization is line sequential. DATA DIVISION. File Section. FD...

Convert ID number into date format in oracle sql

sql,oracle,date,numeric
I have ID's stored into the ID column in table TEMP_SDR_RECEIVED which has value for example: 201505264865645884. The year,month and date is stored in this ID format in the first 8 numbers. I want to extract the year,month,date from this ID and want to set the minute,hour,seconds to 00:00:00 and...

Why do I have a decimal error when writing data to MS Access via Matlab?

matlab,ms-access,rounding,numeric
I write numeric data to MS Access tables. All the tables have the same numeric fields format (ie 'real simple', 'standard', 'auto'). I push numbers via Matlab in the tables and MS Access rounds numbers to the 1rst decimal and i can't modify it. Does someone know ? Screenshots there...

Convert a column of strings in data frame into numeric in R (not the usual kind)

r,string,vector,data.frame,numeric
So in R I have a column consisting of strings that look like something similar to this: "Peter","Paul","John","Melissa","Paul","Peter" ... And I want to convert these names to a numerical ID format, like this: 1,2,3,4,2,1 In other words - I want to create a numerical ID for the names where same...

Get categories from numeric vector

r,category,numeric
I have this numeric vector: vec <- 1:7 How can I transform it into 3 categories using these logical rules: if(vec >= 1 && vec < 4) then "category1" else if(vec >=4 && vec < 6) then "category2" else if(vec >= 6 && vec < 8) then "category3" The expected...