mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Justin Cormack <justin-7CuHE+YKekf/05JY2t+omGXnswh1EIUO@public.gmane.org>
To: "Nadav Har'El" <nyh-RmZWMc9puTNJc61us3aD9laTQe2KTcn/@public.gmane.org>
Cc: musl-ZwoEplunGu1jrUoiu81ncdBPR1lH4CV8@public.gmane.org,
	Osv Dev <osv-dev-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: drand48() gives wrong sequence?
Date: Sun, 21 Sep 2014 14:27:28 +0100	[thread overview]
Message-ID: <CAK4o1WxR7gBi-54sp2cOS0DmRDt=H5CcYuvovxneJjyxD-4B2A@mail.gmail.com> (raw)
In-Reply-To: <CANEVyjv9wwEBibFjqV7XTLzBU2BLvpVPzvxig7ArGceOfpzY7w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Sun, Sep 21, 2014 at 12:45 PM, Nadav Har'El <nyh-RmZWMc9puTNJc61us3aD9laTQe2KTcn/@public.gmane.org> wrote:
> Hi, I ran the following trivial program on both glibc (on Linux), and Musl
> (on OSv).
>
> #include <stdio.h>
> #include <stdlib.h>
>
> 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.


  parent reply	other threads:[~2014-09-21 13:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-21 11:45 Nadav Har'El
2014-09-21 12:02 ` Jens Gustedt
     [not found] ` <CANEVyjv9wwEBibFjqV7XTLzBU2BLvpVPzvxig7ArGceOfpzY7w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-09-21 13:27   ` Justin Cormack [this message]
2014-09-21 13:45     ` Jens Gustedt
2014-09-21 13:57       ` Jens Gustedt
2014-09-21 14:23         ` Jens Gustedt
2014-09-21 12:20 Nadav Har'El

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAK4o1WxR7gBi-54sp2cOS0DmRDt=H5CcYuvovxneJjyxD-4B2A@mail.gmail.com' \
    --to=justin-7cuhe+ykekf/05jy2t+omgxnswh1eiuo@public.gmane.org \
    --cc=musl-ZwoEplunGu1jrUoiu81ncdBPR1lH4CV8@public.gmane.org \
    --cc=nyh-RmZWMc9puTNJc61us3aD9laTQe2KTcn/@public.gmane.org \
    --cc=osv-dev-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).