64-bit Terminal?

Hi, I need to work with 64-bit data on the terminal (C++ long double test output), but it happens to be a 32-bit app, how can i change my terminal, if possible, from a 32-bit app to a 64-bit? (I know that it would probably make it slower, but I just need that way).
Thanks

MacBook 2.4GHz, Mac OS X (10.5.6)

Posted on Jan 31, 2009 12:08 AM

Reply
6 replies

Jan 31, 2009 4:34 AM in response to Sergio Botero

Terminal provides a gateway to the Unix layer, the heart of the operating system. Leopard is a 64-bit operating system which means that the programs you run using terminal (located, for example, in /bin and /sbin) take advantage of Leopard's 64-bit features if they have been compiled to do so.

I don't know how to check if a particular binary is 32- or 64-bit, but having a 64-bit Terminal won't change how you interact with the Unix layer unless you want to copy more than 4GB of text from one window to the next! ; )

Jan 31, 2009 8:25 AM in response to BobHarris

Again, Thank you BobHarris, that did it, you are right and it was a problem in the code, to be honest i didn't even knew that you could use "%Lf" instead "%llf" which was my former choice and seemed to work on linux. this is the simple code i was using.

#include <cstdio>
#include <cmath>
int main () {
long double n,p,k;
for( ;scanf("%Lf%Lf",&n,&p)==2; ){
k=pow(10,log10(p)/n);
printf("%.0Lf ",k);
}
return 0;
}


Thank you again. (also for the {code} format tip)

Jan 31, 2009 8:58 AM in response to BobHarris

Here is a coding example:

#include <stdio.h>
main()
{
long double longDblVar = 3.141592653589793238462643383279502884197169399375105820974944L;
long double longDblSscanf;
printf(" ");
printf("fprintf() example: ");
printf("%25.20La ", longDblVar);
printf("%25.20LA ", longDblVar);
printf("%25.20Le ", longDblVar);
printf("%25.20LE ", longDblVar);
printf("%25.20Lf ", longDblVar);
printf("%25.20LF ", longDblVar);
printf("%25.20Lg ", longDblVar);
printf("%25.20LG ", longDblVar);
printf(" ");
printf("sscanf() example: ");
sscanf("3.141592653589793238462643383279502884197169399375105820974944",
"%Lf", &longDblSscanf);
printf("%25.20La ", longDblSscanf);
printf("%25.20LA ", longDblSscanf);
printf("%25.20Le ", longDblSscanf);
printf("%25.20LE ", longDblSscanf);
printf("%25.20Lf ", longDblSscanf);
printf("%25.20LF ", longDblSscanf);
printf("%25.20Lg ", longDblSscanf);
printf("%25.20LG ", longDblSscanf);
printf(" ");
}

I compiled it using:

cc longDblExample.c -o longDblExample

And here is the output I get from this example code:

$ longDblExample
fprintf() example:
0xc.90fdaa22168c23500000p-2
0XC.90FDAA22168C23500000P-2
3.14159265358979323851e+00
3.14159265358979323851E+00
3.14159265358979323851
3.14159265358979323851
3.1415926535897932385
3.1415926535897932385
sscanf() example:
0xc.90fdaa22168c23500000p-2
0XC.90FDAA22168C23500000P-2
3.14159265358979323851e+00
3.14159265358979323851E+00
3.14159265358979323851
3.14159265358979323851
3.1415926535897932385
3.1415926535897932385

Jan 31, 2009 9:00 AM in response to BobHarris

I had to go shovel some snow between starting my example and posting it. I didn't go back and check to see if there were additional posts, so I did not see your example code before I posted. Sorry.

You sould be able to get information about the support printf() formats using

man 3 printf

Although it is the kind of man page that requires reading, re-reading, reading again, and all along the way you need to try examples.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

64-bit Terminal?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.