Questions tagged [nan]

NaN is an abbreviation for "Not a Number". NaN is sometimes not equal to itself.

NaN (Not a Number) is a value of the numeric data type representing an undefined or unrepresentable value, especially in floating-point calculations. Systematic use of NaNs was introduced by the IEEE 754 floating-point standard in 1985, along with the representation of other non-finite quantities such as infinity.

A common feature of NaN in many programming languages is that NaN is not equal to itself.

4290 questions
2
votes
1 answer

Jquery Ajax returning NaN

I'm using jQuery ajax, and I'm trying to return the value "5.0000" from the php file and after, convert the value to float. I'm sure that the value returning from the PHP file is "5.0000" because I used the alert() and document.write(). But when I…
Thiago Yoithi
  • 495
  • 1
  • 6
  • 13
2
votes
2 answers

jQuery returns NaN on simple calculation

I have the following script. When I initially wrote it, it worked perfectly. Then I loaded the page over and it has broken and permanently is returning NaN. I am able to run it successfully in the console but for some reason it will not work…
capcode01
  • 163
  • 1
  • 15
2
votes
1 answer

Bullet Physics and NAN values

Sometimes some objects get NAN values in world simulated with Bullet Physics. (very rare) What is the correct way to handle it? Is there build in Bullet Physics functionality to detect such objects to avoid NAN viral effect. Why some objects are…
Max
  • 6,286
  • 5
  • 44
  • 86
2
votes
2 answers

Can you get a "nan" from overflow in C++?

I'm writing a program that uses a very long recursion (about 50,000) and some very large vectors (also 50,000 in length of type double) to store the result of each recursion before averaging them. At the end of the program, I expect to get a number…
Vokram
  • 2,097
  • 4
  • 19
  • 27
2
votes
1 answer

Importing timeseries datasets to MATLAB (all values are displayed as NaN)

I am stuck trying to run an economic model using MATLAB - at the data importing part. For most of my code I'm using a freeware toolbox called IRIS. I have quarterly dataset with 14 variables and 160 datapoints. Essentially the dataset is a 15X161…
S1234
  • 23
  • 1
  • 4
2
votes
2 answers

Finding the cause of NaN error

I got stuck with a NaN error in this section of code: void Robot::updatePos(int msTime){ if(vel_left==vel_right){ pos_x-=vel_right*msTime*0.001*sin(orientation); pos_y-=vel_right*msTime*0.001*cos(orientation); } else{ …
iramusa
  • 193
  • 1
  • 11
2
votes
5 answers

converting double.NaN to the relevant culture in converter wpf

have a datatable which is being inserted with doubl.NaN when we dont have values. What i want to do is whenever i see double.Nan i want to put "-" instead, therefore i have a converter with the following code: if (value.ToString() ==…
Ori Price
  • 3,593
  • 2
  • 22
  • 37
2
votes
2 answers

Why do isnan, isinf, and isfinite return an int and not a bool?

isnan returns an int... nonzero value if arg is NaN, ​0​ otherwise. Why doesn't it return a bool? This isn't some legacy stuff, it's new with C++11.
David
  • 27,652
  • 18
  • 89
  • 138
2
votes
1 answer

Python create custom NaN

is it possible to create a custom NaN value in Python? I know a bit about floating point representation and that NaN is a FP value with some special exponent. Therefore, each FP value with that special exponent is a NaN. To be precise, what I want…
Sven Hager
  • 3,144
  • 4
  • 24
  • 32
2
votes
4 answers

z score with nan values in matlab (vectorized)

I am trying to calculate the zscore for a vector of 5000 rows which has many nan values. I have to calculate this many times so I dont want to use a loop, I was hoping to find a vectorized solution. the loop solution: for i = 1:end vec(i,1) =…
user1129988
  • 1,516
  • 4
  • 19
  • 32
2
votes
1 answer

JavaScript object goes crazy upon creation?

I am currently working on a multiplayer game in Javascript, and I seem to have a very peculiar problem with my PlayerList data-structure/object. Here is the object: var PlayerList = function(){ this.list = {}; } The object has several methods…
tborenst
  • 972
  • 2
  • 9
  • 18
2
votes
1 answer

exp() returns NaN stuff

Ok, I'm stuck. I have this PHP code: echo exp(12), '
'; echo exp(4.2); just like on the PHP.net page. And what I have on the screen: NAN 298.86740096706 but then there comes the weirdest thing ever. I thought that maybe there's…
sliwhas
  • 59
  • 2
1
vote
1 answer

Removing NaN and Infinity from displaying in the reports

I tried using the logic given elsewhere on removing the NaN and infinity values but couldnt alter my formula based on that. If somebody could please write me my formula including the NaN and infinity check. I want Nan and infinity to appear as - in…
aMazing
  • 1,430
  • 4
  • 20
  • 43
1
vote
4 answers

Squareroot returning not a number in C++

In the program below, I am trying to calculate the distance between two points. For this, I have made two Point objects. In the method that returns the distance, I have used the distance formula to calculate distance between two points in space.…
uyetch
  • 2,150
  • 3
  • 28
  • 33
1
vote
1 answer

find and replace value

I have a structured array (1x1) called 'Data' which has 3 fields. Each field contains a vector of data. The following code is used to replace values which vary by greater than 0.2 with the value next to it with NaN. However, is it possible to alter…
user1053544
  • 107
  • 4
  • 11