Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Dec 2004 20:20:37 -0600
From:      "James R. Van Artsalen" <james@jrv.org>
To:        Brooks Davis <brooks@one-eyed-alien.net>
Cc:        freebsd-amd64@freebsd.org
Subject:   Re: /usr/games/random bug?
Message-ID:  <41C78875.1000100@jrv.org>
In-Reply-To: <20041221014754.GA13070@odin.ac.hmc.edu>
References:  <41C778CD.1080602@jrv.org> <20041221014754.GA13070@odin.ac.hmc.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
Brooks Davis wrote:

>>       .p2align 3
>>.LC17:
>>       .long   0
>>       .long   1006632960
>>
>>       call    random
>>       cvtsi2sdq       %rax, %xmm0
>>       mulsd   24(%rsp), %xmm0
>>       mulsd   .LC17(%rip), %xmm0
>>       cvttsd2si       %xmm0, %eax
>>       jmp     .L1
>>    
>>
>I believe the code is bogus.  The code says, compute a long
>(denom*random) then divide it by the largest possiable value you can
>store in a long.
>

denom is a double.  random() is converted to a double and the arithmetic 
is floating point.

It does seem odd that it works on i386 FreeBSD-4



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?41C78875.1000100>