Questions tagged [isnan]

26 questions
2
votes
1 answer

Why does std::isnan( IntegralType arg ) cast arg to double?

An integral type cannot be NaN from my understanding, so std::isnan can just return false when given an integral type. Why does arg need to be cast to double as it states here
David
  • 619
  • 2
  • 8
  • 15
2
votes
2 answers

Why does `gcc -ffast-math` disable the correct result of `isnan()` and `isinf()`?

I understand that using the -ffast-math flag allows for unsafe math operations and disables signalling NaNs. However, I expected the functions isnan() and isinf() to still be able to return the correct results, which they do not. Here's an…
mivkov
  • 471
  • 5
  • 19
2
votes
1 answer

Does GCC's __builtin_isnan do something other than isnan?

In the GCC built-ins description, it says: GCC provides built-in versions of the ISO C99 floating-point comparison macros that avoid raising exceptions for unordered operands. They have the same names as the standard macros ( isgreater,…
einpoklum
  • 118,144
  • 57
  • 340
  • 684
1
vote
2 answers

What is the proper way to compare equality of two variables that could be NaN?

I found a bug in the codebase I'm working in where they check for equality of two doubles (first, second) using first == second, but these 2 variables could be NaN. If both variables were NaN the equality would be false. So my current solution is…
roulette01
  • 1,984
  • 2
  • 13
  • 26
1
vote
0 answers

Geopandas GeoDataFrame.boundary raises null value error even if .is_empty returns False

I have a geopandas dataframe with an id column and a 'geometry' column. I am calling "boundary" onto the geometry column like so: gdf_ops['start_end_points'] = gdf_ops['geometry'].boundary But this raises a Value error: ValueError: Null/empty…
Carmoldu
  • 11
  • 2
0
votes
2 answers

Convert NA to 0

my data (typeof S4) is look like: > rowData(ds_res1$res) DataFrame with 144 rows and 4 columns cluster_id marker_id p_val p_adj
Charlt
  • 17
  • 9
0
votes
1 answer

while multiplying two number and storing into that number ends up with a result of NaN

while iam using the += operator the multiplication results in NaN convertToDecimal(){ let current=this.head; let size=this.size; size-=1; var result; while(current!=null){ …
ABIN
  • 29
  • 5
0
votes
0 answers

MissingDataError: exog contains inf or nans

i am a little bit lost ...because i have this error and can not go ahead. i supposed the reason will be the below resul of my table that include some math indicator i have tri to calculate. null_values=data.isna().sum() print(null_values) output…
ire
  • 11
  • 3
0
votes
3 answers

Parsing function returns NaN instead of zero as requested

I've got these functions: const precisionRound = (number, precision = 0) => { const factor = 10 ** precision; return Math.round(number * factor) / factor; }; const superParseFloat = (numberish, precision = 2) => { if (!!numberish) { …
dariusz
  • 441
  • 1
  • 5
  • 17
0
votes
1 answer

IsNaN shows other results

let args: string[] = process.argv.slice(2); console.log(`All arguments: ${args}`); let numbers: number[] = saveNumbers(); console.log(`All Numbers: ${numbers}`); console.log(`1st argument < 10: ${firstNumberFullfill(numbers,x => x <…
Yanis
  • 5
  • 2
0
votes
0 answers

How to write a code that finds difference between adjacent, nonNaN values in a 3d array

Essentially,I have 4 arrays in a data file. They are: theta (276 x 626 x 2677 double); dates (1 x 2677 date time); latitude (276 x 626 double); and longitude (276 x 626 double). I am basically trying to find d(theta)/dt. I'm working in MATLAB and…
Hannah
  • 11
  • 3
0
votes
1 answer

user_na = FALSE does not make all empty rows NA - only for some columns when reading using read_sav

I use df <- read_sav("data/file.sav", user_na = FALSE) But the data does not look like expected col1 col2 1 Onestreet 2 Twostreet NA 4 5 How come rows 3-5 not become NA in col2?
Victor Nielsen
  • 443
  • 2
  • 14
0
votes
0 answers

C++ isnan() won't work in an if-statement?

I am trying to check, if a variable is not a number. I tried to use std::isnan() for that. Here's the code that I thought would work: #include #include #include int main() { int num = 1; if (std::isnan(num)) …
Tobi Smith
  • 53
  • 2
  • 9
0
votes
1 answer

ifelse, is.na and replace

I have a big data frame where I am trying to figure out with NA values q3 times_30 Very easy 18/11/2021 Easy 01/01/2021 NA Not due NA No answer NA 01/02/2021 I am using df$q3<-ifelse (is.na(df$q3), df$times_30,df$q3) Where gives…
Meli
  • 33
  • 6
0
votes
0 answers

How can I get 'return True' by exponent in JavaScript?

First, I'm sorry I can't speak English well. I have some problems studying JS. I want to return true if the string is a Number. If string is "0x10", "0b10", "9843" it work well (all return true). And string like "a463" return false well. But, when…
Bam
  • 1
  • 1
1
2