projects
/
pspp
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
crosstabs-only also
[pspp]
/
dump-float.c
1
#include <stdint.h>
2
#include <stdio.h>
3
#include <string.h>
4
5
void
6
print_double (const uint8_t *b)
7
{
8
double d;
9
memcpy (&d, b, 8);
10
printf ("%f\n", d);
11
}
12
13
void
14
print_float (const uint8_t *b)
15
{
16
float d;
17
memcpy (&d, b, 4);
18
printf ("%f\n", d);
19
}
20
21
int
22
main (void)
23
{
24
uint8_t b[] = { 0, 0, 0, 0, 0, 0, 8, 0x40 };
25
int n = sizeof b;
26
for (int i = 0; i <= n - 8; i++)
27
print_double (b + i);
28
/*
29
for (int i = 0; i <= n - 4; i++)
30
print_float (b + i);
31
*/
32
return 0;
33
}