IT戦記

プログラミング、起業などについて書いているプログラマーのブログです😚

2009-05-28から1日間の記事一覧

double が IEEE 754 かどうか

C++

double をシリアライズするときとかは、 std::numeric_limit< double >::is_iec559 を assert しておけばいいのかなー。 #include <cassert> #include <limits> #include <boost/cstdint.hpp> template<class Itr> void serialize(Itr it, const double d) { // ↓ こんな感じ assert(sizeof(double) == sizeo</class></boost/cstdint.hpp></limits></cassert>…