int32

How can I determine which element is causing an overflow?

筅森魡賤 提交于 2019-12-12 04:57:15
问题 I've got this code: String testData = File.ReadAllText("siteQueryTest.txt"); XDocument xmlDoc = XDocument.Parse(testData); List<SiteQuery> sitequeries = (from sitequery in xmlDoc.Descendants("SiteQuery") select new SiteQuery { Id = Convert.ToInt32(sitequery.Element("Id").Value), UPCPackSize = Convert.ToInt32(sitequery.Element("UPCPackSize").Value), UPC_Code = sitequery.Element("UPC_Code").Value, crvId = sitequery.Element("crvId").Value, dept = Convert.ToInt32(sitequery.Element("dept").Value),

How do you convert a hex to signed float in Swift? Works fine with positive number but doesn't work on negative

北战南征 提交于 2019-12-11 07:55:58
问题 let hexString = "0x42f9b6c9" let toInt = Int32(truncatingBitPattern: strtoul(self, nil, 16)) let toFloat = Float(bitPattern: UInt32(self)) RESULT: 124.857 let hexString = "0xc2f9b6c9" let toInt = Int32(truncatingBitPattern: strtoul(self, nil, 16)) let toFloat = Float(bitPattern: UInt32(self)) app crashes here because the value is negative, expected result is -124.857 Please help. Thank you! 回答1: strtoul means string to unsigned long. Try strtol 回答2: Better to make an extension of String

How to convert list of binary values to int32 type?

自古美人都是妖i 提交于 2019-12-10 22:17:54
问题 I have a list of binary numbers in little-endian format in MATLAB workspace, and I want to convert them to int32. a is a double vector of zeroes and ones, like so: a = [0 0 0 1 1 0 0 1 1 1 1 0 1 0 1 0 0 0 0 1 1 0 0 0 1 1 1 1 1 0 0 0]; int32(a) gives me a row vector of the 32 binary values without converting it to 32 bit integer. 回答1: The solutions from this related question (which is specific to unsigned integers) can be modified to handle a signed integer. The easiest approach would be to

Is there any difference between Integer and Int32 in VB.NET?

偶尔善良 提交于 2019-12-09 07:48:24
问题 In VB.NET, is there any difference between Integer and Int32 ? If yes, please explain. 回答1: Functionally, there is no difference between the types Integer and System.Int32 . In VB.NET Integer is just an alias for the System.Int32 type. The identifiers Int32 and Integer are not completely equal though. Integer is always an alias for System.Int32 and is understood by the compiler. Int32 though is not special cased in the compiler and goes through normal name resolution like any other type. So

Type 'Int32' does not conform to protocol 'AnyObject' Swift?

核能气质少年 提交于 2019-12-07 07:25:17
问题 I have a Model, subclass of NSObject , looks like as below. class ConfigDao: NSObject { var categoriesVer : Int32 = Int32() var fireBallIP : String = String () var fireBallPort : Int32 = Int32() var isAppManagerAvailable : Bool = Bool() var timePerQuestion : String = String () var isFireballAvailable : Bool = Bool () } I have download NSMutableData and made JSON from it using NSJSONSerialization . My Code is func parserConfigData (data :NSMutableData) -> ConfigDao{ var error : NSError? var

int32 storage in memory [duplicate]

徘徊边缘 提交于 2019-12-05 22:14:07
This question already has an answer here: How is an integer stored in memory? 4 answers I have a question about int32 storage (c#) . 32 bits means that the biggest number for int is 2^32. 2^32 = 4294967296 , if you divide it by 2 you get the maximum value for an int32 : 4294967296 / 2 = -2147483648 to 2147483648 So I thought half of the bits are for negative figures and the other for positive. But that cant be true because 2^16 = 65536 . Now my question : How is this actually set up in memory? Im really curious about your answers. Only one bit is used for sign (negative or positive) Int32

What is the difference between Int32 and UInt32?

☆樱花仙子☆ 提交于 2019-12-05 13:52:06
问题 What is the difference between Int32 and UInt32 ? If they are the same with capacity range capabilities, the question is for what reason UInt32 was created? When should I use UInt32 instead of Int32 ? 回答1: UInt32 does not allow for negative numbers. From MSDN: The UInt32 value type represents unsigned integers with values ranging from 0 to 4,294,967,295. 回答2: An integer is -2147483648 to 2147483647 and an unsigned integer is 0 to 4294967295. This article might help you. 回答3: uint32 is an

Type 'Int32' does not conform to protocol 'AnyObject' Swift?

坚强是说给别人听的谎言 提交于 2019-12-05 13:34:49
I have a Model, subclass of NSObject , looks like as below. class ConfigDao: NSObject { var categoriesVer : Int32 = Int32() var fireBallIP : String = String () var fireBallPort : Int32 = Int32() var isAppManagerAvailable : Bool = Bool() var timePerQuestion : String = String () var isFireballAvailable : Bool = Bool () } I have download NSMutableData and made JSON from it using NSJSONSerialization . My Code is func parserConfigData (data :NSMutableData) -> ConfigDao{ var error : NSError? var json = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.MutableContainers,

What is the int.MaxValue on a 64-bit PC?

柔情痞子 提交于 2019-12-05 11:49:15
问题 System.Console.WriteLine(int.MaxValue); This line gives me the answer of 2,147,483,647 as I have a 32-bit PC. Will the answer be same on a 64-bit PC? 回答1: Yes. int.MaxValue: 2,147,483,647 Source: https://www.dotnetperls.com/int-maxvalue 回答2: Yes, the answer will be the same on a 64-bit machine. In .NET, an int is a signed 32-bit integer, regardless of the processor. Its .NET framework type is System.Int32 . The C# Language specification states: The int type represents signed 32-bit integers

What is the difference between Int32 and UInt32?

六眼飞鱼酱① 提交于 2019-12-04 00:45:40
What is the difference between Int32 and UInt32 ? If they are the same with capacity range capabilities, the question is for what reason UInt32 was created? When should I use UInt32 instead of Int32 ? UInt32 does not allow for negative numbers. From MSDN : The UInt32 value type represents unsigned integers with values ranging from 0 to 4,294,967,295. Randy Minder An integer is -2147483648 to 2147483647 and an unsigned integer is 0 to 4294967295. This article might help you. uint32 is an unsigned integer with 32 bit which means that you can represent 2^32 numbers (0-4294967295). however in