Questions tagged [coercion]

Coercion, type conversion and typecasting are different ways of, implicitly or explicitly, changing an entity of one data type into another.

Coercion, type conversion and typecasting are different ways of, implicitly or explicitly, changing an entity of one data type into another.

398 questions
0
votes
2 answers

Is there a C#/.NET control that coerces to min, max, and increment values?

I am programming an instrument controller in which the user needs to be able to enter values for particular instrument parameters. One such parameter is Number of Samples. I need to restrict user input according to specified a min, max, and…
StrangerLoop
  • 39
  • 1
  • 4
0
votes
1 answer

Filling a 3D array in R: How to avoid coercion to list?

I have preallocated a 3D array and try to fill it with data. However, whenever I do this with a previously defined data.frame collumn, the array gets mysteriously converted to a list, which messes up everything. Converting the data.frame collumn to…
jgoldmann
  • 3
  • 1
0
votes
2 answers

Flash AS3: Getting this error: Access of undefined property - basic scope help needed :(

I'm still used to the AS2 style of all code on 1 frame, I'm trying to code AS3 in class files and I'm having a problem with a basic package setup. Scope issues are killing me with trying to learn AS3. Below is my package code, I don't have any other…
Leon Gaban
  • 36,509
  • 115
  • 332
  • 529
0
votes
0 answers

error 1067: Invalid implicit coercion as class?

I have a piece of code creating an instance of an object I call Line. var velLine:Line; if(/*some conditions*/) velLine = new Line(0, 0, x, y); x and y are taken from an object in the program that represents a player (it's supposed to be a…
avorum
  • 2,243
  • 10
  • 39
  • 49
0
votes
1 answer

Flex TypeError: Error #1034: Type Coercion - For two unrelated events in the same module, parent/child Sprite

This problem has stopped development, and I can't figure out what's wrong. I'm not clear on how flex is connecting these two unrelated events. The Some1 Sprite dispatches a Some1Event.MOUSE_UP event on a MouseEvent.MOUSE_UP while stopping…
Joe
  • 1,014
  • 1
  • 13
  • 28
0
votes
0 answers

R: NAs introduced by coercion in data frame

I have a data frame that I build with data from an sql db. First column contains date, the other contain double or string which should be double. I need to convert the string to real double. I have tried to extract the data with "numbers" in another…
VincentH
  • 1,009
  • 4
  • 13
  • 24
0
votes
3 answers

Implicit types for numbers in C

What are the implicit types for numbers in C? If, for example, I have a decimal number in a calculation, is the decimal always treated as a double? If I have a non-decimal number, is it always treated as an int? What if my non-decimal number is…
mark
  • 1,398
  • 13
  • 30
-1
votes
4 answers

If number is not in list return next highest number + python

I need method of checking whether a number exists is a list/series, and if it does not returning the next highest number in the list. For example:- in the list nums = [1,2,3,5,7,8,20] if I were to enter the number 4 the function would return 5 and…
John Conor
  • 722
  • 6
  • 20
-1
votes
1 answer

Javascript String Equality with "==="

Im writing a react application and while trying to get all warnings out I found a weird bug... handleLike = id => { const movies = [...this.state.movies]; const movie = movies.filter(obj => obj._id === id); if (movie.map(obj => obj.liked) == "fa…
Bennity
  • 213
  • 1
  • 3
  • 10
-1
votes
1 answer

Can I get explanation for (1 + undefined) implicitly Coercion weird behavior in JS?

I understand the implicit coercion that happens in javascript, but i actually can't understand why this happens: isNaN(1 + null) // false isNaN(1 + undefined) // true As i know that JS convert the null & undefined to 0, Or we could say…
Mahmoud Fawzy
  • 1,635
  • 11
  • 22
-1
votes
1 answer

JavaScript template literals and implicit coercion

What value should be assigned to "x" in order to meet the following condition: // let x = ?; console.log(`${x}` != '' + x) // true console.log(`${x}` !== '' + x) // true
ebv
  • 9
  • 4
-1
votes
1 answer

Coercion making a problem in arithmetic operations

I have introduced some character values in mtcars dataset. The class of variables become character due to coercion. My requirement is to get numeric values as numeric class and let the character values stay in their actual form i.e character class.…
Doctor
  • 59
  • 1
  • 11
-1
votes
3 answers

Different ways in checking if a number is greater than zero (0)

What are the differences between using condition, coercion and Boolean conversion in checking a number type for greater than zero (0)? Each will give the same output var zero = 0; var three = 3; // condition zero > 0 //false three > 0 //true null >…
-1
votes
1 answer

Matrix to Time-Series with NAs

I have a data-frame whose first row consists of names of currencies, second row consists of dates, and thirst row consists of historical prices for those dates. How can I convert this into a time-series object whose columns consist of different…
ABIM
  • 364
  • 3
  • 19
-1
votes
2 answers

Argument is not numeric or logical with function rollapply, followed by NAs introduced by coercion

I am trying to calculate means each 3 observations in my dataframe which is based on 10 minutes data and I am trying to average it down to half an hour. My data looks like this: Date Value 2017-09-20 09:19:59 96.510 2017-09-20…
1 2 3
26
27