summaryrefslogtreecommitdiff
path: root/userspace/test_math.c
blob: 9327c19691e6e85e8bb7823b1ba050d81c873c90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>

int main(int argc, char **argv) 
{
     time_t ltime;
     time(&ltime); 
     printf("the time is %s", ctime(&ltime));

     unsigned int seed=time(NULL);
     printf("seed = %u\n",seed);

     srand(seed);

     for(int i=0;i<10;i++)
     {
	 int r=rand()%100;
	 printf ("the random number is %i",r);
	 printf("sin(%i) = %f \n",r,sin(r));
     }


     return 0;
}