Source code of Windows XP (NT5)
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

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <math.h>
  4. int __cdecl main(int argc, char **argv)
  5. {
  6. unsigned long ul[2];
  7. double *pf;
  8. if (argc <= 1)
  9. printf("usage: hex2f [32-bit hex number] ==> output is float val\n");
  10. else
  11. {
  12. ul[1] = strtoul(argv[1], 0, 16);
  13. ul[0] = strtoul(argv[2], 0, 16);
  14. pf = (double *) ul;
  15. printf("0x%08lx%08lx = %.50f", ul[1], ul[0], *pf);
  16. }
  17. return -1;
  18. }