Subject: Re: conversion u_int64_t -> double
To: None <and@genesyslab.com, eeh@netbsd.org>
From: None <eeh@netbsd.org>
List: port-sparc64
Date: 02/15/2001 06:41:18
	On 13 Feb 2001 eeh@netbsd.org wrote:

	> 
	> 	Here is a test:
	> 
	> 	#include <stdio.h>
	> 	main()
	> 	{
	> 		unsigned long int i1 = 1;
	> 		double c1;
	> 
	> 		c1 = i1;
	> 
	> 		printf("%g\n", c1);
	> 	}
	> 
	> 
	> 	I got 4.94066e-324. Not good. Too little:-).
	> 
	> 	Is that known problem? Is there known remedy to it?
	> 
	> 	int64_t -> double works.
	> 
	> That does not appear to be a problem on my machine.
	> Try upgrading to the latest -current snapshot and 
	> rebuilding the toolchain.

	Upgrade didn't help.
	What is your machine? Could you please send me 
Ultra 1
	assembler output for the test above, it could give me some
	pointers.
Here:

        .file   "foo.c"
.section        ".rodata"
        .align 8
.LLC1:
        .asciz  "%g\n"
.section        ".text"
        .align 4
        .global main
        .type    main,@function
        .proc   04
main:
        !#PROLOGUE# 0
        save    %sp, -192, %sp
        !#PROLOGUE# 1
        sethi   %hi(.LLC1), %o0
        mov     1023, %o1
        add     %o0, %g4, %o0
        sllx    %o1, 52, %o1
        call    printf, 0
        add     %o0, %lo(.LLC1), %o0
        return  %i7+8
        nop
.LLfe1:
        .size    main,.LLfe1-main
        .ident  "GCC: (GNU) 2.95.2 19991024 (release)"

	BTW the problem is very noticable on my machine:
	vmstat,iostat,gprof print [Inf] or [NaN] all the time.

Try rebuilding gcc.

Eduardo