bigint

Arithmetic Operations on Very, Very Long Decimals

I've always been curious: how can I perform arithmetic operations on very long decimals--for example, calculating pi to the 3000th decimal place (especially in an imperative language)? ...

Why do I get a decimal point in my BigInt numbers?

Adding 15 digit numbers like 999999999999990 in Perl produces results with a period such as 1.9999999999999e+. When using substr it still produces 1.99999999999, and when using BigInt the result still has a period. What is the correct Perl syntax for Perl 5.8.7 to get the result without the period? use BigInt; $acct_hash = substr(($acct...

Why do my Perl bigints have a decimal place?

If I do use a big integer in substr: use BigInt; $acct_hash = substr(('99999999999912345' + $data[1]),0,15); why is the result still 9.9999999999912? I was expecting 999999999999912. Is there something like: $data[1] = substr(to_char('999999999999991234'),0,15); in Perl? ...

Convert binary string to bigint in MySQL?

I am attempting to hash a string to a 64-bit value (bigint) in MySQL. I am aware of the MD5() function, which returns a 128-bit hash as a binary string. I'd be happy to just take the bottom or top 64 bits of this result. However, I cannot figure out how to get from a binary string type to a numeric type of any sort. Any pointers? ...

Convert Sqlite BigInt to Date

I have a Sqlite database that I am using as an ado.net job store for my Quartz.net scheduler jobs. In one table, a column called START_TIME is of type big int. Is there a way to cast or convert a bigint to a date value? I would like to be able to query the database to see which jobs are scheduled at what date/time and a value such as...

How to CAST to a BIGINT in a query

When I try to get the sum of a column from a table I get the error 'Arithmetic overflow error converting expression to data type int' because the resulting number is to big for an INT. So I tried to CAST to a BIGINT using SELECT CAST(SUM(columnname) AS BIGINT) FROM tablename but I get the same error. Any ideas what i'm doing wrong? ...

How can I use BigInt class in vb.net? (visual studio 2008)

recently i use int64. but it's no more handle my data. so I want something like BigInt. any idea? ...

Numeric String (arbitrary size) -> Multiple Integers

I'm running into a problem because my database has BIGINT data (64-bit integers) but the version of PHP I'm running is only 32-bit. So when I pull out value from a table I end up with a numeric string representing a 64-bit integer in base 10. What I would ideally like to do is use the 64-bit integer as a bitmask. So I need to go to ei...

Fastest way to convert binary to decimal?

I've got four unsigned 32-bit integers representing an unsigned 128-bit integer, in little endian order: typedef struct { unsigned int part[4]; } bigint_t; I'd like to convert this number into its decimal string representation and output it to a file. Right now, I'm using a bigint_divmod10 function to divide the number by 10, kee...

Java/Scala BigInteger Pasting

I have a problem with the Java BigInteger class: I can't paste a large value into BigInteger. For example, let's say I want to assign a BigInteger to this number: 26525285981219105863630848482795 I cannot assign it directly, because the compiler thinks it's an integer: val bi = 26525285981219105863630848482795 //compile error But I...

What is the alternative of bigint in c#

Hi, what I am suppose to use when handling a value in c#, which is bigint SQLSERVER DB ? Thanks ...

Convert float to bigint (aka portable way to get binary exponent & mantissa)

In C++, I have a bigint class that can hold an integer of arbitrary size. I'd like to convert large float or double numbers to bigint. I have a working method, but it's a bit of a hack. I used IEEE 754 number specification to get the binary sign, mantissa and exponent of the input number. Here is the code (Sign is ignored here, that's...

How do you write a bigint library / how does libgmp work?

Hi All, I'm aware of a number of BigInt libraries for C on various platforms and how to use them but I'm intrigued: how do they work? How would I go about building my own library (I'm not going to try, no point re-inventing the wheel but I'm interested in how it might happen)? Can anyone point me towards tutorials etc that might explain...

facebook connect uid mysql storage problem

I'm doing a facebook connect integration. I use the facebook php library to get the uid,like $facebook = new Facebook($api_key, $secret); $fb_user = $facebook->require_login(); $fbuser is a 16-character long bigint, such as 1000002949493949 However, when I insert this value into mysql it only inserts 2949493949 So later when I try to...

C++ BigInt multiplication conceptual problem

I'm building a small BigInt library in C++ for use in my programming language. The structure is like the following: short digits[ 1000 ]; int len; I have a function that converts a string into a bigint by splitting it up into single chars and putting them into digits. The numbers in digits are all reversed, so the number 123 woul...

Approach for altering Primary Key from GUID to BigInt in SQL Server related tables

I have two tables with 10-20 million rows that have GUID primary keys and at leat 12 tables related via foreign key. The base tables have 10-20 indexes each. We are moving from GUID to BigInt primary keys. I'm wondering if anyone has any suggestions on an approach. Right now this is the approach I'm pondering: Drop all indexes and ...

Can T-SQL store ulong's?

I want to store a C#.NET ulong into a T-SQL database. I don't see any provisions for doing this, as the SQL bigint has the same Min/Max values as a normal long. Is there any way I can do this? Or is catching an OverflowException my only hope? ...

how to cast bigint to prevent sql injection in php?

i am using php and running sql queries on a mysql server. in order to prevent sql injections, i am using mysql_real_escape_string. i am also using (int) for numbers casting, in the following manner: $desired_age = 12; $query = "select id from users where (age > ".(int)$desired_age.")"; $result = mysql_query($query); that work. But,...

What is the simplest way of implementing bigint in C?

Hi, I am trying to calculate 100! I am looking for the simplest way to accomplish this using C. I have read around but have not found a concrete answer. If you must know, I program in Xcode in Mac os X. Thanks! ...

mySQL 5.0.45 LAST_INSERT_ID() and values larger than a signed int

I'm attempting to use LAST_INSERT_ID on an auto incremented index that has moved past the signed int value 2147483647. This column is an unsigned int. However, LAST_INSERT_ID() is returning an invalid negative value. Researching this, I've found a couple comments indicating this is the nature of this function. But I cannot find it offici...