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.

21 lines
381 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 *pul;
  7. float f;
  8. if (argc <= 1)
  9. printf("usage: f2hex [float number] ==> output is hex\n");
  10. else
  11. {
  12. f = (float) strtod(argv[1], 0);
  13. pul = (unsigned long *) &f;
  14. printf("%f = 0x%08lx", f, *pul);
  15. }
  16. return -1;
  17. }