diff options
| author | Tyge Løvset <[email protected]> | 2020-10-02 07:04:35 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2020-10-02 07:04:35 +0200 |
| commit | 5a6bb1f5061a6ac75d70edf90f75dd976cfaba7d (patch) | |
| tree | 0231a274aa64b9acc880a264f6f7e39ea82f9538 /examples | |
| parent | b4561502823e9eb0c0f1160ea4cdb69118a86589 (diff) | |
| download | STC-modified-5a6bb1f5061a6ac75d70edf90f75dd976cfaba7d.tar.gz STC-modified-5a6bb1f5061a6ac75d70edf90f75dd976cfaba7d.zip | |
Fixed generic less function - only worked for int
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/heap.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/heap.c b/examples/heap.c index bca5f2e7..cc8d1df1 100644 --- a/examples/heap.c +++ b/examples/heap.c @@ -18,13 +18,13 @@ int main() pcg = crand_rng32_init(seed);
clock_t start = clock();
c_forrange (i, int, N)
- cvec_f_push_back(&pq, (float) crand_i32(&pcg));
+ cvec_f_push_back(&pq, (float) crand_f32(&pcg)*100000);
cpqueue_f_make_heap(&pq);
printf("Built priority queue: %f secs\n", (clock() - start) / (float) CLOCKS_PER_SEC);
c_forrange (i, int, M)
- printf("%.0f ", *cpqueue_f_top(&pq)), cpqueue_f_pop(&pq);
+ printf("%g ", *cpqueue_f_top(&pq)), cpqueue_f_pop(&pq);
start = clock();
c_forrange (i, int, M, N)
@@ -34,11 +34,11 @@ int main() pcg = crand_rng32_init(seed);
start = clock();
c_forrange (i, int, N)
- cpqueue_f_push(&pq, (float) crand_i32(&pcg));
+ cpqueue_f_push(&pq, (float) crand_f32(&pcg)*100000);
printf("pushed PQ: %f secs\n", (clock() - start) / (float) CLOCKS_PER_SEC);
c_forrange (i, int, M)
- printf("%.0f ", *cpqueue_f_top(&pq)), cpqueue_f_pop(&pq);
+ printf("%g ", *cpqueue_f_top(&pq)), cpqueue_f_pop(&pq);
puts("");
cpqueue_f_del(&pq);
|
