忍者ブログ
鼻血で輸血・・・
私の誕生日に長男がインフルエンザA型に感染が発覚・・・;;

二日後に次男が高熱に・・・TT
最近よくあざができたので心配に・・・

病院に行ったら血小板の数が6千に・・・TT
そのまま入院に・・・;;

インフルエンザの検査をすると・・・
彼もまたA型が陽性に・・・orz

入院初日深夜1時・・・鼻血が・・・^^;
看護士さんが圧迫止血を10分間するも止まらず・・・;;

医師の指示を仰ぎに・・・
耳鼻咽頭科の医師を緊急呼び出し・・・

万一に備え輸血の準備も・・・
耳鼻咽頭科の処置でほぼ止血できたものの・・・
鼻水や痰にはまだ血が混じっている・・・TT

血小板減少性紫斑病だから・・・
出血には気をつけて・・・と言われていたが・・・

こんなに緊迫するなんて・・・TT

白血病の方に風邪には気をつけて・・・
と言うのを聞いたことがあるが・・・
その言葉の重みを改めて知らされた気分だ・・・

早くよくなって欲しいよぉ~~~
PR
【2007年12月19日15:15 】 | 成長日記 | コメント(0) | トラックバック()
あおあざ・・・
青あざがあちこちに・・・
皮膚をかいたあとまで出血が・・・;;

おでこにも大きなあざが・・・
どこかにぶつけたらしい・・・^^;

ふくらはぎ等普段ぶつけないような所にも
紫斑がぽつぽつと・・・TT

血小板の数が少なくなってきたのだろう
案の定検査結果も1万3千とかなり低い・・・orz

無事に年越ししたいよぉ~~~
【2007年12月12日07:30 】 | 成長日記 | コメント(0) | トラックバック()
真夜中・・・
赤ちゃんがミルク~~~って泣き出した・・・
おしめちゃまもかまってぇ~~~っと泣き出した・・・

その声につられて上の二人も起きてきて・・・
ママの隣で寝るぅ~~~っと・・・^^;

うしみつどきなのに・・・;;
涙の四重奏・・・TT
【2007年12月11日07:30 】 | 成長日記 | コメント(0) | トラックバック()
mod と remainder・・・
余りを求めるメソッドとして
BigIntegerクラスにmodとremainderがある

remainderは演算子%と同じ値を返すが・・・

modは必ず0以上の値を返すが・・・
除数が負の場合ArithmeticExceptionを投げる

remainderは演算子%と同じ値だった
-5 % 3 = -2
5 % -3 = 2
-5 % -3 = -2
-2 % 3 = -2
2 % -3 = 2
-2 % -3 = -2


modは以下のとおりだった
-5 mod 3 = 1
5 mod -3 = ArithmeticException
-5 mod -3 = ArithmeticException
-2 mod 3 = 1
2 mod -3 = ArithmeticException
-2 mod -3 = ArithmeticException


ガロア体(有限体)の計算には
このクラスのメソッドを利用すればよかったのね・・・^^;


【2007年12月04日23:23 】 | Java | コメント(0) | トラックバック()
負の除算・・・
手廻計算器には色々な計算テクニックが詰まってる^^
割り算には引き戻し法引き放し法などが用いられるが・・・

その計算の正誤を判定するには検算をする
割り算の検算とは・・・

 商*除数+余=被除数
 余の絶対値<除数の絶対値

この2つの条件を満たしているとき
この除算は正しい・・・

上の条件は除数・被除数ともに正のとき
答えは唯一となるが・・・
負の数が入ると・・・^^;

たとえば-5/3の場合

商=-1 余=-2 の場合と・・・
商=-2 余= 1 の場合が・・・

どちらも上の2つの条件を満たし正しい・・・
どちらの計算結果になるかは実装による・・・^^;

最近では・・・

 商*除数の絶対値<=被除数の絶対値

この条件を加えて計算結果が唯一になるように
言語仕様を決めている言語もある

Javaの場合・・・

Java言語仕様第3版
(The Java Language Specification, Third Edition)
15.17.2 Division Operatorに・・・

Integer division rounds toward 0. That is, the quotient produced for operands n and d that are integers after binary numeric promotion (§5.6.2) is an integer value q whose magnitude is as large as possible while satisfying |d・q||n|; moreover, q is positive when |n||d| and n and d have the same sign, but q is negative when |n||d| and n and d have opposite signs. There is one special case that does not satisfy this rule: if the dividend is the negative integer of largest possible magnitude for its type, and the divisor is -1, then integer overflow occurs and the result is equal to the dividend. Despite the overflow, no exception is thrown in this case. On the other hand, if the value of the divisor in an integer division is 0, then an ArithmeticException is thrown.

百聞は一見にしかずということで
Java6update3で実行してみる・・・
-5 % 3 = -2
5 % -3 = 2
-5 % -3 = -2
-2 % 3 = -2
2 % -3 = 2
-2 % -3 = -2


となった
ちなみにExcel2003では・・・
-5 mod 3 = 1
5 mod -3 = -1
-5 mod -3 = -2
-2 mod 3 = 1
2 mod -3 = -1
-2 mod -3 = -2


となった
【2007年12月02日07:30 】 | Java | コメント(0) | トラックバック()
前ページ| ホーム |次ページ

忍者ブログ [PR]