[Issue 308] New: Documentation of float.max_exp, min_exp is misleading

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Aug 24 05:46:44 PDT 2006


http://d.puremagic.com/issues/show_bug.cgi?id=308

           Summary: Documentation of float.max_exp, min_exp is misleading
           Product: D
           Version: 0.165
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: trivial
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: clugdbug at yahoo.com.au


The documentation describes min_exp as the "minimum exponent as power of 2",
but this is not correct, and it implies that real.min == pow(2, min_exp), but
actually real.min == pow(2, min_exp-1).
Likewise,
pow(2, max_exp-1) < real.max < pow(2, max_exp)

Perhaps change the definitions to be:
"minimum exponent as a power of 2, plus 1".
"maximum exponent as a power of 2, plus 1".

since they are really non-intuitive (see listing below).
Any idea why they've always been defined in C in such a bizarre way?

---
writefln(real.min_exp, " %a", real.min, " ", real.max_exp, " %a", real.max, "
");
writefln(double.min_exp, " %a", double.min, " ", double.max_exp, " %a",
double.max);
writefln(float.min_exp, " %a", float.min, " ", float.max_exp, " %a",
float.max);


-- 




More information about the Digitalmars-d-bugs mailing list