mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Subject: Re: math argument reduction
Date: Sun, 26 Jun 2011 20:51:37 +0200	[thread overview]
Message-ID: <20110626185137.GY27421@port70.net> (raw)
In-Reply-To: <20110626183344.GX12592@brightrain.aerifal.cx>

* Rich Felker <dalias@aerifal.cx> [2011-06-26 14:33:44 -0400]:
> It's A%M and B%M, not A/M and B/M, which you have precalculated in
> your tables. And therefore, (A+B)%M is congruent to A%M + B%M. In
> general it could be outside the interval [0,M), but not by so much
> that it's hard to get a good answer.

the hard part is when there is a lot of leading zeros in the result

A%M + B%M can be just above M by a little so (A%M+B%M)%M is almost 0
eg: 0.00000000000000011111
to represent this number properly as float you need all those 1s eg
1.1111 * 2^-n

if A%M and B%M is not precise enough then those trailing 1s will get
lost so the abs value is about right but as a floating point value
the result does not have 53 correct bits..



      reply	other threads:[~2011-06-26 18:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-26 18:04 Szabolcs Nagy
2011-06-26 18:33 ` Rich Felker
2011-06-26 18:51   ` Szabolcs Nagy [this message]

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=20110626185137.GY27421@port70.net \
    --to=nsz@port70.net \
    --cc=musl@lists.openwall.com \
    /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).