integer

Fast Method to Intersect two Integer Quadratic Beziers?

Given two Quadratic Beziers in 2D with integer coordinates, what is the best way to find their intersection point(s)? Also interesting is an early rejection if they do not intersect. If it makes it easier, they can both be assumed to be monotone in both x and y. Only intersections that are representable by subdivision to integers of the ...

How to convert an IPv4 address into a integer in C#?

I was going to attempt to write this function myself but I thought that someone on SO might know the answer :) I'm basically looking for a function that will convert a standard IPv4 address into an Integer. Bonus points available for a function that will do the opposite. Solution should be in C#.net. ...

Parse v. TryParse

What is the difference between parse and TryParse? int number = int.Parse(textBoxNumber.Text); // The Try-Parse Method int.TryParse(textBoxNumber.Text, out number); Is there some form of error-checking like a Try-Catch Block? ...

Java - Easier way to guarantee integer input through Scanner?

For a program I am writing, I need to ask a user for an integer between 1 and 8. I've tried multiple (cleaner) ways of doing this but none of them worked, so I'm left with this: int x = 0; while (x < 1 || x > 8) { System.out.print("Please enter integer (1-8): "); try { x = Integer.par...

C#: How do you access an integer in the main UI thread from another thread?

How do you access an integer (increment nCount++) in the main form from the method of an asynchronous callback function? I know that with methods you have to check if invoke is required, then call begininvoke for the intended method as a delegate, as to avoid an illegal threading operation, but how an you perform a simple operation such...

customize asp.net membership by changing "userid" type to integer

in asp.net membership is it possible to change the "userid" type from "uniqueidentifier" to "integer"? and how to do it? ...

Is there a way to Convert Number words to Integers? Python

I need to convert 'one' into '1' 'two' into '2' and so on. Is there a way to do this a library or a class or anything? ...

sizeof (int) == sizeof (void*) ?

Is there an integer type with the same size as pointer? Guaranteed on all microarchitectures? ...

Is there a view for inputing integers in Android?

I'm looking for something like the individual parts of the date picker dialog. A view that allows you to input integers (and only integers) that you can limit (between 1 and 10 for example), where you can use the keyboard or the arrows in the view itself. Does it exists? It is for a dialog. A ready-made dialog to request an integer woul...

Compress sorted integers

Hi! I'm building a index which is just several sets of ordered 32 bit integers stored continuously in a binary file. The problem is that this file grows pretty large. I've been thinking of adding some compressions scheme but that's a bit out of my expertise. So I'm wondering, what compression algorithm would work best in this case? Also...

.NET Optimized Int32

While reading through the 70-536 training kit, it states: The runtime optimizes the performance of 32-bit integer types (Int32), so use those types for counters and other frequently accessed integral variables. Does this only apply in a 32 bit environment? Does Int64 take over in a 64 bit environment, or is Int32 still th...

check what number a string ends with in C++

In a C++ MD2 file loader, I have a lot of frames, each with a name that ends with a number, such as stand0 stand1 stand2 stand3 stand4 ... stand10 stand11 run0 run1 run2 etc. How do I get what the string is without the number behind? e.g. a function that changed "stand10" to just "stand" ...

Numerical optimization...

Hi there I was wondering which Integer or Float types are the fastest.. i was thinking byte is faster than integer because it has a smaller range. Some people told me .. that in some cases integer is faster than a byte. second question : The GPU is on his way to World Domination .. so i asked myself : Can a Double "be faster" than a I...

Convert/Quantize Float Range to Integer Range

Say I have a float in the range of [0, 1] and I want to quantize and store it in an unsigned byte. Sounds like a no-brainer, but infact it's quite compliated: The obvious solution looks like this: unsigned char QuantizeFloat (float a) { return (unsigned char) (a * 255.0f); } This works in so far that I get all numbers from 0 to 25...

.Net/C# : what's the real size of an integer?

Hi, in .Net, integers are valuetypes, which means it stored on the stack. Integers are also class (System.Int32 usually). They have methods like CompareTo, Equals,...Thus, they should take more than four bytes on the stack. The example below show however that they take exactly 4 bytes: unsafe static void Main() { int a = 2, b = 4; ...

What is the best way to evenly scale one byte?

In C I need to scale a uint8_t from 0 - 255 to 0 - 31 What is the best way to do this evenly? ...

How to convert strings into integers in python?

Hello there, I have a tuple of tuples from MySQL query like this: T1 = (('13', '17', '18', '21', '32'), ('07', '11', '13', '14', '28'), ('01', '05', '06', '08', '15', '16')) I'd like to convert all the string elements into integers and put it back nicely to list of lists this time: T2 = [[13, 17, 18, 21, 32], [7, 11, 13,...

How can I tell if a Java integer is null?

Greetings, I'm trying to validate whether my integer is null. If it is, I need to prompt the user to enter a value. My background is Perl, so my first attempt looks like this: int startIn = Integer.parseInt (startField.getText()); if (startIn) { JOptionPane.showMessageDialog(null, "You must enter a number between 0-16....

How to assign a String from a text file into integer array for Java?

How to assign a String from a text file into integer array for Java? I had saved the integer array into a text file, but now how can I retrieve all the integer array from the text file without any modification? I want the integer array retrieved same as before it stored into the text file. Below is part of my code: BufferedWriter f1 = n...

What's the maximum size for an int in PHP?

Ignoring the special libraries that allow you to work with very numbers, what's the largest int you can store in PHP? ...