@pong777, post #1
W jaki sposób skompilować go pod WarpOS tak aby działał pod OS 3.x ale na procesorze PPC?
vc +warpos mojprogram.c
AmiDevCPP

@strim_, post #6
#include <stdio.h>
int main()
{
double a=4;
double i;
int sign=0;
for (i=3.0;i<10000.0;i=i+2.0)
{
if (sign==0)
{
a=a-(4.0/i);
sign=1;
}
else
{
a=a+(4.0/i);
sign=0;
}
}
printf("%1.20f",a);
return 0;
}VC sdh1:pi2.c -o sdh1:pi2.exe
t_3_0.o: In "l6": Error 21: t_3_0.o (CODE+0x2a): Reference to undefined symbol __ieeedivd. t_3_0.o: In "l7": Error 21: t_3_0.o (CODE+0x56): Reference to undefined symbol __ieeedivd. t_3_0.o: In "l6": Error 21: t_3_0.o (CODE+0x38): Reference to undefined symbol __ieeesubd. t_3_0.o: In "l7": Error 21: t_3_0.o (CODE+0x64): Reference to undefined symbol __ieeeaddd. t_3_0.o: In "l5": Error 21: t_3_0.o (CODE+0x80): Reference to undefined symbol __ieeeaddd. t_3_0.o: In "l3": Error 21: t_3_0.o (CODE+0x9a): Reference to undefined symbol __ieeecmpd. vlink failed returncode 20 vlink -bamigahunk -x -Bstatic -Cvbcc -nostdlib vlibos3:startup.o "T:t_3_0.o" -s -Rshort -Lvlibos3: -lvc -o sdh1:pi2.exe failed
@strim_, post #8
@pong777, post #9
Super działa. Formatowanie też już działa. A gdzie można przeczytać jakie biblioteki linkujemy do jakich includów? Np. to time.h/math.h ?
W jaki sposób najlepiej na dzień dobry wykryć brak FPU i poinformować użytkownika o jego braku aby nie generować GURU po odpaleniu exeka na maszynie bez FPU?
@pong777, post #11
@pong777, post #7
#include <stdio.h>
#include <time.h>
int main(double arg)
{
double a=4.0;
double i;
short int sign=0;
float start;
float stop;
float results;
if (arg<10000.0)
{
arg=100000.0;
printf("Usage: PI [10000.0-10000000.0]\n\n");
}
start=(float)clock()/CLOCKS_PER_SEC;
for (i=3.0;i<arg;i+=2.0)
{
if (sign==0)
{
a-=(4.0/i);
sign=1;
}
else
{
a+=(4.0/i);
sign=0;
}
}
stop=(float)clock()/CLOCKS_PER_SEC;
results=(stop-start);
printf("PI = %1.20f \n",a);
printf("Cycles = %f \n",arg);
printf("Calculation time: %4.10f sec.\n",results);
return 0;
}@pong777, post #14
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
double a=4.0;
double i;
double arg=0.0;
short int sign=0;
float start;
float stop;
float results;
if (argc>1) arg=strtod(argv[1], NULL);
if (arg<10000.0)
{
arg=10000.0;
printf("Usage: PI [10000.0-10000000.0]\n\n");
}
printf("Calculating using %f cycles. Please wait and dont move a mouse... \n\n",arg);
start=(float)clock()/CLOCKS_PER_SEC;
for (i=3.0;i<arg;i+=2.0)
{
if (sign==0)
{
a-=(4.0/i);
sign=1;
}
else
{
a+=(4.0/i);
sign=0;
}
}
stop=(float)clock()/CLOCKS_PER_SEC;
results=(stop-start);
printf("PI = %1.20f \n",a);
printf("Cycles = %f \n",arg);
printf("Calculation time: %4.10f sec.\n",results);
return 0;
}@pong777, post #19
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
double a=4.0;
double i;
double arg=0.0;
short int sign=0;
float start;
float stop;
float results;
if (argc>1) arg=strtod(argv[1], NULL);
if (arg<10000.0)
{
arg=10000.0;
printf("Usage: PI [10000.0-10000000.0]\n\n");
}
printf("Calculating using %f cycles. Please wait and dont move a mouse... \n\n",arg);
start=(float)clock()/CLOCKS_PER_SEC;
printf("Start time: %f\n",start);
for (i=3.0;i<arg;i+=2.0)
{
if (sign==0)
{
a-=(4.0/i);
sign=1;
}
else
{
a+=(4.0/i);
sign=0;
}
}
stop=(float)clock()/CLOCKS_PER_SEC;
results=(stop-start);
printf("End time = %f\n",stop);
printf("Clocks per sec = %f\n",(float)CLOCKS_PER_SEC);
printf("Clock = %f\n",(float)clock());
printf("PI = %1.20f \n",a);
printf("Cycles = %f \n",arg);
printf("Calculation time = %4.10f sec. \n",results);
return 0;
}@pong777, post #20
nie działa funkcja clock()
@pong777, post #26
Np. PI wyświetla jako: 3.142,-3-+4./0..100000
Cycles natomiast zamiast 100000.0 to 100000.000001