hack のためのネタ帳, etc,,,


そう言えば、Cygwin の math.h 系関数で IEEE754 の丸めモードにバグがあって fenv.h の fesetround() が機能してない件の bug fix
折角原因特定したのに英語書くのや ML にメアド晒して SPAM 増えるのが面倒で報告放置してたの思い出して確認してみたんだけど
$ git init
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:   git config --global init.defaultBranch <name>
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:   git branch -m <name>
Initialized empty Git repository in /cygdrive/c/Users/kou/git/cygwin-round-direction/newlib-cygwin/.git/
$ git remote add origin https://cygwin.com/git/newlib-cygwin.git
$ git fetch --depth 1 origin master
remote: Enumerating objects: 7922, done.
remote: Counting objects: 100% (7922/7922), done.
remote: Compressing objects: 100% (5829/5829), done.
remote: Total 7922 (delta 3378), reused 3764 (delta 1994), pack-reused 0
Receiving objects: 100% (7922/7922), 15.60 MiB | 857.00 KiB/s, done.
Resolving deltas: 100% (3378/3378), done.
From https://cygwin.com/git/newlib-cygwin
 * branch            master     -> FETCH_HEAD
 * [new branch]      master     -> origin/master
$ git checkout master
Updating files: 100% (8054/8054), done.
Branch 'master' set up to track remote branch 'master' from 'origin'.
Already on 'master'
$ git log
commit 65d68186614ecb0446febf2efb3025ee2578cc97 (grafted, HEAD -> master, origin/master)
Author: Ken Brown <kbrown@cornell.edu>
Date:   Fri Oct 22 13:56:05 2021 -0400

    Cygwin: document sig2str and str2sig in version.h
$ grep -ER 'const.*tiny' .
./newlib/libc/stdlib/mprec.c:const double tinytens[] =
./newlib/libc/stdlib/mprec.c:const double tinytens[] =
./newlib/libc/stdlib/mprec.h:extern const double tinytens[];
./newlib/libc/stdlib/strtod.c:static const double tinytens[] = { 1e-16, 1e-32,
./newlib/libm/math/ef_sqrt.c:static     const volatile float    one     = 1.0, tiny=1.0e-30;
./newlib/libm/math/e_sqrt.c:static      const volatile double   one     = 1.0, tiny=1.0e-300;
./newlib/libm/math/sf_tanh.c:static const volatile float one=1.0, two=2.0, tiny = 1.0e-30;
./newlib/libm/math/s_tanh.c:static const volatile double one=1.0, two=2.0, tiny = 1.0e-300;
ちゃんと valatile が付いてるぞと。

unshallow して当該の commit を捜索してみたところ、英語面倒臭くてノロノロしてる間に 4 カ月ちょっと前、2021-06-04 のこの辺りの commit で先を越されてた模様 orz
$ git log a9165ea07ce3a99bbfd294ada9c0fd54db738bb9 -1
commit a9165ea07ce3a99bbfd294ada9c0fd54db738bb9
Author: Jeff Johnston <jjohnstn@redhat.com>
Date:   Fri Jun 4 14:36:38 2021 -0400

    Fix rounding issues with sqrt/sqrtf

    - compiler is sometimes optimizing out the rounding check in
      e_sqrt.c and ef_sqrt.c which uses two constants to create
      an inexact operation
    - there is a similar constant operation in s_tanh.c/sf_tanh.c
    - make the one and tiny constants volatile to stop this

しかし、残念なことに手元の Cygwin を確認してみると
$ uname -srvmo
CYGWIN_NT-10.0 3.2.0(0.340/5/3) 2021-03-29 08:42 x86_64 Cygwin
$ git log -1 cygwin-3_2_0-release
commit f578883232d578bd83132f1f94a7f6826a74048e (tag: cygwin-3_2_0-release)
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Tue Mar 23 16:54:23 2021 +0100

    Cygwin: add "app execution aliases" treatment to release notes

    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
の通り、2021-03-24 の commit なので現行バージョンの Cygwin にはまだこの変更が反映されていないという結果なのであった。

と言う事で、 によると本日現在の状況は
VersionPackage SizeDateFilesStatus
3.2.0-12113 KiB2021-03-29 17:37[list of files]stable
3.3.0-0.1.9814cfd8f6932175 KiB2021-09-17 19:38[list of files]test
3.3.0-0.2.6c1f49f83fde2176 KiB2021-09-25 01:38[list of files]test
であったので、IEEE754 丸めモードのバグフィックスは次期バージョンの Cygwin 3.3.0 には適用されそうな雰囲気である。






< >