numeric

Numerically stable evaluation of sqrt(x+a) - sqrt(x)

别等时光非礼了梦想. 提交于 2020-01-03 12:58:52
问题 Is there an elegant way of numerically stable evaluating the following expression for the full parameter range x,a >= 0? f(x,a) = sqrt(x+a) - sqrt(x) Also is there any programming language or library that does provide this kind of function? If yes, under what name? I have no specific problem using the above expression right now, but encountered it many times in the past and always thought that this problem must have been solved before! 回答1: Yes, there is! Provided that at least one of x and a

ANDROID - Numeric keyboard

核能气质少年 提交于 2020-01-03 03:14:10
问题 Good afternoon. I have an EditText that may contain numbers and letters. By deploying the keyboard, is there any way to deploy it in numerical form?. If I put the EditText as numeric I do, but that's not my case. Thank you very much. 回答1: Try this: EditText myEditText = (EditText)findViewById(R.id.myEditText); myEditText.setInputType(InputType.TYPE_NUMBER_FLAG_DECIMAL); Then set it back to alphanumeric when you are done with numeric.. 回答2: You can: Hide/Show different EditTexts that have

Oracle Query - Get only strings in the select field

。_饼干妹妹 提交于 2020-01-02 19:20:12
问题 Maybe this sounds a little bit crazy, but I need to come up with a query to retrieve only letters out of an alphanumeric field. For example: TABLE 1234ADD 3901AC 1812OPA 82711AUU RESULTS EXPECTED ADD AC OPA AUU Thank you! 回答1: Looks like you only want to remove numbers. You can use REGEXP_REPLACE for that in 10g or 11g: SELECT REGEXP_REPLACE( your_column, '[0-9]*', '' ) FROM your_table; 回答2: SELECT REGEXP_REPLACE('1234ADD 3901AC 1812OPA 82711AUU', '[0-9]', '') FROM dual 回答3: Try SELECT

How can I round up to the nearest multiple of the specified number?

一世执手 提交于 2020-01-02 07:06:26
问题 I've looked at many questions regarding rounding up to the nearest multiple of a number, but I can't understand their methods well enough to adopt them for rounding up to 45 or they use language specific methods of other languages. Here is a bit more detailed explanation if the above doesn't make much sense yet: Example input: int num1 = 67; int num2 = 43; Expected results: >>round(num1) = 90 >>round(num2) = 45 回答1: It's enough to add the missing mod45 : int upperround45(int i) { int temp = i

The as.numeric function changes the values in my dataframe [duplicate]

五迷三道 提交于 2020-01-02 05:43:28
问题 This question already has answers here : How to convert a factor to integer\numeric without loss of information? (8 answers) Closed 5 years ago . I have a column containing speed measurements which I need to change to numeric so that I can use both the mean and sum functions. However, when I do convert them the values change substantially. Why is this? This is what my data look like at first: And here is the structure of the data frame: 'data.frame': 1899571 obs. of 20 variables: $ pcd :

When to use DBL_EPSILON/epsilon

匆匆过客 提交于 2020-01-02 05:30:51
问题 The DBL_EPSILON/std::numeric_limits::epsilon will give me the smallest value that will make a difference when adding with one. I'm having trouble understanding how to apply this knowledge into something useful. The epsilon is much larger than the smallest value the computer can handle, so It would seem like a correct assumption that its safe to use smaller values than epsilon? Should the ratio between the values I'm working with be smaller than 1/epsilon ? 回答1: The definition of DBL_EPSILON

Java, Weka: How to predict numeric attribute?

孤人 提交于 2020-01-01 09:57:14
问题 I was trying to use NaiveBayesUpdateable classifier from Weka. My data contains both nominal and numeric attributes: @relation cars @attribute country {FR, UK, ...} @attribute city {London, Paris, ...} @attribute car_make {Toyota, BMW, ...} @attribute price numeric %% car price @attribute sales numeric %% number of cars sold I need to predict the number of sales (numeric!) based on other attributes. I understand that I can not use numeric attribute for Bayes classification in Weka. One

javascript (jquery) numeric input: keyCode for '3' and '#' are the same

狂风中的少年 提交于 2019-12-30 17:30:56
问题 I need to set up an <input type="text" /> so that it will accept only numeric chars, backspace, delete, enter, tabs and arrows. There's a lot of exemple around there, i started with something similar to this: function isNumericKeyCode (keyCode){ return ( (keyCode >= 48 && keyCode <= 57) //standard keyboard ||(keyCode >= 96 && keyCode <= 105)) //Numpad } $('#myTextBox').keydown(function(e){ var handled = true; var keyCode = e.keyCode; switch(keyCode){ //Enter and arrows case 13: case 37: case

How to convert String variable to int in javascript?

末鹿安然 提交于 2019-12-30 10:45:13
问题 What is the correct way to convert value of String variable to int/numeric variable? Why is bcInt still string and why does isNaN return true ? bc=localStorage.getItem('bc'); var bcInt=parseInt(bc,10); var bcInt2=1; console.log("bc------------>" +bc +" isNaN:" +isNaN(bc)); //isNaN returns true console.log("bcInt------------>" +bcInt +" isNaN:" +isNaN(bcInt)); //isNaN returns true bcInt2// isNaN returns false 回答1: parseInt returns a number only if you pass it a number as first character.

ColdFusion 9: int and type=“numeric” nasty bug?

旧时模样 提交于 2019-12-30 07:39:16
问题 I've just experienced a behaviour that defies any logic and could potentially lead to serious issues and was wondering if it was a bug or if the behaviour was itended and what are the best practices to circumvent the issue? If it's a bug, is there a patch? Here's the two wierd behaviours that when put together are a threat to any system's data integrity. int('1 2') -> 41276 isValid('numeric', '1 2') -> true Why? Well let's see... <cffunction name="deleteSomething" access="public" returntype=