mirror of https://github.com/tongzx/nt5src
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
448 B
22 lines
448 B
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <math.h>
|
|
|
|
int __cdecl main(int argc, char **argv)
|
|
{
|
|
unsigned long ul[2];
|
|
double *pf;
|
|
|
|
if (argc <= 1)
|
|
printf("usage: hex2f [32-bit hex number] ==> output is float val\n");
|
|
else
|
|
{
|
|
ul[1] = strtoul(argv[1], 0, 16);
|
|
ul[0] = strtoul(argv[2], 0, 16);
|
|
pf = (double *) ul;
|
|
|
|
printf("0x%08lx%08lx = %.50f", ul[1], ul[0], *pf);
|
|
}
|
|
|
|
return -1;
|
|
}
|