mailing list of musl libc
 help / color / mirror / code / Atom feed
From: newbie nullzwei <newbie-02@gmx.de>
To: musl@lists.openwall.com
Subject: [musl] DTOA: question about rendering / code pointer
Date: Tue, 16 May 2023 20:49:11 +0200	[thread overview]
Message-ID: <trinity-bca86804-7aa5-41f1-9113-e9665be288c5-1684262950994@3c-app-gmx-bap41> (raw)

( apologize - re-tweet - 'plain text', hope that will work better | 
apologize - re-tweet - now 'subscribed' - got the impression my
mails didn't make it through to the list while not subscribed? ) 
 
hello @ all, 
 
gnumeric uses musl dtoa for rendering, and a self constructed 
'brute force' concept to find 'shortet round tripping' figures mostly 
similar to https://www.exploringbinary.com/the-shortest-decimal-string-that-round-trips-may-not-be-the-nearest/ 
 
we face the same issue as mentioned there, some powers of two 
miss to get the shortest 'round tripping' string, but have assigned 
another one digit longer string. Forcing to one digit less produces a 
string one decimal off in last position, and not tripping back to 
the original double. 
 
Example: 0x1p-44 ( 2^-44 ) is rendered to 

5.6843418860808015E-14 when allowed 17 digits, for 
16 digits it switches to 5.68434188608080**1**E-14, which is 
not too bad as the 'exact' decimal weight of the binary representative 
is ~5.684341886080801486969E-14, thus undershot to ~15, but! 
it points to a different double, and 5.68434188608080**2**E-14 
would be a better choice as it round trips to the originating double 
value. Affected ~46 integral powers of two in doubles, many more 
with long doubles.   
 
Is there any hope musl could change that? provide it as an option? 
Or can anyone give a code pointer or nearer explanation to enable 
us to patch it for our 'exotic' use? 
 
best regards, TIA for any help. 
 
b. 

             reply	other threads:[~2023-05-16 19:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-16 18:49 newbie nullzwei [this message]
2023-05-16 19:36 ` Rich Felker
2023-05-16 19:46   ` alice
2023-05-17  7:41   ` Aw: " newbie nullzwei
2023-05-17 13:09     ` Rich Felker

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=trinity-bca86804-7aa5-41f1-9113-e9665be288c5-1684262950994@3c-app-gmx-bap41 \
    --to=newbie-02@gmx.de \
    --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).