Search Results

Search found 175 results on 7 pages for 'nan t'.

Page 3/7 | < Previous Page | 1 2 3 4 5 6 7  | Next Page >

  • Why does casting a NaN to a long yeild a valid result?

    - by brainimus
    In the sample code below I am dividing by zero which when I step through it with the debugger the (dividend / divisor) yeilds an Infinity or NaN (if the divisor is zero). When I cast this result to a long I get a valid result, usually something like -9223372036854775808. Why is this cast valid? Why doesn't it stop executing (throw an exception for example) rather than assign an arbitrary value? double divisor = 0; double dividend = 7; long result = (long)(dividend / divisor);

    Read the article

  • Why does casting a NaN to a long yield a valid result?

    - by brainimus
    In the sample code below I am dividing by zero which when I step through it with the debugger the (dividend / divisor) yields an Infinity or NaN (if the divisor is zero). When I cast this result to a long I get a valid result, usually something like -9223372036854775808. Why is this cast valid? Why doesn't it stop executing (throw an exception for example) rather than assign an arbitrary value? double divisor = 0; double dividend = 7; long result = (long)(dividend / divisor);

    Read the article

  • How can my controls size be NaN when it is actually shown?

    - by Stian Karlsen
    I have a Grid which contains an Image in one of its columns. The image itself does not have any Width or Height set, but its size is correctly controlled through the ColumnDefinition set. From this I would assume that the image controller actually has a Width and Height set, but when I try to bind another element to its Width and Height it doesn't work. When debugging it turns out that the value of Image.Height and Image.Width are NaN. Why? <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="350"></ColumnDefinition> <ColumnDefinition Width="*"></ColumnDefinition> <ColumnDefinition Width="10"></ColumnDefinition> <ColumnDefinition Width="*"></ColumnDefinition> </Grid.ColumnDefinitions> <Grid Grid.Column="0" Margin="5"> <Image x:Name="_image" Source="image.jpg"></Image> </Grid> </Grid>

    Read the article

  • Is it possible to read infinity or NaN values using input streams?

    - by Drise
    I have some input to be read by a input filestream (for example): -365.269511 -0.356123 -Inf 0.000000 When I use std::ifstream mystream; to read from the file to some double d1 = -1, d2 = -1, d3 = -1, d4 = -1; (assume mystream has already been opened and the file is valid), mystream >> d1 >> d2 >> d3 >> d4; mystream is in the fail state. I would expect std::cout << d1 << " " << d2 << " " << d3 << " " << d4 << std::endl; to output -365.269511 -0.356123 -1 -1. I would want it to output -365.269511 -0.356123 -Inf 0 instead. This set of data was output using C++ streams. Why can't I do the reverse process (read in my output)? How can I get the functionality I seek? From MooingDuck: #include <iostream> #include <limits> using namespace std; int main() { double myd = std::numeric_limits<double>::infinity(); cout << myd << '\n'; cin >> myd; cout << cin.good() << ":" << myd << endl; return 0; } Input: inf Output: inf 0:inf See also: http://ideone.com/jVvei Also related to this problem is NaN parsing, even though I do not give examples for it.

    Read the article

  • numpy array mapping and take average

    - by user566653
    Dear all, I have three array value = np.array ([1, 3, 3, 5, 5, 7, 3]) index = np.array ([1, 1, 3, 3, 6, 6, 6]) data = np.array ([1, 2, 3, 4, 5, 6]) and want to take average for item of "value" by array "index", and assign a new array with value of "data", such as [2, nan, 4, nan, nan, 5] first value is the average of 1st and 2nd of "value" second value is nan because there is not any key in "index" third value is the average of 3rd and 4th of "value" ... Thanks for your help!!! Regards, Roy

    Read the article

  • How to correctly use DERIVE or COUNTER in munin plugins

    - by Johan
    I'm using munin to monitor my server. I've been able to write plugins for it, but only if the graph type is GAUGE. When I try COUNTER or DERIVE, no data is logged or graphed. The plugin i'm currently stuck on is for monitoring bandwidth usage, and is as follows: /etc/munin/plugins/bandwidth2 #!/bin/sh if [ "$1" = "config" ]; then echo 'graph_title Bandwidth Usage 2' echo 'graph_vlabel Bandwidth' echo 'graph_scale no' echo 'graph_category network' echo 'graph_info Bandwidth usage.' echo 'used.label Used' echo 'used.info Bandwidth used so far this month.' echo 'used.type DERIVE' echo 'used.min 0' echo 'remain.label Remaining' echo 'remain.info Bandwidth remaining this month.' echo 'remain.type DERIVE' echo 'remain.min 0' exit 0 fi cat /var/log/zen.log The contents of /var/log/zen.log are: used.value 61.3251953125 remain.value 20.0146484375 And the resulting database is: <!-- Round Robin Database Dump --><rrd> <version> 0003 </version> <step> 300 </step> <!-- Seconds --> <lastupdate> 1269936605 </lastupdate> <!-- 2010-03-30 09:10:05 BST --> <ds> <name> 42 </name> <type> DERIVE </type> <minimal_heartbeat> 600 </minimal_heartbeat> <min> 0.0000000000e+00 </min> <max> NaN </max> <!-- PDP Status --> <last_ds> 61.3251953125 </last_ds> <value> NaN </value> <unknown_sec> 5 </unknown_sec> </ds> <!-- Round Robin Archives --> <rra> <cf> AVERAGE </cf> <pdp_per_row> 1 </pdp_per_row> <!-- 300 seconds --> <params> <xff> 5.0000000000e-01 </xff> </params> <cdp_prep> <ds> <primary_value> NaN </primary_value> <secondary_value> NaN </secondary_value> <value> NaN </value> <unknown_datapoints> 0 </unknown_datapoints> </ds> </cdp_prep> <database> <!-- 2010-03-28 09:15:00 BST / 1269764100 --> <row><v> NaN </v></row> <!-- 2010-03-28 09:20:00 BST / 1269764400 --> <row><v> NaN </v></row> <!-- 2010-03-28 09:25:00 BST / 1269764700 --> <row><v> NaN </v></row> <snip> The value for last_ds is correct, it just doesn't seem to make it into the actual database. If I change DERIVE to GAUGE, it works as expected. munin-run bandwidth2 outputs the contents of /var/log/zen.log I've been all over the (sparse) docs for munin plugins, and can't find my mistake. Modifying an existing plugin didn't work for me either.

    Read the article

  • What is the best way to flag some elements in MATLAB? using NaN or Inf? or something else?

    - by Kamran Bigdely Shamloo
    As you may know, in many occasions, there is a need to flag some elements of a matrix. For example when we have weighted adjacency matrix, and our graph is not fully connected, we have to flag some elements to show that there is no edge between those nodes. The question is how to do that? Is it better to put NaN or Inf on that elements in the matrix? or something elese(such as -1)?

    Read the article

  • date renderer issue in extjs

    - by harsh
    Hi, I have a date renderer issue for a column. when browser language is in english the date is displayed in this format 09/14/2009 09:23 AM But when i change the browser language to german(or any other language except english) the date is not rendered it displays NAN/NAN/NAN 12:NAN PM Here is the code.. var dateRenderer = Ext.util.Format.dateRenderer('m/d/Y h:i A'); var colModel = new Ext.grid.ColumnModel([ { header: xppo.st('SDE_DATE_OCCURRED'), width: 75, sortable: true, dataIndex: 'DateOccurred', renderer: dateRenderer } ]); How can i render the date in other languages.Please help me with this issue. Thanks

    Read the article

  • P values in wilcox.test gone mad :(

    - by Error404
    I have a code that isn't doing what it should do. I am testing P value for a wilcox.test for a huge set of data. the code i am using is the following library(MASS) data1 <- read.csv("file1path.csv",header=T,sep=",") data2 <- read.csv("file2path.csv",header=T,sep=",") data3 <- read.csv("file3path.csv",header=T,sep=",") data4 <- read.csv("file4path.csv",header=T,sep=",") data1$K <- with(data1,{"N"}) data2$K <- with(data2,{"E"}) data3$K <- with(data3,{"M"}) data4$K <- with(data4,{"U"}) new=rbind(data1,data2,data3,data4) i=3 for (o in 1:4800){ x1 <- data1[,i] x2 <- data2[,i] x3 <- data3[,i] x4 <- data4[,i] wt12 <- wilcox.test(x1,x2, na.omit=TRUE) wt13 <- wilcox.test(x1,x3, na.omit=TRUE) wt14 <- wilcox.test(x1,x4, na.omit=TRUE) if (wt12$p.value=="NaN"){ print("This is wrong") } else if (wt12$p.value < 0.05){ print(wt12$p.value) mypath=file.path("C:", "all1-less-05", (paste("graph-data1-data2",names(data1[i]), ".pdf", sep="-"))) pdf(file=mypath) mytitle = paste("graph",names(data1[i])) boxplot(new[,i] ~ new$K, main = mytitle, names.arg=c("data1","data2","data3","data4")) dev.off() } if (wt13$p.value=="NaN"){ print("This is wrong") } else if (wt13$p.value < 0.05){ print(wt13$p.value) mypath=file.path("C:", "all2-less-05", (paste("graph-data1-data3",names(data1[i]), ".pdf", sep="-"))) pdf(file=mypath) mytitle = paste("graph",names(data1[i])) boxplot(new[,i] ~ new$K, main = mytitle, names.arg=c("data1","data2","data3","data4")) dev.off() } if (wt14$p.value=="NaN"){ print("This is wrong") } else if (wt14$p.value < 0.05){ print(wt14$p.value) mypath=file.path("C:", "all3-less-05", (paste("graph-data1-data4",names(data1[i]), ".pdf", sep="-"))) pdf(file=mypath) mytitle = paste("graph",names(data1[i])) boxplot(new[,i] ~ new$K, main = mytitle, names.arg=c("data1","data2","data3","data4")) dev.off() } i=i+1 } I am having 2 problems with this long command: 1- Without specifying a certain P value, the code gives me arouind 14,000 graphs, when specifying a p value less than 0.05 the number of graphs generated goes down to 9,0000. THE FIRST PROBLEM IS: Some P value are more than 0.05 and are still showing up! 2- I designed the program to give me a result of "This is wrong" when the Value of P is "NaN", I am getting results of "NaN" Here's a screenshot from the results do you know what the mistake i made with the command to get these errors? Thanks in advance

    Read the article

  • ubuntu i3wm freezes on login

    - by NaN
    I switched to the i3 window manager, which is quite nice, but I have a funny bug. If I reboot and set the wm to i3 (within the lightdb settings) the gui freezes after logging in (i can see the light-db background image and login-form and the i3status bar at the same time, but nothing reacts). To use the system like expected I have to use unity, log out and login (with i3) again. How can I debug this bug?

    Read the article

  • Why is Double.Parse so slow?

    - by alexhildyard
    I was recently investigating a bottleneck in one of my applications, which read a CSV file from disk using a TextReader a line at a time, split the tokens, called Double.Parse on each one, then shunted the results into an object list. I was surprised to find it was actually the Double.Parse which seemed to be taking up most of the time.Googling turned up this, which is a little unfocused in places but throws out some excellent ideas:It makes more sense to work with binary format directly, rather than coerce strings into doublesThere is a significant performance improvement in composing doubles directly from the byte stream via long intermediariesString.Split is inefficient on fixed length recordsIn fact it turned out that my problem was more insidious and also more mundane -- a simple case of bad data in, bad data out. Since I had been serialising my Doubles as strings, when I inadvertently divided by zero and produced a "NaN", this of course was serialised as well without error. And because I was reading in using Double.Parse, these "NaN" fields were also (correctly) populating real Double objects without error. The issue is that Double.Parse("NaN") is incredibly slow. In fact, it is of the order of 2000x slower than parsing a valid double. For example, the code below gave me results of 357ms to parse 1000 NaNs, versus 15ms to parse 100,000 valid doubles.            const int invalid_iterations = 1000;            const int valid_iterations = invalid_iterations * 100;            const string invalid_string = "NaN";            const string valid_string = "3.14159265";            DateTime start = DateTime.Now;                        for (int i = 0; i < invalid_iterations; i++)            {                double invalid_double = Double.Parse(invalid_string);            }            Console.WriteLine(String.Format("{0} iterations of invalid double, time taken (ms): {1}",                invalid_iterations,                ((TimeSpan)DateTime.Now.Subtract(start)).Milliseconds            ));            start = DateTime.Now;            for (int i = 0; i < valid_iterations; i++)            {                double valid_double = Double.Parse(valid_string);            }            Console.WriteLine(String.Format("{0} iterations of valid double, time taken (ms): {1}",                valid_iterations,                ((TimeSpan)DateTime.Now.Subtract(start)).Milliseconds            )); I think the moral is to look at the context -- specifically the data -- as well as the code itself. Once I had corrected my data, the performance of Double.Parse was perfectly acceptable, and while clearly it could have been improved, it was now sufficient to my needs.

    Read the article

  • express+jade: provided local variable is undefined in view (node.js + express + jade)

    - by Jake
    Hello. I'm implementing a webapp using node.js and express, using the jade template engine. Templates render fine, and can access helpers and dynamic helpers, but not local variables other than the "body" local variable, which is provided by express and is available and defined in my layout.jade. This is some of the code: app.set ('view engine', 'jade'); app.get ("/test", function (req, res) { res.render ('test', { locals: { name: "jake" } }); }); and this is test.jade: p hello =name when I remove the second line (referencing name), the template renders correctly, showing the word "hello" in the web page. When I include the =name, it throws a ReferenceError: 500 ReferenceError: Jade:2 NaN. 'p hello' NaN. '=name' name is not defined NaN. 'p hello' NaN. '=name' I believe I'm following the jade and express examples exactly with respect to local variables. Am I doing something wrong, or could this be a bug in express or jade?

    Read the article

  • Java: very slow tomcat and too big war file

    - by NaN
    I created some sort of RESTful API backend for a mobile app. It's written completely in Java using Jersey as Framework. At the moment no database is used, it's all in the memory, but this is no problem so far (it's only for prototyping purposes). I ordered the smallest package from digital ocean and installed tomcat7. All in all tomcat works, but I have three major problems: 1) It takes a long time until tomcat deploys the app: I deploy it per tomcat manager and it takes about 2 minutes unit the site works (excl. war upload time). 2) The war files are quite big (16MB): I don't know why they are so big. There are no database dependencies and most logic is written in plain java. Okay, we are using jersey, but 16MB are a lot for the logic of a small webservice. 3) I have to restart tomcat all 3 days or so. It looks like a memory leak or something similar. If the app runs for a few days the response time is quite high and the server seems to be frozen. It works again, if I restart tomcat per ssh. You can find my mvn pom file right here. Do you have some tips? Are there good tomcat alternatives?

    Read the article

  • Neural Network problems

    - by Betamoo
    I am using an external library for Artificial Neural Networks in my project.. While testing the ANN, It gave me output of all NaN (not a number in C#) The ANN has 8 input , 5 hidden , 5 hidden , 2 output, and all activation layers are of Linear type , and it uses back-propagation, with learning rate 0.65 I used one testcase for training { -2.2, 1.3, 0.4, 0.5, 0.1, 5, 3, -5 } ,{ -0.3, 0.2 } for 1000 epoch And I tested it on { 0.2, -0.2, 5.3, 0.4, 0.5, 0, 35, 0.0 } which gave { NaN , NaN} Note: this is one example of many that produces same case... I am trying to discover whether it is a bug in the library, or an illogical configuration.. The reasons I could think of for illogical configuration: All layers should not be linear Can not have descending size layers, i.e 8-5-5-2 is bad.. Only one testcase ? Values must be in range [0,1] or [-1,1] Is any of the above reasons could be the cause of error, or there are some constraints/rules that I do not know in ANN designing..? Note: I am newbie in ANN

    Read the article

  • Interesting AS3 hash situation. Is it really using strict equality as the documentation says?

    - by Triynko
    AS3 Code: import flash.utils.Dictionary; var num1:Number = Number.NaN; var num2:Number = Math.sqrt(-1); var dic:Dictionary = new Dictionary( true ); trace(num1); //NaN trace(num2); //NaN dic[num1] = "A"; trace( num1 == num2 ); //false trace( num1 === num2 ); //false trace( dic[num1] ); //A trace( dic[num2] ); //A Concerning the key comparison method... "The Dictionary class lets you create a dynamic collection of properties, which uses strict equality (===) for key comparison. When an object is used as a key, the object's identity is used to look up the object, and not the value returned from calling toString() on it." If Dictionary uses strict equality, as the documentation states, then how is it that num1 === num2 is false, and yet dic[num1] resolves to the same hash slot as dic[num2]?

    Read the article

  • iPhone vertical toggle switch

    - by nan
    I'm trying to create a vertical toggle switch control for the iPhone (along the lines of UISwitch but vertical sliding). I was wondering whether an existing control already existed or if there are any good tutorials that explain the basics of creating custom controls for the iPhone. Currently I've tried using affine transforms to create the vertical switch from a basic UIswitch, and it works except that the slider is too small compared to the slider track, thus I'm looking for information on writing custom controls. Any direction is much appreciated.

    Read the article

  • MAC address need to add colons

    - by nan
    Kevin your response was helpful with the MAC address question. I wanted to ask you if you have like 2600 MAC address the formula you provided =LEFT(A2,2)&":"&MID(A2,3,2)&":"&MID(A2,5,2)&":"&MID(A2,7,2)&":"&MID(A2,9,2)&":"&RIGHT(A2,2) how do I replace A1 with blank so all of column A gets converted

    Read the article

  • How to redirect 'aaa.com' to 'www.aaa.com'?

    - by Nan Li
    I've mapped 'aaa.com' and 'www.aaa.com' to the same ip address with my hosting service provider. But because my SSL certificate only works for 'www.aaa.com', so what I want is when the user visit 'aaa.com', he will be redirected to 'www.aaa.com'. I'm using ASP.Net MVC and IIS 7. Thanks

    Read the article

  • What do you call using print statements to debug code?

    - by vgm64
    I'm just curious, but is there a name for the process using print statements to debug your code? An example in pseudocode x=3.2e39 print x y = function1(x) print y z = function2(y) print z w = function3(z) print w Executation: 3.2e39 3.2e36 NaN NaN reveals some bad math in function2. If there's no standard name, what do you call it?

    Read the article

  • How to read more than 256 columns from an excel file (2007 format) using OLEDB

    - by Nan T
    I'm trying to import a excel file with more than 256 columns using OLEDB in C#. I tried all kinds of things, but it doesn't seem to be possible to read more than 256 columns from a excel (2007 format) file. I'm wondering if it's a bug or I'm simply missing something. Here is the connection string I used: Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\myFolder\myExcel2007file.xlsx;Extended Properties="Excel 12.0

    Read the article

  • How to redirect 'example.com' to 'www.example.com'?

    - by Nan Li
    I've mapped 'example.com' and 'www.example.com' to the same IP address with my hosting service provider. But because my SSL certificate only works for 'www.example.com', so what I want is when the user visit 'example.com', he will be redirected to 'www.example.com'. I'm using ASP.Net MVC and IIS 7. Thanks

    Read the article

  • viewWillAppear for subviews

    - by nan
    I have UIScrollView with multiple UIVIew subviews. I would like to update the data that is displayed by each UIView when they appear in the visible portion of the UIScrollView. What is the callback that gets triggered? I tried viewWillAppear, but it does not seem to get called. Thanks. :)

    Read the article

< Previous Page | 1 2 3 4 5 6 7  | Next Page >