>>>> "APA" == Adrian Aichner
<Adrian.Aichner(a)t-online.de> writes:
>>>>> "Martin" == Martin Buchholz <martin(a)xemacs.org>
writes:
>>>> "APA" == Adrian Aichner
<Adrian.Aichner(a)t-online.de> writes:
APA> These test fails because my
system prints 3 digits for the exponent:
APA> (format "%e" 100)
APA> "1.000000e+002"
APA> MSDN actually documents that exponents are always printed with three
APA> digits.
APA> What's the preferable way to fix these tests?
APA> 1.
APA> (cond
APA> ((equal system-type 'windows-nt)
APA> (Assert (string= (format "%e" 100) "1.000000e+002")))
APA> (t
APA> (Assert (string= (format "%e" 100) "1.000000e+02"))))
APA> 2.
APA> (Assert (string-match "1\\.000000e\\+0?02" (format "%e" 100)
0))
Martin> I vote for 2. Except that the 3rd arg to string-match
Martin> seems unnecessary.
Martin> (Assert (string-match "1\\.000000e\\+0?02" (format "%e"
100)))
APA> Martin, for maintainability (regexps are pretty easily screwed up, I
APA> have used the fix of perl, grep, XEmacs for too long) I would prefer
APA> 1. Would it be OK with you if generated a patch grouping all %[eEgG]
APA> together in on (cond ...) and adding your comment from below?
That is fine with me.
But I have some concerns that the solution you come up with isn't
portable enough and will need to be fixed again in the future.
1. For example, MS might actually fix the bug.
2. (equal system-type 'windows-nt)
is better written
(eq system-type 'windows-nt)
3. Which systems does this really apply to? Only windows-nt? What
about windows-98? What about if microsoft renames their OS again?
What about if we're on a windows system, but we're using a cygwin
libc? Doesn't Borland ship a libc without this bug? etc...
This bug is *not* a bug of the system, but of the C library.
The principle is to avoid system-level ifdefs (usually in favor of
feature tests). Time to add an autoconf test?
4. Instead of (cond), how about (if) or (case)?