From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/6177 Path: news.gmane.org!not-for-mail From: Justin Cormack Newsgroups: gmane.os.osv.devel,gmane.linux.lib.musl.general Subject: Re: drand48() gives wrong sequence? Date: Sun, 21 Sep 2014 14:27:28 +0100 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1411306056 21977 80.91.229.3 (21 Sep 2014 13:27:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 21 Sep 2014 13:27:36 +0000 (UTC) Cc: musl-ZwoEplunGu1jrUoiu81ncdBPR1lH4CV8@public.gmane.org, Osv Dev To: "Nadav Har'El" Original-X-From: osv-dev+bncBDDL3MEUWIFBBQNE7OQAKGQE76QIIIA-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sun Sep 21 15:27:32 2014 Return-path: Envelope-to: goo-osv-dev@m.gmane.org Original-Received: from mail-wi0-f191.google.com ([209.85.212.191]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XVhAo-0000wc-8e for goo-osv-dev@m.gmane.org; Sun, 21 Sep 2014 15:27:30 +0200 Original-Received: by mail-wi0-f191.google.com with SMTP id n3sf139545wiv.8 for ; Sun, 21 Sep 2014 06:27:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive:sender :list-subscribe:list-unsubscribe:content-type; bh=IvjJKKV4p0Ckvx8Rhw6dYkKbYvHdela0ZNEDC+WScJM=; b=rZJ2iCDV1wbdH+TSdQzL2ZeagDMEgL6K12XWcoDfZyqyhWFcKhHWsZJwZNfafrD+u3 2teAnrbk2rsispytXc5J8jNTcJlAM73bWmPtk/7qr8MpyZ1h4L4Xw0qBB6sJf1ylg3MX WoiHv9C+TGOynvIVyAxmjwM03y8IvzXedViCyUB4HwfTO+FdG1FkbDZhzsvkiVxiwbV0 ep1sYYbqksWERrt6wdw4EyuSHTeRWYG1JGM339ViA735QheGHvbEdeJWBMmnvOrX5iaj FE3EpKKpcsFRT49/I8dguf15rzZjCRklUrElyzYT9hH2vZle2NuyXJKFNTatALGtsdLE 6zjA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=specialbusservice.com; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive:sender :list-subscribe:list-unsubscribe:content-type; bh=IvjJKKV4p0Ckvx8Rhw6dYkKbYvHdela0ZNEDC+WScJM=; b=V5qKRf4kT0hYzNJz7X3pb+lXjbSHiQ5FNZOK0YuQ7yZGVrZn9hAqdx/RBkZWM0BGSE FpGvbLoX037CHWGQbWhsmtbQ/3FB5wdQraSgKZiI1KipXQ5HDYxDR9E4R3L1DImtFokK FBQGHk+n4ae1hSz0D7ZGJDsajPsWgq7Fx94lI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:sender:list-subscribe :list-unsubscribe:content-type; bh=IvjJKKV4p0Ckvx8Rhw6dYkKbYvHdela0ZNEDC+WScJM=; b=HNjaeLNrnPQup3M6UGhVOL9vcvAmD7K/x1S4QYeezJLhAu8OiV1qU6ZYnmHANOuhi7 YZxaiJVqCsc17gVF3bv0zdmDKYkw7P/r1qvNpjB8b2kH18OHKQsGW1gLyO3MnIGDniQ1 6c4Yu1OU1jB9M4U2U6x8M5PHTu7WcW3kYb77HbjTig4US83Am+jc18iAVrJ54zl/UJHa XPUPOCg8jQBrEpZliQ7nd6fLBb/4uLPBHOr9Ik2BSWzHIC+6oP+Zxng2pmkj5iwddtxs Naj/0EyJNwXEWf49Wr1cshoW0M2DSQ7bznSpLkebL2atj2r7lMxHe6ZCAUVUBDXxWM+c zXxA== X-Received: by 10.180.74.172 with SMTP id u12mr25737wiv.4.1411306049945; Sun, 21 Sep 2014 06:27:29 -0700 (PDT) X-BeenThere: osv-dev-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 10.180.89.99 with SMTP id bn3ls294991wib.8.gmail; Sun, 21 Sep 2014 06:27:29 -0700 (PDT) X-Received: by 10.181.8.226 with SMTP id dn2mr1213597wid.4.1411306049305; Sun, 21 Sep 2014 06:27:29 -0700 (PDT) Original-Received: from mail-lb0-x22e.google.com (mail-lb0-x22e.google.com [2a00:1450:4010:c04::22e]) by gmr-mx.google.com with ESMTPS id fa3si1075366lbc.0.2014.09.21.06.27.28 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 21 Sep 2014 06:27:28 -0700 (PDT) Received-SPF: pass (google.com: domain of justin-7CuHE+YKekf/05JY2t+omGXnswh1EIUO@public.gmane.org designates 2a00:1450:4010:c04::22e as permitted sender) client-ip=2a00:1450:4010:c04::22e; Original-Received: by mail-lb0-x22e.google.com with SMTP id l4so5442834lbv.33 for ; Sun, 21 Sep 2014 06:27:28 -0700 (PDT) X-Gm-Message-State: ALoCoQlPCBzuR+zuLedqA/ncguXdgYePTev3BOAhn6ETMMiCRbppSrOiDlUyK+QcB7KRODnZk6Uw X-Received: by 10.152.42.173 with SMTP id p13mr19443728lal.23.1411306048709; Sun, 21 Sep 2014 06:27:28 -0700 (PDT) Original-Received: by 10.152.134.174 with HTTP; Sun, 21 Sep 2014 06:27:28 -0700 (PDT) In-Reply-To: X-Original-Sender: justin-7CuHE+YKekf/05JY2t+omGXnswh1EIUO@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of justin-7CuHE+YKekf/05JY2t+omGXnswh1EIUO@public.gmane.org designates 2a00:1450:4010:c04::22e as permitted sender) smtp.mail=justin-7CuHE+YKekf/05JY2t+omGXnswh1EIUO@public.gmane.org; dkim=pass header.i=@specialbusservice.com Precedence: list Mailing-list: list osv-dev-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact osv-dev+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Google-Group-Id: 701177940717 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.org gmane.os.osv.devel:10208 gmane.linux.lib.musl.general:6177 Archived-At: On Sun, Sep 21, 2014 at 12:45 PM, Nadav Har'El wrote: > Hi, I ran the following trivial program on both glibc (on Linux), and Musl > (on OSv). > > #include > #include > > int main() { > srand48(12345); > printf("%ld %ld %ld\n", lrand48(), lrand48(), lrand48()); > } > > Unfortunately, the sequence did not come out the same: On glibc+Linux I got: > > 444188209 1973930609 483889296 > > But on OSv+Musl I got: > > 1737082417 264424049 61706384 > > I expected to get the same sequence because both the drand48(3) man-page on > Linux and the drand48 specification in Posix > (http://pubs.opengroup.org/onlinepubs/9699919799/functions/drand48.html) are > pretty explicit about the formulas that should be used. I also looked at the > Musl code quickly, and it does seem to use these formulas. > > Any ideas why I'm getting the wrong sequence? Hmm, just checked on a non-OSv Musl system and get the same result as you. I also checked on NetBSD and FreeBSD and they give the same result as glibc, so I think there must be a Musl bug. -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to osv-dev+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/d/optout.