From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/6173 Path: news.gmane.org!not-for-mail From: "Nadav Har'El" Newsgroups: gmane.os.osv.devel,gmane.linux.lib.musl.general Subject: drand48() gives wrong sequence? Date: Sun, 21 Sep 2014 14:45:57 +0300 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11c3d43cab2885050391e05c X-Trace: ger.gmane.org 1411299968 19084 80.91.229.3 (21 Sep 2014 11:46:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 21 Sep 2014 11:46:08 +0000 (UTC) Cc: Osv Dev To: musl-ZwoEplunGu1jrUoiu81ncdBPR1lH4CV8@public.gmane.org Original-X-From: osv-dev+bncBD5KJGHQUECBB6PU7KQAKGQE3GOCDEI-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sun Sep 21 13:46:03 2014 Return-path: Envelope-to: goo-osv-dev@m.gmane.org Original-Received: from mail-ie0-f191.google.com ([209.85.223.191]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XVfac-0004xz-Uo for goo-osv-dev@m.gmane.org; Sun, 21 Sep 2014 13:46:03 +0200 Original-Received: by mail-ie0-f191.google.com with SMTP id tr6sf559601ieb.18 for ; Sun, 21 Sep 2014 04:46:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=mime-version: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=Nj9U8HbBoiW4xUmVp2psUAdiY5jhErIVy6Sg4rrIFzY=; b=xsr2lfwrWfZ+hd9OQ/fGZfnF8JZL8s4WdOctBe8/OlkvWbJRk497bQdlOj3AEzl/t/ CeUDGny1Q5DPx4nSFAFQZZYaLX9Pf4lbbdgyScGWZ33XDBijvXYipbSsFXGdJVM+3+D+ cIL1brOxz1smHiv8wn8K91IKoD9wljoJVpx9eGLwml7Sgaw8K+dRLictbVc/HTsD1hHf 5Ep90HzOmTbiWBBZf7Y8g51xUVCqG1xg7JjW/as1kZC4sFcwZ/4REJfRYD16wfSYBYfc dXjI48bOCe4sdegBRFHdwJ4g4CWWQf40UNdtFzTyI/eiSzPscZJp/hKf1PW5TzCt8Sla JYCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version: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=Nj9U8HbBoiW4xUmVp2psUAdiY5jhErIVy6Sg4rrIFzY=; b=DbHAuo7FgJdOUrby3Wa+aqVaABqU36qhOmdpH5t63u2R+eS6AhNqYRLAuyOSsZ5+rk C3pxOXwmBSefNej3VuG1mT6ZGfY7Cc9teQ1wcVZXFOm66L9EU/VsOsjzWi1QgCLL+RCW w/Aq3fdCH/fK8KnStqAtnj4B3nnrPfU7pQCYajo7jg/JfX+50FmMKGd/X/mOfp7L4UPW 6vY3Oo954dFfk4KGbyBmzjHXSG/io1OJXwx5W6ccAeC7ZxnEmVPpwrzpK3XOuvEYyAI+ DTyAPN0APXK8d924YUvzhSWnB52gpr3rZK4FYUdtocl2/w/+TkvA4EIj3r4a108lnt+r g0Ww== X-Received: by 10.51.17.104 with SMTP id gd8mr89268igd.7.1411299962065; Sun, 21 Sep 2014 04:46:02 -0700 (PDT) X-BeenThere: osv-dev-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 10.50.138.36 with SMTP id qn4ls77118igb.8.gmail; Sun, 21 Sep 2014 04:45:58 -0700 (PDT) X-Received: by 10.50.118.100 with SMTP id kl4mr6862898igb.8.1411299958222; Sun, 21 Sep 2014 04:45:58 -0700 (PDT) Original-Received: from mail-pd0-f178.google.com (mail-pd0-f178.google.com [209.85.192.178]) by gmr-mx.google.com with ESMTPS id hz1si807308pbc.1.2014.09.21.04.45.58 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 21 Sep 2014 04:45:58 -0700 (PDT) Received-SPF: pass (google.com: domain of nyh-RmZWMc9puTNJc61us3aD9laTQe2KTcn/@public.gmane.org designates 209.85.192.178 as permitted sender) client-ip=209.85.192.178; Original-Received: by mail-pd0-f178.google.com with SMTP id ft15so2669100pdb.9 for ; Sun, 21 Sep 2014 04:45:58 -0700 (PDT) X-Gm-Message-State: ALoCoQlNz3/MZf/HkIkCX+M+641FiwQtDTgb4vZ8dfi+2v1D4ksMU1+Ttp40HoHeY6INhHQdj3rf X-Received: by 10.70.129.72 with SMTP id nu8mr18621741pdb.91.1411299958005; Sun, 21 Sep 2014 04:45:58 -0700 (PDT) Original-Received: by 10.66.90.165 with HTTP; Sun, 21 Sep 2014 04:45:57 -0700 (PDT) X-Original-Sender: nyh-RmZWMc9puTNJc61us3aD9laTQe2KTcn/@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of nyh-RmZWMc9puTNJc61us3aD9laTQe2KTcn/@public.gmane.org designates 209.85.192.178 as permitted sender) smtp.mail=nyh-RmZWMc9puTNJc61us3aD9laTQe2KTcn/@public.gmane.org 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:10200 gmane.linux.lib.musl.general:6173 Archived-At: --001a11c3d43cab2885050391e05c Content-Type: text/plain; charset=UTF-8 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? Thanks, Nadav. -- Nadav Har'El nyh-RmZWMc9puTNJc61us3aD9laTQe2KTcn/@public.gmane.org -- 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. --001a11c3d43cab2885050391e05c Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi, I ran the following trivial program on both glibc= (on Linux), and Musl (on OSv).

#include <stdio.h><= br>#include <stdlib.h>

int main() {=C2=A0=C2=A0
=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 srand48(12345);
=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 printf("%ld %ld %ld\n", lrand48(), lrand48(= ), lrand48());
}

Unfortunately, the sequence did not c= ome out the same: On glibc+Linux I got:

=C2=A0=C2=A0=C2=A0=C2=A0 444= 188209 1973930609 483889296

But on OSv+Musl I got:
=C2=A0=C2=A0=C2=A0=C2=A0 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 quic= kly, and it does seem to use these formulas.

Any ideas why I'm g= etting the wrong sequence?

Thanks,
Nadav.

--
You received this message because you are subscribed to the Google Groups &= quot;OSv Development" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to osv-dev+uns= ubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit http= s://groups.google.com/d/optout.
--001a11c3d43cab2885050391e05c--