Skip to content

Instantly share code, notes, and snippets.

@kriegsman
Created November 3, 2014 18:33
Show Gist options
  • Save kriegsman/e455a46001208335ac17 to your computer and use it in GitHub Desktop.
Save kriegsman/e455a46001208335ac17 to your computer and use it in GitHub Desktop.
FLT_MAX and DBL_MAX on IA64
#include <float.h>
#include <stdio.h>
#include <string.h>
// Output from gcc on Intel x64, all default settings:
// - float's can be up to 46 characters in %f output,
// - double's can be up to 316 characters in %lf output.
//
//
// printf("%f", FLT_MAX) = 340282346638528859811704183484516925440.000000, (46 chars)
//
// printf("%lf", DBL_MAX) = 179769313486231570814527423731704356798070567525844996598
// 917476803157260780028538760589558632766878171540458953514
// 382464234321326889464182768467546703537516986049910576551
// 282076245490090389328944075868508455133942304583236903222
// 948165808559332123348274797826204144723168738177180919299
// 881250404026184124858368.000000, (316 chars)
int main()
{
char buf[10000];
sprintf(buf, "%f", FLT_MAX);
printf("printf(\"%%f\", FLT_MAX) = %s, (%ld chars)\n", buf, strlen(buf));
sprintf(buf, "%lf", DBL_MAX);
printf("printf(\"%%lf\", DBL_MAX) = %s, (%ld chars)\n", buf, strlen(buf));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment