Subversion Repositories HelenOS-historic

Rev

Rev 1053 | Rev 1104 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1053 Rev 1062
Line 141... Line 141...
141
 
141
 
142
    printf("tid%d: pi*10e8=%d should be %d\n", THREAD->tid, (__native) (100000000*pi),(__native) PI_10e8);
142
    printf("tid%d: pi*10e8=%d should be %d\n", THREAD->tid, (__native) (100000000*pi),(__native) PI_10e8);
143
    atomic_inc(&threads_ok);
143
    atomic_inc(&threads_ok);
144
}
144
}
145
 
145
 
146
 
-
 
147
void test(void)
146
void test(void)
148
{
147
{
149
    thread_t *t;
148
    thread_t *t;
150
    int i;
149
    int i;
151
 
150
 
Line 153... Line 152...
153
 
152
 
154
    printf("FPU test #1\n");
153
    printf("FPU test #1\n");
155
    printf("Creating %d threads... ", THREADS);
154
    printf("Creating %d threads... ", THREADS);
156
 
155
 
157
    for (i=0; i<THREADS/2; i++) {  
156
    for (i=0; i<THREADS/2; i++) {  
158
        if (!(t = thread_create(e, NULL, TASK, 0)))
157
        if (!(t = thread_create(e, NULL, TASK, 0, "e")))
159
            panic("could not create thread\n");
158
            panic("could not create thread\n");
160
        thread_ready(t);
159
        thread_ready(t);
161
        if (!(t = thread_create(pi, NULL, TASK, 0)))
160
        if (!(t = thread_create(pi, NULL, TASK, 0, "pi")))
162
            panic("could not create thread\n");
161
            panic("could not create thread\n");
163
        thread_ready(t);
162
        thread_ready(t);
164
    }
163
    }
165
    printf("ok\n");
164
    printf("ok\n");
166
   
165
   
Line 170... Line 169...
170
    while (atomic_get(&threads_ok) != THREADS)
169
    while (atomic_get(&threads_ok) != THREADS)
171
        ;
170
        ;
172
       
171
       
173
    printf("Test passed.\n");
172
    printf("Test passed.\n");
174
}
173
}
175
 
-
 
176
/*
-
 
177
static void pi(void *data)
-
 
178
{
-
 
179
#undef PI_10e8 
-
 
180
#define PI_10e8 3141592
-
 
181
 
-
 
182
 
-
 
183
    int i;
-
 
184
    double lpi, pi;
-
 
185
    double n, ab, ad;
-
 
186
 
-
 
187
 
-
 
188
    printf("pi test\n");
-
 
189
 
-
 
190
    waitq_sleep(&can_start);
-
 
191
 
-
 
192
 
-
 
193
    for (i = 0; i<ATTEMPTS; i++) {
-
 
194
        lpi = -1;
-
 
195
        pi = 0;
-
 
196
 
-
 
197
        for (n=2, ab = sqrt(2); lpi != pi; n *= 2, ab = ad) {
-
 
198
            double sc, cd;
-
 
199
 
-
 
200
            sc = sqrt(1 - (ab*ab/4));
-
 
201
            cd = 1 - sc;
-
 
202
            ad = sqrt(ab*ab/4 + cd*cd);
-
 
203
            lpi = pi;
-
 
204
            pi = 2 * n * ad;
-
 
205
        }
-
 
206
 
-
 
207
        atomic_inc(&threads_ok);
-
 
208
        if((int)(1000000*pi)!=PI_10e8)
-
 
209
            panic("tid%d: pi*10e6=%d\n", THREAD->tid, (int) 1000000*pi);
-
 
210
    }
-
 
211
 
-
 
212
    printf("tid%d: pi*10e6=%d\n", THREAD->tid, (int) 1000000*pi);
-
 
213
}
-
 
214
*/
-