» Home » long » Page 1
C : erroneous output for “(long long int) = (long long int) * (double)”?
by Murali Ravipudi in Coding
long long int A = 3289168178315264;
long long int B = 1470960727228416;
double D = sqrt(5);
long long int out = A + B*D;
printf("%lld",out);

This gives result : -2147483648


I am not able to figure out why (it should be a positive result).
Can somebody help?


double to int (or long, long long) conversion sometimes is not good
by Itchrelief in Programming Languages

I am trying to convert quite big double number to int (or long or long long), but have some difficulties. Almost always it converts good, but not sometimes:


My code:


double price = 12345678.900000;
double hundredNumber = price * 100;
NSNumber *number = [NSNumber numberWithDouble:hundredNumber];
int tempNumber = [number intValue];

Al


Is casting long to int cheaper than autoboxing long to Long?
by XiandreX in Programming Languages

I have a bunch of Thingy objects that I'm keeping track of using long ID numbers. Since I have no guarantees about ID sequence, I'm keeping them in a HashMap<Long, Thingy> for random access. However, in Android, they have this very nice class called SparseArray which they claim is faster than my HashMap for how I'm using i


converting 'int' to 'long' or accessing too long array with 'long'
by Brian in Programming Languages

let say i have an array that is long enough to access any of its index with int, is there any way to access the index of such an array with long? and how the java handles this kind of array?
e.g.


int[] a = new int[]{1,5,2,4........9,2,1}

assume in above array that 9,2,1 are at indices that are beyond the range of <


Python type long vs C 'long long'
by Timothy in Programming Languages

I would like to represent a value as a 64bit signed long, such that values larger than (2**63)-1 are represented as negative, however Python long has infinite precision. Is there a 'quick' way for me to achieve this?


Is there any difference between Long a = Long.valueOf(1) or Long a = 1L?
by Peter Z in Programming Languages

Just wondering if this and other related functions like those Integer is one of those things that one should not be bothered with and just go with Long a = 1L; simple and straightforward.


'long long int' is interpreted as 'long int'. How do I get round this?
by kivava in Programming Languages

I'm working on project involving c programming for my mathematics course at university.
I need to be able to handle large integers, larger than those that can be stored in a 'long int' datatype. So I tried using 'long long int', but if I try something like this:


long long int number;
number = 10000000000;

Then the error message says 'error: integer


Is there a stoll()/stroll() (string to long long) alternative in Visual Studio 2008
by kevotheclone in Programming Languages

Is there an alternative, either built into windows or apache license compatible, to stoll() for Visual Studio 2008. Even installing the windows 7 platform SDK does not add stoll() to the string header.


On unix the same function is be called strtoll().


google maps api v3 determine destination lat/long given initial lat/long, distance and angle
by Gold in Development Tools & Services

Is there a way to determine what will be the destination lat/long if I have the initial lat/long, and distance from start point to the end point, and a slope of 98 degree with respect to the x-axis.


Regards


C++: Convert unsigned long long int into vector<char> and vice versa
by sm625 in Coding

Can anyone tell me how to convert unsigned long long int into vector and vice versa.


For converting from unsigned long long int to vector, I tried the following:


unsigned long long int x;
vector<char> buf(sizeof(x));
memcpy( &buf[0], &x, sizeof( x ) );

When I tested for x = 1234567890, it failed. But when I tried it for sma


Next
Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2014 © bighow.org All Rights Reserved .