超漢字上で、mrubyを使ってhello worldを表示させる。
Revision | c1ae16729a3b4733f0435041ed498852a2ffa1fc (tree) |
---|---|
Time | 2014-07-22 01:46:13 |
Author | ornse01 <ornse01@user...> |
Commiter | ornse01 |
fix isinf() and isnan()
@@ -6,7 +6,7 @@ | ||
6 | 6 | |
7 | 7 | double __nan() |
8 | 8 | { |
9 | - static char nan_byte[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f}; | |
9 | + static char nan_byte[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff}; | |
10 | 10 | return *(double*)nan_byte; |
11 | 11 | } |
12 | 12 |
@@ -19,7 +19,8 @@ int isnan(double x) | ||
19 | 19 | int isinf(double x) |
20 | 20 | { |
21 | 21 | double inf = INFINITY; |
22 | - return memcmp(&x, &inf, sizeof(double)) == 0; | |
22 | + double ninf = -inf; | |
23 | + return (memcmp(&x, &inf, sizeof(double)) == 0) || (memcmp(&x, &ninf, sizeof(double)) == 0); | |
23 | 24 | } |
24 | 25 | |
25 | 26 | int isfinite(double x) |