porffor 0.0.0-05f898f → 0.0.0-151f80e

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/tmp.c CHANGED
@@ -6,30 +6,31 @@
6
6
 
7
7
  #include <stdio.h>
8
8
 
9
- double aux(double n, double acc1, double acc2) {
10
- if (n == 0e+0) {
11
- return acc1;
12
- }
13
- if (n == 1e+0) {
14
- return acc2;
15
- }
16
- return aux(n - 1e+0, acc2, acc1 + acc2);
17
- }
18
-
19
- double fib(double n) {
20
- return aux(n, 0e+0, 1e+0);
9
+ long long state0 = 1028798103;
10
+ long long state1 = 477374377;
11
+ double t = 0;
12
+
13
+ double inline __Math_random() {
14
+ long long s1 = 0;
15
+ long long s0 = 0;
16
+
17
+ s1 = state0;
18
+ state0 = (s0 = state1);
19
+ state1 = ((((s1 = (s1 ^ (s1 << 23)))) ^ s0) ^ (s1 >> 17)) ^ (s0 >> 26);
20
+ return ((double)((state1 + s0) & 2097151) / 2.097152e+6);
21
21
  }
22
22
 
23
- double test(double n, double count) {
24
- double res = 0;
23
+ double randoms(double max) {
24
+ double sum = 0;
25
25
  double i = 0;
26
26
 
27
+ sum = 0e+0;
27
28
  i = 0e+0;
28
- while (i < count) {
29
- res = fib(n);
29
+ while (i < max) {
30
+ sum = sum + __Math_random();
30
31
  i = i + 1e+0;
31
32
  }
32
- return res;
33
+ return sum;
33
34
  }
34
35
 
35
36
  double inline __performance_now() {
@@ -42,17 +43,19 @@ double inline __performance_now() {
42
43
  #else
43
44
  struct timespec _time;
44
45
  clock_gettime(CLOCK_MONOTONIC, &_time);
45
- _time_out = _time.tv_nsec / 1000000.;
46
+ _time_out = _time.tv_nsec / 1000000. + _time.tv_sec * 1000.;
46
47
  #endif
47
48
  return _time_out;
48
49
  }
49
50
 
50
- int main() {
51
- double t = 0;
51
+ void inline __console_log(double x) {
52
+ printf("%f\n", x);
53
+ printf("%c", (int)(1e+1));
54
+ }
52
55
 
56
+ int main() {
53
57
  t = __performance_now();
54
- // Sleep(1000);
55
- printf("%f\n", test(4.6e+1, 1e+7));
56
- printf("%f\n", (__performance_now() - t));
58
+ randoms(1e+5);
59
+ __console_log(__performance_now() - t);
57
60
  }
58
61