kwkblr

This is kwkbtr's Tumblelog.

A Fast, Compact Approximation of the Exponential Function

5 days ago

Fast Exponential Function in Java

The paper “A Fast, Compact Approximation of the Exponential Function” describes a C macro that does a good job at exploiting the IEEE 754 floating-point representation to calculate e^x. I have transformed the macro into Java code:

public static double exp(double val) {
final long tmp = (long) (1512775 * val + 1072632447);
return Double.longBitsToDouble(tmp « 32);
}

This code is 5.3 times faster than Math.exp() on my computer. Beware that it is only an approximation, for a detailed analysis read the paper.

Optimized Exponential Functions for Java | Martin Ankerl

The srandomdev() routine initializes a state array, using the random(4) random number device which returns good random numbers, suitable for cryptographic use.

Mac OS X Manual Page For srandomdev(3)

As a general point, stay away from google’s style guide. It has many questionable or outright WTF points. (At least it did a year ago, when I twitlisted it.)

Don’t pass by reference to non-const?

1カ月後に退院するとき、「先生、私死ぬまで病気したくないんですけど。どうすればいいんですか」って伺ったら、「好きなことだけやって生きていきなさい」っておっしゃったんです。「え、好きなことだけやって生きていくっていってもお金ないし」って答えたら、先生が「誰が遊んでなさいって言いましたか。自分が進んでやる仕事を選べば、疲れても寝れば肉体は治る。でも、嫌な仕事なら、嫌だなって思いが残ってよくない。それで病気になると僕は思う」とおっしゃったんです。ストレスという言葉がまだない時代にです。

トットちゃんが語る「生と死」 - 特集 - 本に出あう - BOOK asahi.com:朝日新聞社の書評サイト

ただ「人の悪口さえ言わなければこちらが攻撃されることはない」という私のスタンスは危うくもあります。他人の悪い面を見ないようにしているうち、他人の性格や発話自体に興味を失ってしまうのです。オイディプス王じゃないけれど、自分の目を潰してしまえば何も見なくて良いから楽なのですね。というわけで、かやは友達の悪い面を見なくなった代わりに、他人への興味も少し失って今に至ります。

スクールカーストを生き抜くためのキャラ - コスプレで女やってますけど

万能書見台のホームページへようこそ(新版)

書見台への熱い想い!

3 weeks ago

Javaの理論と実践: Generics、了解!

3 weeks ago

The fact that clone is protected is extremely dubious - as is the fact that the clone method is not declared in the Cloneable interface.

It makes the method pretty useless for taking copies of data because you cannot say:

if(a instanceof Cloneable) {
copy = ((Cloneable) a).clone();
}

I think that the design of Cloneable is now largely regarded as a mistake (citation below). I would normally want to be able to make implementations of an interface Cloneable but not necessarily make the interface Cloneable (similar to the use of Serializable). This cannot be done without reflection:

ISomething i = …
if (i instanceof Cloneable) {
//DAMN! I Need to know about ISomethingImpl! Unless…
copy = (ISomething) i.getClass().getMethod(“clone”).invoke(i);
}

Citation From Josh Bloch’s Effective Java:
“The Cloneable interface was intended as a mixin interface for objects to advertise that they permit cloning. Unfortunately it fails to serve this purpose … This is a highly atypical use of interfaces and not one to be emulated … In order for implementing the interface to have any effect on a class, it and all of its superclasses must obey a fairly complex, unenforceable and largely undocumented protocol”

oop - Why is the clone() method protected in java.lang.Object? - Stack Overflow

42 ご冗談でしょう?名無しさん :2007/05/28(月) 21:45:50 ID:???
 ☆☆講談社の輝かしい戦歴☆☆
 <全滅部隊>
 ・I.ニュートン プリンシピア
 ・E.マッハ マッハ力学
 ・E.T.ホイッテーカー 解析力学
 ・M.ヤンマー 力の概念 空間の概念 質量の概念
 ・A.ゾンマーフェルト 理論物理学講座 原子構造とスペクトル線
 ・W.パウリ パウリ物理学講座 相対性理論 量子力学の一般原理
 ・H.ワイル 空間・時間・物質
 ・H.S.グリーン ハイゼンベルク形式による量子力学
 ・ワトソン、ヌッタール 量子力学における三体問題
 ・V.ハイネ 量子力学と群論
 ・F.フント 量子論の歴史
 ・E.ヘンリー、W.ティーリング 初等場の量子論
 ・H.A.ローレンツ ローレンツ電子論
 ・L.ヤーノシー 物理的相対性理論
 ・J.ウェーバー 一般相対論と重力波
 ・M.ボルン アインシュタインの相対性理論
 ・A.エルパン 磁性の理論
 ・F.ロンドン 超流体
 ・A.ボーア、B.R.モッテルソン 原子核構造
 ・H.アルヴェーン、C.G.フェルトハマー 宇宙電気力学

 <展開中部隊>
 ゼロから学ぶシリーズ なっとくするシリーズ

物理系参考書中毒患者スレッド:アルファルファモザイクだった

13 ご冗談でしょう?名無しさん :2007/05/25(金) 13:22:51 ID:???
 ☆☆東京図書の輝かしい戦歴☆☆
 <全滅部隊>
 ・ランダウ&リフシッツ 理論物理学教程
 ・カンパニエーツ 理論物理学講義
 ・クーラン&ヒルベルト 数理物理学の方法
 ・アブリコソフ&ゴリコフ&ジャロジンスキー
   統計物理学における場の量子論の方法
 ・シュポルスキー 原子物理学
 ・メシア 量子力学
 ・ラム 流体力学
 ・ボゴリューボフ 場の量子論の数学的方法
 ・ブルバキ 数学原論
 ・ファン・デル・ヴェルデン 現代代数学
 ・コルモゴロフ 確率論の基礎概念

 <展開中部隊>
 石村シリーズ

22 ご冗談でしょう?名無しさん :2007/05/26(土) 18:41:50 ID:???
 »13
 全滅部隊に入れとくれ。
 ・スタンリー 相転移と臨界現象

物理系参考書中毒患者スレッド:アルファルファモザイクだった

戻り値が無視される場合、「前置」形式(++i)は「後置」形式(i++)より効率がわるくなることはなく、実際のところ効率がよくなることが多い。後置インクリメント(またはデクリメント)の場合、i のコピー(これが式の値になる)を作る必要があるためだ。もし i がイテレータや非スカラ型であると、i をコピーするコストは高くつくだろう。

Google C++スタイルガイド 日本語訳 | textdrop

まあ、「青いイナズマ」~「ダイナマイト」のダンス・ポップ路線の流れからミドルテンポな「セロリ」をリリースしたスマップのように、プロのエンターテイナーとして真っ当なことをしているだけかもしれないが、歌謡曲の要素を色濃くし、そんなアルバムを「これが日本」と宣言するかのように『JPN』と名付けてしまうところに、拭いきれないもどかしさを感じてしまう。

Perfume『JPN』(徳間ジャパンコミュニケーションズ) - COOKIE SCENE

結論から言ってしまえば、『JPN』にエッジは存在しない。

Perfume『JPN』(徳間ジャパンコミュニケーションズ) - COOKIE SCENE

asada's memorandum: ゴッホの本当のすごさを知った日

1 month ago - 1919