aboutsummaryrefslogtreecommitdiffstats
path: root/test/intformat.awk
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2010-07-16 14:52:31 +0300
committerArnold D. Robbins <arnold@skeeve.com>2010-07-16 14:52:31 +0300
commit3ba50a15ebd976f7a88393e2e45dc14b6478b9a9 (patch)
tree6a6bbe6bed1141051fefe94b2d39eacd4854235a /test/intformat.awk
parent6a2caf2157d87b4b582b2494bdd7d6a688dd0b1f (diff)
downloadegawk-3ba50a15ebd976f7a88393e2e45dc14b6478b9a9.tar.gz
egawk-3ba50a15ebd976f7a88393e2e45dc14b6478b9a9.tar.bz2
egawk-3ba50a15ebd976f7a88393e2e45dc14b6478b9a9.zip
Move to gawk-3.1.7.
Diffstat (limited to 'test/intformat.awk')
-rw-r--r--test/intformat.awk18
1 files changed, 16 insertions, 2 deletions
diff --git a/test/intformat.awk b/test/intformat.awk
index 56ce606b..2f235290 100644
--- a/test/intformat.awk
+++ b/test/intformat.awk
@@ -46,6 +46,10 @@ function check_cons(fmt,base,rot,mexp, i,j,dig,res,s) {
}
BEGIN {
+ # this doesn't necessarily have to be exact since we're checking
+ # magnitude rather than precision
+ if (!HUGEVAL) HUGEVAL = 1.7976931348623157e+308
+
formats["%s"] = ""
formats["%d"] = ""
formats["%.0f"] = ""
@@ -53,13 +57,23 @@ BEGIN {
formats["0x%x"] = "non-decimal"
check(0,"0")
- for (i = 0; i <= 308; i++) {
+ limit = HUGEVAL / 10
+ value = 1
+ for (i = 0; ; i++) {
check(10^i,"10^"i)
check(-10^i,"-10^"i)
+ #[probably should test value against 10^i here]
+ if (value >= limit) break
+ value *= 10
}
- for (i = 0; i <= 1023; i++) {
+ limit = HUGEVAL / 2
+ value = 1
+ for (i = 0; ; i++) {
check(2^i,"2^"i)
check(-2^i,"-2^"i)
+ #[probably should test value against 2^i here]
+ if (value >= limit) break
+ value *= 2
}
check_cons("%d",10,1,9)