» Home » long » Page 1
C : erroneous output for “(long long int) = (long long int) * (double)”?
Category : 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?


View Replies


converting 'int' to 'long' or accessing too long array with 'long'
Category : 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 <


View Replies


Is casting long to int cheaper than autoboxing long to Long?
Category : 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


View Replies


double to int (or long, long long) conversion sometimes is not good
Category : 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


View Replies


'long long int' is interpreted as 'long int'. How do I get round this?
Category : 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


View Replies


Python type long vs C 'long long'
Category : 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?


View Replies


Is there any difference between Long a = Long.valueOf(1) or Long a = 1L?
Category : 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.


View Replies


google maps api v3 determine destination lat/long given initial lat/long, distance and angle
Category : 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


View Replies


Is there a stoll()/stroll() (string to long long) alternative in Visual Studio 2008
Category : 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().


View Replies


Assinging unsigned long (from C++) to long (Java) in CORBA client/server app?
Category : C & C++ & C#

On servers side I have function which returns unsigned long value (server is written in C++), lets say:


class Sth {
private:
CORBA::ULong u;
public:
CORBA::ULong get()
{
return this.u;
}
};

How to assign (on clients side) value returned from server to variable? I mean, theres no unsigned long in Java ...


View Replies


Next
2012 / 2017 Copyrights BigHow , All Rights Reserved .