Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article?

// gcc-10 -march=armv8.3-a arm-jcvt.c という風にコンパイル #include <stdio.h> #include <math.h> #include <inttypes.h> #include <arm_acle.h> // Prototype: // int32_t __jcvt(double); #if defined(__GNUC__) __attribute__((noinline)) #endif int32_t cast_double_to_i32(double x) { return (int32_t)x; } int main(void) { printf("(int32_t)(-2.8) = %" PRId32 "\n", cast_double_to_i32(-2.8)); printf("(int32_t)1.99 = %" P
どうも、浮動小数点数オタクのmod_poppoです。 昨日開催された ABC169 の C 問題が浮動小数点数の罠な問題だったらしいので、どこが罠なのか、そしてどうすれば罠を回避できるのかを解説してみます。 また、典型的な誤答に対しては、それを落とすためのテストケースも用意しました。 問題文(引用) まず最初に問題文を引用しておきます。 AtCoder Beginner Contest 169 | C - Multiplication 3 問題文 $A\times B$ の小数点以下を切り捨て、結果を整数として出力してください。 制約 $0\le A\le 10^{15}$ $0\le B<10$ $A$ は整数 $B$ は小数第 2 位まで与えられる 入力 入力は以下の形式で標準入力から与えられる。
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く