Search Results

Search found 382 results on 16 pages for 'numerical'.

Page 11/16 | < Previous Page | 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • erroneous Visual C float / double conversion?

    - by RED SOFT ADAIR
    In Visual C++ i wrote the following sample in a C++ program: float f1 = 42.48f; double d1 = 42.48; double d2 = f1; I compiled the program with Visual Studio 2005. In the debugger i see the following values: f1 42.480000 float d1 42.479999999999997 double d2 42.479999542236328 double d1 by my knowledege is OK, but d2 is wrong. The problem occurs as well with /fp=precise as with /fp=strict as with /fp=fast. Whats the problem here? Any hint how to avoid this Problem? This leads to serious numerical problems.

    Read the article

  • Mapping words to numbers with respect to definition

    - by thornate
    As part of a larger project, I need to read in text and represent each word as a number. For example, if the program reads in "Every good boy deserves fruit", then I would get a table that converts 'every' to '1742', 'good' to '977513', etc. Now, obviously I can just use a hashing algorithm to get these numbers. However, it would be more useful if words with similar meanings had numerical values close to each other, so that 'good' becomes '6827' and 'great' becomes '6835', etc. As another option, instead of a simple integer representing each number, it would be even better to have a vector made up of multiple numbers, eg (lexical_category, tense, classification, specific_word) where lexical_category is noun/verb/adjective/etc, tense is future/past/present, classification defines a wide set of general topics and specific_word is much the same as described in the previous paragraph. Does any such an algorithm exist? If not, can you give me any tips on how to get started on developing one myself? I code in C++.

    Read the article

  • Is there any way to modify a column before it is ordered in MySQL?

    - by George Edison
    I have a table with a field value which is a varchar(255). The contents of the field can be quite varied: $1.20 $2994 $56 + tax (This one can be ignored or truncated to $56 if necessary) I have a query constructed: SELECT value FROM unnamed_table ORDER BY value However, this of course uses ASCII string comparison to order the results and does not use any numerical type of comparison. Is there a way to truly order by value without changing the field type to DECIMAL or something else? In other words, can the value field be modified ('$' removed, value converted to decimal) on the fly before the results are sorted?

    Read the article

  • Getting specific values with regex [JAVA, ANDROID]

    - by David
    I need to knowingly isolate each row of the vcard and get its value. For instance, I want to get "5555" from X-CUSTOMFIELD. So far, my thoughts are: "X-CUSTOMFIELD;\d+" I have been looking at some tutorials and I am a little confused with what function to use? What would my regex above return? Would it give me the whole line or just the numerical part (5555)? I was thinking I i get the whole row, I can use substring to get the digits? BEGIN:VCARD VERSION:2.1 N:Last;First; FN:First Last TEL;HOME;VOICE:111111 TEL;MOBILE;VOICE:222222 X-CUSTOMFIELD;5555 END:VCARD

    Read the article

  • Assigned numbers to movie clip to plug in formula... not working

    - by Matthew MlgPro Harding
    So I am attempting to vertically evenly space these movie clips so I came up with a math formula involving n( the button number) but Its not working. var buttonArray:Array = [ side_banner.btn1, side_banner.btn2, side_banner.btn3, side_banner.btn4]; var buttonCount:uint = buttonArray.length; for (var i:uint=0; i< buttonCount; i++) { buttonArray[i].addEventListener(MouseEvent.CLICK, outputNumber); buttonArray[i].theTrigger = [i + 1]; } function outputNumber(e:MouseEvent):void { trace( e.target.theTrigger); buttonArray[i].y = (((stage.stageHeight - 400)/4)*(e.target.theTrigger)) - ((stage.stageHeight - 400)/4)/2 } But apparently each movie clip doesn't actually have a numerical value just a numeric name... how can I get the "n" btn number to use my formula? Thanks

    Read the article

  • Mapping multiple keys to the same value in a Javascript hash

    - by Bears will eat you
    I use a Javascript hash object to store a set of numerical counters, set up like this [this is greatly simplified]: var myHash = { A: 0, B: 0, C: 0 }; Is there a way to make other keys, ones not explicitly in myHash, map to keys that are? For instance, I'd like [again, this is simplified]: myHash['A_prime']++; // or myHash.A_prime++; to be exactly equivalent to myHash['A']++; // or myHash.A++; e.g. incrementing the value found at the key A, not A_prime.

    Read the article

  • Find model records by ID in the order the array of IDs were given

    - by defaye
    I have a query to get the IDs of people in a particular order, say: ids = [1, 3, 5, 9, 6, 2] I then want to fetch those people by Person.find(ids) But they are always fetched in numerical order, I know this by performing: people = Person.find(ids).map(&:id) => [1, 2, 3, 5, 6, 9] How can I run this query so that the order is the same as the order of the ids array? I made this task more difficult as I wanted to only perform the query to fetch people once, from the IDs given. So, performing multiple queries is out of the question. I tried something like: ids.each do |i| person = people.where('id = ?', i) But I don't think this works.

    Read the article

  • What is it about Fibonacci numbers?

    - by Ian Bishop
    Fibonacci numbers have become a popular introduction to recursion for Computer Science students and there's a strong argument that they persist within nature. For these reasons, many of us are familiar with them. They also exist within Computer Science elsewhere too; in surprisingly efficient data structures and algorithms based upon the sequence. There are two main examples that come to mind: Fibonacci heaps which have better amortized running time than binomial heaps. Fibonacci search which shares O(log N) running time with binary search on an ordered array. Is there some special property of these numbers that gives them an advantage over other numerical sequences? Is it a density quality? What other possible applications could they have? It seems strange to me as there are many natural number sequences that occur in other recursive problems, but I've never seen a Catalan heap.

    Read the article

  • Sorting a list of variable length integers delimited by decimal points...

    - by brewerdc
    Hey guys, I'm in need of some help. I have a list of delimited integer values that I need to sort. An example: Typical (alpha?) sort: 1.1.32.22 11.2.4 2.1.3.4 2.11.23.1.2 2.3.7 3.12.3.5 Correct (numerical) sort: 1.1.32.22 2.1.3.4 2.3.7 2.11.23.1.2 3.12.3.5 11.2.4 I'm having trouble figuring out how to setup the algorithm to do such a sort with n number of decimal delimiters and m number of integer fields. Any ideas? This has to have been done before. Let me know if you need more information. Thanks a bunch! -Daniel

    Read the article

  • MySQL load data null values

    - by SP1
    Hello, I have a file that can contain from 3 to 4 columns of numerical values which are separated by comma. Empty fields are defined with the exception when they are at the end of the row: 1,2,3,4,5 1,2,3,,5 1,2,3 The following table was created in MySQL: +-------+--------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+--------+------+-----+---------+-------+ | one | int(1) | YES | | NULL | | | two | int(1) | YES | | NULL | | | three | int(1) | YES | | NULL | | | four | int(1) | YES | | NULL | | | five | int(1) | YES | | NULL | | +-------+--------+------+-----+---------+-------+ I am trying to load the data using MySQL LOAD command: load data infile '/tmp/testdata.txt' into table moo fields terminated by "," lines terminated by "\n"; The resulting table: +------+------+-------+------+------+ | one | two | three | four | five | +------+------+-------+------+------+ | 1 | 2 | 3 | 4 | 5 | | 1 | 2 | 3 | 0 | 0 | | 1 | 2 | 3 | NULL | NULL | +------+------+-------+------+------+ The problem lies with the fact that when a field is empty in the raw data and is not defined, MySQL for some reason does not use the columns default value (which is NULL) and uses zero. NULL is used correctly when the field is missing alltogether. Unfortunately, I have to be able to distinguish between NULL and 0 at this stage so any help would be appreciated. Thanks S.

    Read the article

  • Can i have a negative value as constant expression in Scala?

    - by Klinke
    I have an Java-Annotation that return a double value: @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public @interface DoubleValue { double value(); } When i try to attach the annotation to a field in a scala class and the value is negativ like here: class Test { @DoubleValue(-0.05) var a = _ } i get an compiler error with the message: "annotation argument needs to be a constant; found: 0.05.unary_-". I understood that i need a numerical literal and i looked into the Scala Language Specification and it seems, that the - sign is only used for the exponent but not for the mantissa. Does someone has an idea how i can have a negative value as runtime information using annotations? Thanks, Klinke

    Read the article

  • Should I bundle C libraries with my Python application?

    - by oceanhug
    If I have a Python package that depends on some C libraries (like say the Gnu Scientific Library (GSL) for numerical computations), is it a good idea to bundle the library with my code? I'd like to make my package as easy to install as possible for users and I don't want them to have to download C libraries by hand and supply include-paths. Also I could always ensure that the version of the library that I ship is compatible with my code. However, is it possible that there are clashes if the user has the library installed already, or ar there any other reasons why I shouldn't do this? I know that I can make it easier for users by just providing a binary distribution, but I'd like to avoid having to maintain binary distributions for all possible OSs. So, I'd like to stick to a source distribution, but for the user (who proudly owns a C compiler) installation should be as easy as python setup.py install.

    Read the article

  • Javascript array length incorrect on array of objects

    - by Serenti
    Could someone explain this (strange) behavior? Why is the length in the first example 3 and not 2, and most importantly, why is the length in the second example 0? As long as the keys are numerical, length works. When they are not, length is 0. How can I get the correct length from the second example? Thank you. a = []; a["1"] = {"string1":"string","string2":"string"}; a["2"] = {"string1":"string","string2":"string"}; alert(a.length); // returns 3 b = []; b["key1"] = {"string1":"string","string2":"string"}; b["key2"] = {"string1":"string","string2":"string"}; alert(b.length); // returns 0

    Read the article

  • Remove adjacent identical elements in a Ruby Array?

    - by Mike Woodhouse
    Ruby 1.8.6 I have an array containing numerical values. I want to reduce it such that sequences of the same value are reduced to a single instance of that value. So I want a = [1, 1, 1, 2, 2, 3, 3, 3, 3, 2, 2, 2, 3, 3, 3] to reduce to [1, 2, 3, 2, 3] As you can see, Array#uniq won't work in this case. I have the following, which works: (a.size - 1).downto(1) { |i| a[i] = nil if a[i - 1] == a[i] } Can anyone come up with something less ugly?

    Read the article

  • Use JS to add characters into textfield

    - by Thomas
    I want to add a $ symbol before a users entry into a text field without actually submitting the $ when the user clicks submit. Additionally, I need to prohibit the user from entering anything but numerical values in to the text input. I know about the JQuery input mask (http://www.conetrees.com/2009/03/blog/jquery-masked-input-plugin-increase-usability-for-masked-format-input-fields) but this plugin requires you to set the exact number of digits/letters that the user is supposed to enter, which is no good for my current project. Can anyone think of a way to accomplish what I have described above?

    Read the article

  • Ignore route with a specific parameter

    - by Vivien
    Hello, I have an @url.Action in which I pass a parameter to the action. When the parameter is null, I would like to just do nothing and stay on the same page. What I have done is the following: routes.MapRoute( null, "Test/View/{Id}", new { controller = "Test", action = "View" }, new { Id = @"\d+" } //id must be numerical ); routes.IgnoreRoute("Test/View/{*pathInfo}"); The action is not executed but my problem is that I get this: Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly. Requested URL: /Test/View Which I obvisouly do not want to see. Thanks for your help.

    Read the article

  • MATLAB: Automatic detection of relations between workspace variables through functions

    - by Peterstone
    Hi all, I´m trying to write a function what detect this relation between the variables I have got in the workspace: v1 - fft(v2) = 0 Where v1, v2 are variables of my workspace. Sometimes I need to know which variables have a certain numerical relation. If I have thirty, I don´t want to be looking for this relation in "manual way", just itroducing a sentence for each pair of different variables. I would like a function in which I introuce (or I modify this function every time I need it) the sentence (for instance what I wrote before) and the function show me the pair of variables a I am looking for. Does anyone know how to do it? Thank you so much!

    Read the article

  • C++ domain specific embedded language operators

    - by aaa
    hi. In numerical oriented languages (Matlab, Fortran) range operator and semantics is very handy when working with multidimensional data. For example: A(i:j,k,:n) // represents two-dimensional slice B(i:j,0:n) of A at index k unfortunately C++ does not have range operator (:). of course it can be emulated using range/slice functor, but semantics is less clean than Matlab. I am prototyping matrix/tensor domain language in C++ and am wondering if there any options to reproduce range operator. I still would like to rely on C++/prprocessor framework exclusively. So far I have looked through boost wave which might be an suitable option. is there any other means to introduce new operators to C++ DSL?

    Read the article

  • How can I plot a time series graph with Perl?

    - by Jazz
    I have some data from a database (SQLite), mapping a value (an integer) to a date. A date is a string with this format: YYYY-MM-DD hh:mm. The dates are not uniformly distributed. I want do draw a line graph with the dates on X and the values on Y. What is the easiest way to do this with Perl? I tried DBIx::Chart but I could not make it recognize my dates. I also tried GD::Graph, but as the documentation says: GD::Graph does not support numerical x axis the way it should. Data for X axes should be equally spaced

    Read the article

  • Excel - check if row contains ANY value *more than once*

    - by user2536778
    I am doing data analysis and sometimes I need to check and to make sure each row in excel does not have any repeated value. I hope that there is a formula where each time if there's a repeated value in the same row, the value will be highlighted and it doesn't matter what value it is, as long as it's repeated in the same row. I try to search it everywhere but the closest I can find is below question & answer ( which couldn't apply to me as I need a formula that can highlight any value that's repeated and not only zero): I have rows which contain grades for students (numerical values), where the number 0 means they missed a class. I want the row to be highlighted in one color if they have "0" 3 or 4 times, and in another color if they have "0" 5 times or more. =COUNTIF(1:1,0)=5 Anyone can help me? Thanks in advance!

    Read the article

  • Mean of Sampleset and powered Sampleset

    - by Milla Well
    I am working on an ICA implementation wich is based on the assumption, that all source signals are independent. So I checked on the basic concepts of Dependence vs. Correlation and tried to show this example on sample data from numpy import * from numpy.random import * k = 1000 s = 10000 mn = 0 mnPow = 0 for i in arange(1,k): a = randn(s) a = a-mean(a) mn = mn + mean(a) mnPow = mnPow + mean(a**3) print "Mean X: ", mn/k print "Mean X^3: ", mnPow/k But I couldn't produce the last step of this example E(X^3) = 0: >> Mean X: -1.11174580826e-18 >> Mean X^3: -0.00125229267144 First value I would consider to be zero, but second value is too large, isn't it? Since I subtract the mean of a, I expected the mean of a^3 to be zero as well. Does the problem lie in the random number generator, the precision of the numerical values in my misunderstanding of the concepts of mean and expected value?

    Read the article

  • Using JavaScript to render HTML; nothing appearing but values will alert

    - by Jack Roscoe
    Hi, I'm taking some information from some variables I have already defined outside this function to create a html svg text box. Here is the function which is causing me trouble: RenderTextBox:function() { alert('this.x: ' + this.x); alert('this.y: ' + this.y); this.textBox = paper.text(this.x, this.y, this.htmlTextBox); } The alerts works prefectly, and prompt me with the values expected. However, the final line which is supposed to create the text box puts them nowhere to be seen. Does anybody know why? If I replace 'this.x, this.y..' with numerical values in the final line of the function, the text box is placed correctly. It's only when I use the 'this.x' and 'this.y' that I have issues.

    Read the article

  • How do I add a Marker to a jQuery UI Slider?

    - by Bijan
    I have a simple jQuery UI slider that has a numerical range from 25 to 35. It works fine and the default value is 28. I'm hoping to add a simple tick mark to the slider to indicate that 28 is where the default is. Is there a simple way to add an indicator? $('#cycle_length').slider({ range: "min", value: 28, min: 25, max: 35, step: 1, slide: function( event, ui ) { $( "#amount" ).val( ui.value ); } }); $( "#amount" ).val( $( "#cycle_length" ).slider( "value" ) );

    Read the article

  • Getting specific values with regex

    - by David
    I need to knowingly isolate each row of the vCard and get its value. For instance, I want to get "5555" from X-CUSTOMFIELD. So far, my thoughts are: "X-CUSTOMFIELD;\d+" I have been looking at some tutorials and I am a little confused with what function to use? What would my regex above return? Would it give me the whole line or just the numerical part (5555)? I was thinking I i get the whole row, I can use substring to get the digits? BEGIN:VCARD VERSION:2.1 N:Last;First; FN:First Last TEL;HOME;VOICE:111111 TEL;MOBILE;VOICE:222222 X-CUSTOMFIELD;5555 END:VCARD

    Read the article

  • Write the longest possible loop.

    - by Abhay
    Hello Group, Recently I was asked this question in a technical discussion. What is the longest possible loop that can be written in a programming language? This loop has to be as long as possible and yet not an infinite loop and should not end-up crashing the program (Recursion etc...) I honestly did not know how to attack this problem, so I asked him if is it practically possible. He said using some computer science concepts, you can arrive at a hypothetical number which may not be practical but nevertheless it will still not be infinite. Anyone here; knows how to analyse / attack this problem. P.S. Choosing some highest limit for a type that can store the highest numerical value is apparently not an answer. Thanks in advance,

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16  | Next Page >