mirror of
https://github.com/LIV2/libnix.git
synced 2025-12-06 00:23:08 +00:00
enhanced test -> do something more than just a printf. Real pi calculation now
This commit is contained in:
parent
ce1c3d33c7
commit
0623ee66fc
@ -10,7 +10,7 @@ VAMOS = vamos
|
|||||||
|
|
||||||
NEED_68020_MESSAGE = 'CALL: 108 Alert( alertNum[d7]=00068020 )'
|
NEED_68020_MESSAGE = 'CALL: 108 Alert( alertNum[d7]=00068020 )'
|
||||||
NEED_68881_MESSAGE = 'CALL: 108 Alert( alertNum[d7]=00068881 )'
|
NEED_68881_MESSAGE = 'CALL: 108 Alert( alertNum[d7]=00068881 )'
|
||||||
NORMAL_MESSAGE ='Hello world, Pi=3.141593'
|
NORMAL_MESSAGE ='Hello world, Pi=3.14'
|
||||||
|
|
||||||
all: m68000 m68020 m68020_m68881 fbaserel_m68000 fbaserel_m68020 fbaserel_m68020_m68881 fbaserel32_m68020 fbaserel32_m68020_m68881 resident resident_m68020 resident_m68020_m68881 resident32_m68020 resident32_m68020_m68881
|
all: m68000 m68020 m68020_m68881 fbaserel_m68000 fbaserel_m68020 fbaserel_m68020_m68881 fbaserel32_m68020 fbaserel32_m68020_m68881 resident resident_m68020 resident_m68020_m68881 resident32_m68020 resident32_m68020_m68881
|
||||||
|
|
||||||
|
|||||||
@ -3,11 +3,25 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <math.h>
|
|
||||||
|
// taken from https://stackoverflow.com/questions/32672693/calculating-pi-with-taylor-method-c
|
||||||
|
|
||||||
|
|
||||||
|
double pi(int n) {
|
||||||
|
double sum = 0.0;
|
||||||
|
int sign = 1;
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < n; ++i) {
|
||||||
|
sum += sign/(2.0*i+1.0);
|
||||||
|
sign *= -1;
|
||||||
|
}
|
||||||
|
return 4.0*sum;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
printf("Hello world, Pi=%f\n",M_PI);
|
printf("Hello world, Pi=%1.2f\n",pi(1000));
|
||||||
|
|
||||||
#ifdef __HAVE_68881__
|
#ifdef __HAVE_68881__
|
||||||
printf("___HAVE_68881____defined...\n");
|
printf("___HAVE_68881____defined...\n");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user