integers

Handling arbitrarily large integers in dbase language

Is there a simple package available that permits programming in xbase ( i.e. dbase or Foxpro syntax) and has a datatype to store and perform simple arithmatical operations on arbitrarily large integers ( say 100,000 decimal digits) ? ...

How to convert a number to a range of prices

I want to calculate the amount to charge my customers, when they buy licenses of my product. I sell it in ranges of licenses: 1-10 : $50/user 11-20 : $40/user 21-30 : $30/user 31-50 : $20/user So when someone purchases 136 licenses, I will charge him: 50 x 2 x $20 = $2000 30 x 1 x $30 = $900 6 x $50 = $300 I'm looking for an...

Creating a list of integers in XML for android.

I would like to create a list of Integers in the /res folder of an android project. However, I want those integers to point resources in /res/raw. So for example, I would like something like this: <?xml version="1.0" encoding="utf-8"?> <resources> <integer-array name="built_in_sounds"> <item>@raw/sound</item> ...

Splitting integers in arrays to individual digits

hello all. I have an array: int test[]={10212,10202,11000,11000,11010}; I want to split the inetger values to individual digits and place them in a new array as individual elements such that my array now is: int test2[]={1,0,2,1,2,1,0,2,0,2,1,1,0,0,0,1,1,0,0,0,1,1,0,1,0}; How would i go about doing that? I'm doing this in java. ...

unlimited (or very high) length integer storage

Hello, as a side project I am working on some home-baked prime generation problems, trying to write some different implementations as a means of teaching myself C and C++. Of course, the quickest way to generate low primes is to already have them, so I want to go about setting up a hard disk prime list data file. I want to write all th...

What is the fastest way to initialize an integer array in python?

Say I wanted to create an array (NOT list) of 1,000,000 twos in python, like this: array = [2, 2, 2, ...... , 2] What would be a fast but simple way of doing it? ...

How do I convert a padded string to an integer while preserving padding?

I followed the great example at Python: Nicest way to pad zeroes to string (4) but now I need to turn that padded string to a padded integer. I tried: list_padded=['0001101', '1100101', '0011011', '0011011', '1101111', '0000001', '1110111', 1101111', '0111001', '0011011', '0011001'] # My padded sting list. int_l...

python matplotlib will only plot integers

Hi, I'm very new to python. two days. trying to get a plot working with matplotlib. I'm getting this error: cannot perform reduce with flexible type the line with the error is: ax.scatter(x,y,z,marker='o') Variables: ax is defined as: ax = Axes3D(fig) fig is defined as: fig = plt.figure() x, y, z are lists Any python expert...

Safest way to convert float to integer in python?

Hi, Python's math module contain handy functions like floor & ceil. These functions take a floating point number and return the nearest integer bellow or above it. However these functions return the answer as a floating point number. For example: In [1]: import math In [2]: f=math.floor(2.3) In [3]: f Out[3]: 2.0 What is the safest w...

Cocoa Touch - int as string format

playerOneScore is a int, How can I pass it to use a label to display the score? This code just prints %i... -(void)updateScoreLabels{ playerOneScoreLabel.text = @"%i",playerOneScore; playerTwoScoreLabel.text = @"%i",playerTwoScore; playerThreeScoreLabel.text = @"%i",playerThreeScore; playerFourScoreLabel....

Challenge: How to turn an NSArray of numbers into an English-readable list

Hi all, I'm looking for a nice clean routine for turning an NSArray containing NSNumbers (integers) into a nice English-readable string. For example, I want to change this: [NSArray arrayWithObjects:[NSNumber numberWithInt:5], [NSNumber numberWithInt:7], [NSNumber numberWithInt:12], ...

C++ what does >> do

What does >> do in this situation? int n = 500; unsigned int max = n>>4; cout << max; It prints out 31. What did it do to 500 to get it to 31? ...

PHP - Sorting an Array

Hello everyone, I am trying to sort an array that contains numbers that range in substantial values. The result I want to get is a descending order of those numbers from the array I am retrieving from a MySQL Server. So far I have created this to test out the "sort" function: <?php $numbers = array("100", "50", "70", "1000"); sort($nu...

Computing greatest common denominator in python

If you have a list of integers in python, say L = [4,8,12,24], how can you compute their greatest common denominator/divisor (4 in this case)? ...

[WAV file] Why are an integers bytes stored backwards? Does this apply to headers only?

I'm currently trying to decipher WAV files. From headers to the PCM data. I've found a PDF (http://www.tdt.com/T2Support/technical_notes/tn0132.pdf) detailing the anatomy of a WAV file, and I've been able to extract and make sense of the appropriate header data using Ghex2. But my questions are: Why are the integers bytes stored backw...

What is the difference between “int” and “uint” / “long” and “ulong”?

I know about int and long (32-bit and 64-bit numbers), but what are uint and ulong? ...

What is the difference between “18” and “0x18”?

Possible Duplicate: What is 0x10 in decimal? I notice that Console.WriteLine(18); writes 18, but Console.WriteLine(0x18); writes 24. What does this mean? ...

Integers and Calculations

I'm working with integers and trying to do calculations that involve decimals at parts. I have used this same setup before and it had worked but for some reason this isn't working. package table.periodic; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android....

Getting best array value based on a priority list

I'll try and explain this the best I can. I have an array called $linkSets, and it has array entires that look like: <string>,<integer> <string>,<integer> <string>,<integer> I also have a priority list, that goes in this order: 22 -> 18 -> 35 -> 34. I would like to check each integer in the $linkSets array, and get the best <string> ...