integer

Method to convert from Hex to Integer in C, can't get lowercase!

Hey everyone, just a quick thing, I have the hex to integer working, but I need to get the numbers lowercase. Here's what I have, any ideas to get to get the A thru F case insensitive? int htoi(char f[]) { int z, n; n = 0; for (z = 0; f[z] >= '0' && f[z] <= 'F'; ++z) if (f[z] >= 'A' && f[z] <= 'F') n ...

Mark mandatory fields on form, if not filled with valid value

hi there, if you create a new dataset, mandatory fields which are not set yet are marked with a wiggly red line. it seems, that only string-values ( or several fields, but at least no integers ) are marked this way. if integer-references are used ( 1-based ), the regarding fields are filled with 0 per default which causes the red lin...

Represent MD5 hash as an integer

Hello! In my user database table, I take the MD5 hash of the email address of a user as the id. Example: email([email protected]) = id(d41d8cd98f00b204e9800998ecf8427e) Unfortunately, I have to represent the ids as integer values now - in order to be able to use an API where the id can only be an integer. Now I'm looking for a way ...

How can I disable scientific notation when working with very large numbers in Perl?

Consider the following: print 3 ** 333; #Yields 7.6098802313206e+158 My question is simple: How can I disable scientific notation when working with very large numbers? Basically, I'd like to see all the digits dumped to stdout verbatim. Is this possible? ...

C++ syntax question: if var != type int

I am trying to write an if statement but cannot find the proper expression form to use. I'm thinking of writing something like this: if ( var != type(int) ) However, I am unsure exactly how to go about doing this, and this method does not work. Am I at least thinking along the right lines? ...

Use of hasNextLine in Java, won't read NextLine after NextInt

Hey guys and gals, I am trying to get this to work System.out.println("Please enter what SOCKET NUMBER you" + "wish to connect to"); int sockname = Integer.parseInt(inFromUser.nextLine()); System.out.println("Please enter what HOSTNAME you" + "wish to connect to"); String hostname = inFromUser.nextLine(); Th...

zerofill a interger php

Hay, how would i go about 'zero filling' an integer? ie 1 becomes 0001 40 becomes 0040 174 becomes 0174 Thanks ...

Mapping integers onto the entire range

I'm using a hash table (DotNET Dictionary object) as part of a sparse two-dimensional data set. Most of the entries in the hash table will be close together. I'll probably end up with 100 ~ 10,000 entries, all of them clustered near zero. I've read that a Hash table performs better when the hashes are spread across the entire integer(32 ...

How to do an Integer.parseInt() for a decimal number?

The Java code is as follows: String s = "0.01"; int i = Integer.parseInt(s); However this is throwing a NumberFormatException... What could be going wrong? ...

What is the fastest int to float conversion on the iPhone?

i am converting some Int16's to float and then back again. and some int32 's to float and back again im just using a straight cast, but doing this quite a few times per second. (44100 any guesses what its for? :) ) is a cast efficient, can it be done any faster? ps compile for thumb is turned off ...

initwithint warning, no method found?

I have a warning and just can't work out how to make it go away. In my .h I have this... -(void)restartTimer; Then the in my .m I have... -(void)restartTimer{ TimerViewController *TimerView = [[TimerViewController alloc] initWithInt:hStart number:mStart]; I get this error: Warning: no '-initWithInt:number.' method found. I a...

PHP's unsigned integer on 32 bit and 64 bit platform

Here is the code: echo sprintf('%u',-123); And this is the output on 32 bit platform: 4294967173 but on 64 bit: 18446744073709551493 How to make it the same ?Say,the int(10) unsigned ...

Efficient way to determine number of digits in an integer

What is a very efficient way of determining how many digits there are in an integer in C++? ...

How can I check if a string contains a number smaller than an integer?

Having some issue with this... if (System.Convert.ToInt32(TotalCost(theOrder.OrderData.ToString()).ToString()) < 10000) ViewData["cc"] = "OK"; else ViewData["cc"] = "NO"; yields: "Input string was not in a correct format." How can I check if the number inside the string is less than 10000? Oh yeah: TotalCost ...

Why is the number 16 converted to float(6.1026988574311E_320) by PHP using Zend_Amf

The Zend_Amf specification states that a Number type returned from flash will map to a float in PHP. Fine. But why does the number 16 get returned as 6.1026988574311E_320 ? PHP version is 5.2.9 running on OS X. I have tried forcing a cast to integer in PHP (the above value gets rounded to 0) and also from Actionscript using int(16) - th...

How to convert an ASCII value into a character in .NET

There are a million posts on here on how to convert a character to its ASCII value. Well I want the complete opposite. I have an ASCII value stored as an int and I want to display its ASCII character representation in a string. i.e. please display the code to convert the int 65 to A. What I have currently is String::Format("You typed '...

How does an environment (e.g. Ruby) handle massive integers?

My integers in Ruby (MRI) refuse to overflow. I've noticed the class change from fixnum to bignum but I'm wondering how this is modeled and what sort of process ruby uses to perform arithmetic on these massive integers. I've seen this behaviour in SCHEME as well as other environments. I ask because I'd like to implement something simil...

Quick Multiplication Question - Cocoa

Hi there, I'm still learning, and I'm just stuck. I want the user to enter any number and in result, my program will do this equation: x = 5*y (y is the number the user adds, x is outcome) How would I do this? I'm not sure if I'm suppose to add in an int or NSString. Which should I use, and should I enter anything in the header file...

Fast Multiplication

Hi! I'm writing code for a microprocessor with fast integer arithmetic and not so fast float arithmetic. I need to divide an integer by a number from 1 to 9 and convert result back to integer. I made a float array with members like 0, 1, 0.5, 0.3333 etc. But i think there is MAGIC constants (like 0x55555556) for a numbers except (1/3)....

Size of int in C on different architectures

I am aware that the specification of the C language does not dictate the exact size of each integer type (e.g., int). What I am wondering is: Is there a way in C (not C++) to define an integer type with a specific size that ensures it will be the same across different architectures? Like: typedef int8 <an integer with 8 bits> typedef i...