integer

Integer Relation Implementation (finding ratio between real numbers)

Can anyone point me to a library or module with a decent integer relation implementation (most likely PSLQ)? My target platform is .NET (C#), but if there's source code in C/C++, Java, whatever, even a semi-comprehensible algorithm, that would help me a lot. All I was able to find on Google was some unreadable Mathematica code. I was ...

c sharp initialzing an integer data type

how to initialize a variable of data type integer, in c sharp. the problem is the variable has to store an integer with values ranging from 1 to 4. ...

Converting an Integer to Enum in PostgreSQL

I have created a custom data type enum like so: create type "bnfunctionstype" as enum ( 'normal', 'library', 'import', 'thunk', 'adjustor_thunk' ); From an external data source I get integers in the range [0,4]. I'd like to convert these integers to their corresponding enum values. How can I do this? I'm using PostgreSQL 8.4. ...

matrix multiplication for integral types using BLAS

Is there an equivalent of dgemm (from BLAS) for integral types? I only know of dgemm, sgemm for double precision / single precision matrices, but would like to have it for matrices that are of integral type such as int (or short int...). Note: I'm not looking for a solution that involves converting to float/double, and am looking for a ...

long long int in ObjC

Hi All, I am using this NSURLConnection Delegate method - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { long long rdata = [response expectedContentLength]; NSLog(@"Response Length : %lld", rdata); } its always showing -1 What is the format specifier for long long variable ? T...

DECIMAL vs INT what is the best optimized choice?

I'm sure this ask in incomplete without a precise context, so I'll try to explain it, and I'll try to be clear I need to store a whole of data rapresented on the page with grams, milligrams, micrograms and kilojoule. All of this data is like 99999.99g (kilojoule apart), so I could use DECIMAL(7,2) or DECIMAL(5,2) with older MySql versio...

Why does AMFPHP store integers as two bytes for the AMF protocol?

I'm wondering if anyone familiar with AMFPHP or low level data storage could explain why integers are being stored as two bytes instead of four. As far as I can tell, the AMF3 protocol demands a four byte integer. The specific code in the serializer is the following: /** * writeInt takes an int and writes it as 2 bytes to the output ...

int? c#, used in ref, what exactly is it.

Hi, might be a kiddy, biddy question but I was trying to pass an "output" parameter to a Stored Procedure using C Sharp and was getting an error until I passed the "output" variable using following syntax: int? ROWID = 0; ADAPTER.INSERT(val1, val2, ref ROWID); Though problem is solved, I just can't understand why, when I try to hold ...

How does Casting work in PHP?

What doesn't this work: (int)08 == (int)09==0 But this and this does? (int)07==7 (int)06==6 ...

convert integer to array, c++

I would like to convert an integer into an array, so that it looks like the following: int number = 123456 ; int array[7] ; with the result: array[0] = 1 array[1] = 2 ... array[6] = 6 ...

PHP Convert to int

Hi, Im not sure what this type of number is '1.3122278540256E+18' but how can i expand it into an integer? Thanks!! ...

checking to ensure all values in a field are integers in MySQL

I have a column that is currently a floating-point number and I need to check if all the values in the column are integers. What's the easiest way to do this? ...

Strip final 0 off a python string

#!/usr/bin/env python import os, sys, subprocess, time while True: print subprocess.call("xsel", shell=True); time.sleep(1); Takes an entry from the clipboard and prints it, every 1 second. Result: copied0 entry0 from0 clipboard0 I do not know why it returns the final 0, but it apparently stops me from using string stri...

How to convert string to hexadecimal integer in Python?

hi I get user argv from command line as follows: '0x000aff00' and I want python to treat it as hex directly... str = sys.argv[1] how is it possible? thanks! ...

Make sure int variable is 2 digits long, else add 0 in front to make it 2 digits long

How do I check a int variable ($inputNo) to see if it’s 2 or more decimal digits long? Example: inputNo="5" Should be changed to: 05 inputNo="102" Should be left alone: 102 I thought about using wc and if statements, but wc -m doesn’t seems to give the actual characters passed into wc, as wc always seems to give +1 to the charact...

Extract Integer Part in String

What is the best way to extract the integer part of a string like Hello123 How do you get the 123 part. You can sort of hack it using Java's Scanner, is there a better way? ...

Python: List to integers

I have read a file in and converted each line into a list. A sample of the list looks like: ['15', '2', '0'], ['63', '3', '445', '456' '0'], ['23', '4', '0'] i want to retrieve the first number from each list and convert it to and integer so when i carry out the type function i.e. type(x) <type 'int'> is returned Also when i print ...

List and Integer query

If i had a list of numbers and some maybe negative, how would i ensure all numbers in my list were positive? I can covert the items in the list to integers thats no problem. Another question, I want to compare items in my list to an integer value say 'x' and sum all the values in my list that are less than x. Thank you. ...

Convert list of Integers into one Int (like concat) in haskell

Pretty much what the title says. I have a list of Integers like so: [1,2,3]. I want to change this in to the Integer 123. My first thought was concat but that doesn't work because it's of the wrong type, I've tried various things but usually I just end up returning the same list. Any help greatly appreciated. Also I have found a way to ...

Convert string / character to integer in python

I want to convert a single character of a string into an integer, add 2 to it, and then convert it back to a string. Hence, A becomes C, K becomes M, etc. ...