ときどきの雑記帖 RE* (新南口)
前略、道の上より
今週のしずえさん
カウチってどんな椅子?
解体
「日本一の高層ビル」閉館 浜松町の世界貿易センター | 共同通信
どういう手順で解体するのかに興味がある。 海外でよく(?)あるような爆破解体は無理だろうし、じゃあ解体用のクレーンを組んで…とかだと どこにどのようにクレーンを設置するのかとか。
sava! : 浜松町駅周辺の再開発で世界貿易センタービルの解体がカウントダウン。夜景を見るなら急がねば。
超高層建築物の解体といえば、赤坂プリンスホテルが記憶に新しいのですが、あれはスゴイですね。 だるま落としのように順番に階を削って行く解体方法で、大成建設の「テコレップシステム」(赤プリは大成の工法) や鹿島建設の「鹿島カットアンドダウン工法」、竹中工務店の「竹中HAT DOWN工法」、大林組の「QBカットオフ工法」などがそれにあたります。 映像を見るとその凄さが分かるかも。
- 2013.05 超高層建築解体工法「テコレップシステム」が日本建築学会賞(技術)を受賞│de’-TAISEI DESIGN
- 超高層建物の新解体工法「テコレップシステム」を開発 | 2009年度 | 大成建設株式会社
- テコレップシステム (第14回国土技術開発賞 最優秀賞)
- 発電しながら静かにビルを「縮める」日本の工法 | WIRED.jp
で
東京タワーとかスカイツリーみたいのは 解体するとしたらどうやるんだろう?
皇国の守護者
個人的な感想だけど皇国の守護者は未完と言えば未完だけど完結してると言っても過言ではない気はする
— 近江屋 (@wot_tetoku) July 2, 2021
後の流れも読みたかったけど大筋は既に語られてる内容ではあるわけだし#大サトー
わたしもこの見方に賛成。 あのあとを(無理やり)続けても 「反三国志」みたいになるのがオチだと思う (「反三国志」や「超三国志」を好きな人がここを読んでいたらごめんなさい)。
3602879701896397
某所
で見かけてちょっと気になったのだけど
p 0.1.to_r # => (3602879701896397/36028797018963968
について。
$ ruby -e 'puts 3602879701896397.to_s(16)'
c_cccc_cccc_cccd
$ ruby -e 'puts 36028797018963968.to_s(16)'
80_0000_0000_0000
ここまできてようやくひらめいた(鈍い)けど、 なんとなくどこかで見たような数字だと思ったらこれか!
15. 浮動小数点演算、その問題と制限 — Python 3.9.4 ドキュメント
どこか有限の桁で止めると、近似値を得ることになります。近年の殆どのコンピュータでは float 型は、 最上位ビットから数えて最初の 53 ビットを分子、2 の冪乗を分母とした、二進小数で近似されます。 1/10 の場合は、二進小数は 3602879701896397 / 2 ** 55 となります。これは、1/10 に近いですが、厳密に同じ値ではありません。
そういえばdtoaの話、途中で放り投げてたような。
f2c
ネットを見ていると、c/c++ only で Fortran なんかいらねーと言われているプログラムでも、 結構多くの FORTRAN77 の数値計算サブルーチンが f2c で利用されているらしく、 普段は FORTRAN77 は古臭くて糞と罵っているのに、いざサブルーチン・ライブラリが近代化改修で Fortran90/95 以降で書かれると、 今度は f2c で変換できないふざけんなと罵っていて草。
f2cってずいぶん昔からあるけど、今でも使われているのかというのにちょっとした驚き。 たしかGNU Fortranを作ろうという話があったときにf2cのこの挙動が理解や説明できるか といった「問題」を作業志願者に出していたような記憶が。
あと、使われているということはメンテもされているんだろうか?
f2cの更新状況
ということでざっと調べてみた。
netlib/f2c が公式サイトらしく、そこにある changes をみると、頻度はそれほどでもないけど最近も修正が入っているようだ。 最後の方からいくつかみるとこう(そういえばこのファイル、 ChangeLogとは逆に古い方から並んでいるのね)。
20160102
malloc.c: use memmove rather than memcpy in realloc().
20181026
Fix an allocation glitch in proc.c:
1149c1149
< size = sizeof(int) + (3 + 2 * nd) * sizeof (expptr);
---
> size = sizeof(struct Dimblock) + 2*sizeof(expptr)*(nd-1);
Thanks to Ole Streicher for pointing out the need for this change.
20190311
main.c: update URL's in "f2c -?" and "f2c --help" output.
20191129
pread.c: fix a glitch not known to have caused any trouble:
355c355
< if (c < '0' && c > '9')
---
> if (c < '0' || c > '9')
20200425
sysdeptest.c: add #include <stdlib.h>
20200916
data.c exec.c format.c formatdata.c ftypes.h mem.c output.c
p1output.c proc.c sysdep.c: introduce type Addr, an unsigned
integer type that can hold an address. The changes allow compilation
of the f2c source on platforms that actually use more than 32 bits
for addresses. (Many 64-bit platforms keep addresses <= 32 bits
long when possible. One that does not and for which today's changes
are relevant is Microsoft Windows with Microsoft's cl compiler.)
ruby の数値の等値
ruby/numeric.c at master · ruby/ruby
rb_define_method(rb_cFloat, "==", flo_eq, 1);
rb_define_method(rb_cFloat, "===", flo_eq, 1);
ruby/numeric.c at master · ruby/ruby
#define flo_eq rb_float_equal
MJIT_FUNC_EXPORTED VALUE
rb_float_equal(VALUE x, VALUE y)
{
volatile double a, b;
if (RB_TYPE_P(y, T_FIXNUM) || RB_TYPE_P(y, T_BIGNUM)) {
return rb_integer_float_eq(y, x);
}
else if (RB_TYPE_P(y, T_FLOAT)) {
b = RFLOAT_VALUE(y);
#if MSC_VERSION_BEFORE(1300)
if (isnan(b)) return Qfalse;
#endif
}
else {
return num_equal(x, y);
}
a = RFLOAT_VALUE(x);
#if MSC_VERSION_BEFORE(1300)
if (isnan(a)) return Qfalse;
#endif
return (a == b)?Qtrue:Qfalse;
}
ruby/bignum.c at d92f09a5eea009fa28cd046e9d0eb698e3d94c5c · ruby/ruby
VALUE
rb_integer_float_eq(VALUE x, VALUE y)
{
double yd = RFLOAT_VALUE(y);
double yi, yf;
if (isnan(yd) || isinf(yd))
return Qfalse;
yf = modf(yd, &yi);
if (yf != 0)
return Qfalse;
if (FIXNUM_P(x)) {
#if SIZEOF_LONG * CHAR_BIT < DBL_MANT_DIG /* assume FLT_RADIX == 2 */
double xd = (double)FIX2LONG(x);
if (xd != yd)
return Qfalse;
return Qtrue;
#else
long xn, yn;
if (yi < LONG_MIN || LONG_MAX_as_double <= yi)
return Qfalse;
xn = FIX2LONG(x);
yn = (long)yi;
if (xn != yn)
return Qfalse;
return Qtrue;
#endif
}
y = rb_dbl2big(yi);
return rb_big_eq(x, y);
}
Texinfo
Texinfoの新バージョンがリリースされたというニュースで
MathJax対応やパフォーマンス向上を図ったTexinfo v6.8 | TECH+
GNUは米国時間2021年7月3日、「GNU Texinfo」のバージョン6.8完成をメーリングリストで報告した。 ソースコードはGNUのミラーサイトからダウンロードできる。
バージョン6.8では、texi2anyのHTML出力時に数式をサポートするMathJaxや、PerlのParser:XSが既定で有効にすることでパフォーマンスを向上させた。 また、多くのツールをPerlベースからCベースに移行することで、同様のパフォーマンス向上を期待できる。
https://lists.gnu.org/archive/html/info-gnu/2021-07/msg00000.html
とあったのだけど、処理速度は二の次でPerl使うようにしたんじゃなかったっけ? >多くのツールをPerlベースからCベースに移行することで、同様のパフォーマンス向上を期待できる
本の虫: GNU Texinfoのmakeinfoの実装がCからPerlになった
2013年2月16日に、実に5年ぶりに、GNU Texinfoがバージョン5に更新された。前回の更新は、2008年9月18日のバージョン4.13だ。
2012年中に、Texinfoのうち、従来Cで実装されていたtexi2anyとmakeinfoを、Perlで再実装したそうだ。
Perlで実装したことにより、プログラムは遅くなったが、コードが平易になり、開発に新規参入しやすくなり、拡張もしやすくなったという。 また、Unicodeへの対応も、Cでは難しいが、Perlならばとても簡単になる。
これこれ。
んで、 NEWS の今回のバージョンアップに関しては
6.8 (3 July 2021)
* texi2any
. should be faster as Perl XS parser is enabled by default
. SHOW_MENU customization variable replaced by FORMAT_MENU.
FORMAT_MENU set to 'menu' is the same as SHOW_MENU set to 1, and
FORMAT_MENU set to 'nomenu' is the same as SHOW_MENU set to 0.
. only check menu structure if CHECK_NORMAL_MENU_STRUCTURE variable is set
. changes to HTML output:
. MathJax support for display of math. new variables HTML_MATH,
MATHJAX_SCRIPT and MATHJAX_SOURCE.
. new variables JS_WEBLABELS and JS_WEBLABELS_FILE to support
JavaScript License Web Labels
. by default, use sectional tables of contents instead of menus
. use section names in links by default (configure with
xrefautomaticsectiontitle customization variable)
. CONTENTS_OUTPUT_LOCATION sets location of table of contents
. document sections wrapped in <div> elements
. new variable USE_NODE_DIRECTIONS to use node or section structure
for node directions
. copiable anchor links for definitions with COPIABLE_ANCHORS variable
. experimental JavaScript browsing interface enabled with INFO_JS_DIR
. don't add an extra period before file extension given as an argument
to @image if image file is not found
てな感じで今回特にCで書き直した(部分が増えた)みたいな記述はないし、 XSを使うようになったのは(6.0ではなく)6.1の時点ぽい。
6.1 (06 February 2016)
* texi2any:
. Some Perl modules have been rewritten in C to increase speed.
If Perl extensions can be created, they are used by default;
otherwise the pure Perl implementations are still used.
Disable at build time with "configure --disable-perl-xs". The
environment variable TEXINFO_XS controls how they are used by
texi2any.
texinfo.git - GNU Texinfo - software documentation system
そもそも「多くのツール」って(Texinfoに含まれている)どれとどれのことを言っているんだろう?
Blitsort
メモ。
- Blitsort: A new in-place stable sorting algorithm faster than quicksort : programming
- scandum/blitsort: Blitsort is an in-place stable adaptive rotate merge sort
Blitsort is a rotate merge sort based on quadsort.
Quadsort is a stable adaptive merge sort which is faster than quicksort.
エクセルの四捨五入
エクセルの四捨五入 -エクセルについて質問させて下さい。 エクセルで下記式- | OKWAVE
glob zsh 2
色々構造体が定義されている。
typedef struct gmatch *Gmatch;
struct gmatch {
/* Metafied file name */
char *name;
/* Unmetafied file name; embedded nulls can't occur in file names */
char *uname;
/*
* Array of sort strings: one for each GS_EXEC sort type in
* the glob qualifiers.
*/
char **sortstrs;
off_t size ALIGN64;
long atime;
long mtime;
long ctime;
long links;
off_t _size ALIGN64;
long _atime;
long _mtime;
long _ctime;
long _links;
#ifdef GET_ST_ATIME_NSEC
long ansec;
long _ansec;
#endif
#ifdef GET_ST_MTIME_NSEC
long mnsec;
long _mnsec;
#endif
#ifdef GET_ST_CTIME_NSEC
long cnsec;
long _cnsec;
#endif
};
struct qual {
struct qual *next; /* Next qualifier, must match */
struct qual *or; /* Alternative set of qualifiers to match */
TestMatchFunc func; /* Function to call to test match */
off_t data ALIGN64; /* Argument passed to function */
int sense; /* Whether asserting or negating */
int amc; /* Flag for which time to test (a, m, c) */
int range; /* Whether to test <, > or = (as per signum) */
int units; /* Multiplier for time or size, respectively */
char *sdata; /* currently only: expression to eval */
};
/* Prefix, suffix for doing zle trickery */
/**/
mod_export char *glob_pre, *glob_suf;
/* Element of a glob sort */
struct globsort {
/* Sort type */
int tp;
/* Sort code to eval, if type is GS_EXEC */
char *exec;
};
/* Maximum entries in sort array */
#define MAX_SORTS (12)
/* struct to easily save/restore current state */
struct globdata {
int gd_pathpos;
char *gd_pathbuf;
int gd_matchsz; /* size of matchbuf */
int gd_matchct; /* number of matches found */
int gd_pathbufsz; /* size of pathbuf */
int gd_pathbufcwd; /* where did we chdir()'ed */
Gmatch gd_matchbuf; /* array of matches */
Gmatch gd_matchptr; /* &matchbuf[matchct] */
char *gd_colonmod; /* colon modifiers in qualifier list */
/* Qualifiers pertaining to current pattern */
struct qual *gd_quals;
/* Other state values for current pattern */
int gd_qualct, gd_qualorct;
int gd_range, gd_amc, gd_units;
int gd_gf_nullglob, gd_gf_markdirs, gd_gf_noglobdots, gd_gf_listtypes;
int gd_gf_numsort;
int gd_gf_follow, gd_gf_sorts, gd_gf_nsorts;
struct globsort gd_gf_sortlist[MAX_SORTS];
LinkList gd_gf_pre_words, gd_gf_post_words;
char *gd_glob_pre, *gd_glob_suf;
};
上記の構造体を通して管理している情報にアクセスするのにこんなマクロを定義。
/* The variable with the current globbing state and convenience macros */
static struct globdata curglobdata;
#define matchsz (curglobdata.gd_matchsz)
#define matchct (curglobdata.gd_matchct)
#define pathbufsz (curglobdata.gd_pathbufsz)
#define pathbufcwd (curglobdata.gd_pathbufcwd)
#define matchbuf (curglobdata.gd_matchbuf)
#define matchptr (curglobdata.gd_matchptr)
#define colonmod (curglobdata.gd_colonmod)
#define quals (curglobdata.gd_quals)
#define qualct (curglobdata.gd_qualct)
#define qualorct (curglobdata.gd_qualorct)
#define g_range (curglobdata.gd_range)
#define g_amc (curglobdata.gd_amc)
#define g_units (curglobdata.gd_units)
#define gf_nullglob (curglobdata.gd_gf_nullglob)
#define gf_markdirs (curglobdata.gd_gf_markdirs)
#define gf_noglobdots (curglobdata.gd_gf_noglobdots)
#define gf_listtypes (curglobdata.gd_gf_listtypes)
#define gf_numsort (curglobdata.gd_gf_numsort)
#define gf_follow (curglobdata.gd_gf_follow)
#define gf_sorts (curglobdata.gd_gf_sorts)
#define gf_nsorts (curglobdata.gd_gf_nsorts)
#define gf_sortlist (curglobdata.gd_gf_sortlist)
#define gf_pre_words (curglobdata.gd_gf_pre_words)
#define gf_post_words (curglobdata.gd_gf_post_words)
/* and macros for save/restore */
#define save_globstate(N) \
do { \
queue_signals(); \
memcpy(&(N), &curglobdata, sizeof(struct globdata)); \
(N).gd_pathpos = pathpos; \
(N).gd_pathbuf = pathbuf; \
(N).gd_glob_pre = glob_pre; \
(N).gd_glob_suf = glob_suf; \
pathbuf = NULL; \
unqueue_signals(); \
} while (0)
#define restore_globstate(N) \
do { \
queue_signals(); \
zfree(pathbuf, pathbufsz); \
memcpy(&curglobdata, &(N), sizeof(struct globdata)); \
pathpos = (N).gd_pathpos; \
pathbuf = (N).gd_pathbuf; \
glob_pre = (N).gd_glob_pre; \
glob_suf = (N).gd_glob_suf; \
unqueue_signals(); \
} while (0)
/* pathname component in filename patterns */
struct complist {
Complist next;
Patprog pat;
int closure; /* 1 if this is a (foo/)# */
int follow; /* 1 to go thru symlinks */
};
space
ruby-trunk-changes 2021-07-10 - ruby trunk changes
[289fd3c801] Jeremy Evans 2021-07-10 04:44:01 UTC
irb が « メソッドの右辺(引数)とのあいだの空白を省くと誤ってヒアドキュメントと解釈してしまうことがあったので、 字句解析時に Binding のローカル変数名リストを渡して « の引数にローカル変数が書かれてた時にヒアドキュメントにならないようにする修正です。 わざわざダミーの代入文を頭にくっつけて Ripper::Lexer に渡すということをしてて、 文脈で tokenize が変わる ruby の文法をエミュレートするのは大変ですね。 [ruby-core:102036] [Bug #17530]