Questions tagged [int32]

int32 is a datatype that represents an integer and is coded on 32 bits in memory.

int32 is a datatype that represents an (a whole number, not a fraction) and is coded on 32 bits in memory. Unlike its counterpart which is , int32 can be used to store positive and negative integers, of values between -231 to 231 - 1.

187 questions
10
votes
3 answers

Swift: Convert Int16 to Int32 (or NSInteger)

I'm really stuck! I'm not an expert at ObjC, and now I am trying to use Swift. I thought it would be much simpler, but it wasn't. I remember Craig said that they call Swift “Objective-C without C”, but there are too many C types in OS X's…
Wilson Luniz
  • 459
  • 2
  • 7
  • 18
8
votes
6 answers

Convert a Short[2] to Int32 in C#

I have a short array in c# and I need to convert two elements in an Int32. The code I wrote is the following uint pesoparz = (Convert.ToUInt16(values[0])); Int32 pesotot = Convert.ToInt32(pesoparz *65536 + Convert.ToUInt16(values[1])); where…
MatD
  • 97
  • 1
  • 8
6
votes
0 answers

int32 failure in Raku

While working with the NCurses module I ran into some strange behavior that I've distilled in the repl as: > my $c = ' '.ord 32 > $c.WHAT (Int) > my int32 $n = ' '.ord 32 > $n.WHAT Bytecode validation error at offset 128, instruction 20: operand…
hsmyers
  • 665
  • 7
  • 10
6
votes
4 answers

Convert.ToInt32(float) fails when trying to convert float to Int32

No exception is thrown, function just halts at this statement: int productQuantity = Convert.ToInt32("1.00"); and returns. What am I doing wrong to convert this float to Int32? Note: I am running in a BackgroundWorkerThread.
user195488
6
votes
6 answers

Int.TryParse() returns false always

I have following code int varOut; int.TryParse(txt1.Text, out varOut); // Here txt1.Text = 4286656181793660 Here txt1.Text is the random 16 digit number generated by JavaScript which is an integer. But the above code always return false i.e.…
Microsoft DN
  • 9,706
  • 10
  • 51
  • 71
6
votes
1 answer

Circular shift Int32 digits using C#

Members, What I am trying to do is to right or left shift the digits of an Int32(not the bits!!). So if shift the constant: 123456789 by 3 I should get 789123456 So no digits get lost, because we talk about a circular shift. After a bit of…
Dark Side
  • 695
  • 2
  • 8
  • 18
6
votes
1 answer

Why does `Int32` use `int` in its source code?

Why does Int32 use int in its source code? Doesn't Int32 equal int in C#? So what is the original source code for int? I'm confused.. [Serializable] [System.Runtime.InteropServices.StructLayout(LayoutKind.Sequential)]…
Mohamad Shiralizadeh
  • 8,329
  • 6
  • 58
  • 93
6
votes
1 answer

Where to know/check: Int32 inherits from ValueType, ValueType inherits from Object?

I cannot find the relationships between these types using .Net reflector. Any idea?
user1033098
  • 205
  • 2
  • 7
5
votes
3 answers

C#. How come when I use TextReader.Read() it returns an int value? Possible to convert to char?

So TextReader.ReadLine() returns a string, but TextReader.Read() returns an int value. This int value also seems to be in some sort of format that I don't recognize. Is it possible to convert this integer to a character? Thanks for any…
Alexander
  • 53
  • 1
  • 4
5
votes
1 answer

int32_t main() vs int main()

I've written a cpp program, and I am able to run it with int32_t main() but not with the signature int main(). Can someone tell me why? Its a .cpp file and not a .c file (as mentioned in some other questions).
5
votes
1 answer

big dataset, receiving "Unstacked DataFrame is too big, causing int32 overflow" when using unstack()

I tried pivot and groupby + unstack, both gave me errors. the error says "Unstacked DataFrame is too big, causing int32 overflow". I tried to downgrade pandas to 0.21 but its not compatible with python 3.7, so is there any…
EmmaH
  • 51
  • 2
5
votes
1 answer

Ruby: 4-bytes array to int32

There are 4 bytes read from TCPSocket (actually socket returns a string and then I call .bytes to get an array). Now they need to be converted to int32 big endian. Or may be TCPSocket has some method to read int32 immediately?
Paul
  • 25,812
  • 38
  • 124
  • 247
5
votes
3 answers

Multiplying two positive Int32 returns incorrect, negative answer?

I'm coding in C# for Windows Phone 7.5; I am taking text from a text box, parsing it into an array, then converting each array element into an Int32 using Convert.ToInt32, then running the resulting Int32 values through a series of mathematical…
RabbitEar
  • 101
  • 1
  • 5
4
votes
3 answers

Shorthand for Int32 literals in Julia

I use lots of Int32s in my code because I have some large arrays of those. But for some x::Int32 we have typeof(x+1) == Int64 since numeric literals are Int64 by default (I have to use 64bit Julia to handle my arrays). The problem is, if I have some…
Corylus
  • 736
  • 5
  • 16
4
votes
3 answers

Int32 computation difference between Java and JavaScript

I need to rewrite some legacy Java code performing arithmetic transformations from Java to TypeScript/JavaScript. The problem is the legacy code uses the int Java type (signed 32-bits) and relies on overflows. I almost got what I want using…
airone
  • 45
  • 3
1
2
3
12 13