projects
/
pspp
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
718d2a113bb1f593a43487d10469933dd1757f95
[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[] = { 0xc3, 0xe2, 0xb7, 0xc2, 0xb0, 0xe1, 0xb0, 0xfa };
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
}