From 4f47ab2bd8738ff17e6777b248c1742da059d284 Mon Sep 17 00:00:00 2001 From: nsz Date: Apr 11 2012 10:34:55 +0000 Subject: strtod test numbers near overflow --- diff --git a/src/stdlib/strtod.c b/src/stdlib/strtod.c index ff85c6a..013c837 100644 --- a/src/stdlib/strtod.c +++ b/src/stdlib/strtod.c @@ -71,6 +71,18 @@ static struct { {".2225073858507201630123055637955676152503612414573018013083228724049586647606759e-307", 0x1p-1022}, // 2^-1022 + 2^-1075 + eps {".2225073858507201630123055637955676152503612414573018013083228724049586647606760e-307", 0x1.0000000000001p-1022}, + // 2^1024 - 2^970 - 1 + {"17976931348623158079372897140530341507993413271003782693617377898044" + "49682927647509466490179775872070963302864166928879109465555478519404" + "02630657488671505820681908902000708383676273854845817711531764475730" + "27006985557136695962284291481986083493647529271907416844436551070434" + "2711559699508093042880177904174497791", 0x1.fffffffffffffp1023}, + // 2^1024 - 2^970 + {"17976931348623158079372897140530341507993413271003782693617377898044" + "49682927647509466490179775872070963302864166928879109465555478519404" + "02630657488671505820681908902000708383676273854845817711531764475730" + "27006985557136695962284291481986083493647529271907416844436551070434" + "2711559699508093042880177904174497792", INFINITY}, }; static struct { char *s; @@ -88,6 +100,10 @@ static struct { {".1175494420887210724209590083408724842314472120785184615334540294131831453944281e-37", 0x1p-126}, // 2^-126 + 2^-150 + eps {".1175494420887210724209590083408724842314472120785184615334540294131831453944282e-37", 0x1.000002p-126}, + // 2^128 - 2^103 - 1 + {"340282356779733661637539395458142568447", 0x1.fffffep127}, + // 2^128 - 2^103 + {"340282356779733661637539395458142568448", INFINITY}, };