gallivm: Use %.9g to print floats.

So that we can see them in their full denormalized glory.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
This commit is contained in:
José Fonseca 2012-07-11 20:23:52 +01:00
parent 5b8d80a783
commit 978807ef01
1 changed files with 6 additions and 3 deletions

View File

@ -83,8 +83,8 @@ lp_build_print_value(struct gallivm_state *gallivm,
LLVMTypeKind type_kind; LLVMTypeKind type_kind;
LLVMTypeRef type_ref; LLVMTypeRef type_ref;
LLVMValueRef params[2 + LP_MAX_VECTOR_LENGTH]; LLVMValueRef params[2 + LP_MAX_VECTOR_LENGTH];
char type_fmt[4] = " %x"; char type_fmt[6] = " %x";
char format[2 + 3 * LP_MAX_VECTOR_LENGTH + 2] = "%s"; char format[2 + 5 * LP_MAX_VECTOR_LENGTH + 2] = "%s";
unsigned length; unsigned length;
unsigned i; unsigned i;
@ -101,7 +101,10 @@ lp_build_print_value(struct gallivm_state *gallivm,
} }
if (type_kind == LLVMFloatTypeKind || type_kind == LLVMDoubleTypeKind) { if (type_kind == LLVMFloatTypeKind || type_kind == LLVMDoubleTypeKind) {
type_fmt[2] = 'f'; type_fmt[2] = '.';
type_fmt[3] = '9';
type_fmt[4] = 'g';
type_fmt[5] = '\0';
} else if (type_kind == LLVMIntegerTypeKind) { } else if (type_kind == LLVMIntegerTypeKind) {
if (LLVMGetIntTypeWidth(type_ref) == 8) { if (LLVMGetIntTypeWidth(type_ref) == 8) {
type_fmt[2] = 'u'; type_fmt[2] = 'u';