From owner-freebsd-amd64@FreeBSD.ORG Tue Dec 21 02:20:39 2004 Return-Path: Delivered-To: freebsd-amd64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9BAB816A4CE for ; Tue, 21 Dec 2004 02:20:39 +0000 (GMT) Received: from mail.jrv.org (rrcs-24-73-246-106.sw.biz.rr.com [24.73.246.106]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3067A43D4C for ; Tue, 21 Dec 2004 02:20:39 +0000 (GMT) (envelope-from james@jrv.org) Received: from [192.168.3.156] (zippy.housenet.jrv [192.168.3.156]) (authenticated bits=0) by mail.jrv.org (8.12.11/8.12.10) with ESMTP id iBL2Kb8M077889; Mon, 20 Dec 2004 20:20:37 -0600 (CST) (envelope-from james@jrv.org) Message-ID: <41C78875.1000100@jrv.org> Date: Mon, 20 Dec 2004 20:20:37 -0600 From: "James R. Van Artsalen" User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Brooks Davis References: <41C778CD.1080602@jrv.org> <20041221014754.GA13070@odin.ac.hmc.edu> In-Reply-To: <20041221014754.GA13070@odin.ac.hmc.edu> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit cc: freebsd-amd64@freebsd.org Subject: Re: /usr/games/random bug? X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Dec 2004 02:20:39 -0000 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