неделя, 19 юни 2011 г.

How to find out the hfloat digits of your computer

Don't ask why I needed it, the point is that at this site, I found out how.
Save this program to some file, say pro.c:
#include <stdio.h>
int main()
{
long double ld = 1.0/3;
double d = 1.0/3;
float f = 1.0/3;

printf("sizeof(float)=%lu\n", sizeof(float));
printf("sizeof(double)=%lu\n", sizeof(double));
printf("sizeof(long double)=%lu\n", sizeof(long double));

printf(" f=%.30lf\n", f);
printf(" d=%.30lf\n", d);
printf("ld=%.30Lf\n", ld);
}

And then compile it:
gcc pro.c -o pro.x
After you compile it, type ./pro.x and count the digits :)
If you're interested into floating point arithmetics in Linux, you can read this site or of course - wikipedia.

вторник, 14 юни 2011 г.

How to suspend trough console

Easy :)
pm-suspend

pm-suspend
# sleep to ram
pm-hibernate
# suspends to hard-disk

Also it appears you can suspend at certain time trough:
at 0100
pm-suspend
<ctrl-D>
And to wake up the computer with:
rtcwake