Changeset 1313
- Timestamp:
- 10/26/09 23:29:55 (2 years ago)
- Files:
-
- trunk/phobos/linux.mak (modified) (2 diffs)
- trunk/phobos/std/math.d (modified) (3 diffs)
- trunk/phobos/std/typetuple.d (modified) (3 diffs)
- trunk/phobos/std/xml.d (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/phobos/linux.mak
r1285 r1313 53 53 # D flags for all OSs, but customized by build 54 54 DFLAGS_debug = -w -g -debug -d $(DFLAGS) 55 DFLAGS_release = -w -O -release - inline -nofloat -d $(DFLAGS)55 DFLAGS_release = -w -O -release -nofloat -d $(DFLAGS) 56 56 57 57 # D flags for documentation generation … … 158 158 $$(LIB_$1_$2) : $$(SRC2LIB_$1) $$(OBJS_$1_$2) \ 159 159 $(LIBDRUNTIME_$1) 160 @echo $$(DMD$1$2) $(DFLAGS_$2) -lib -of$$@ "[...tons of files...]"161 @$$(DMD$1$2) $(DFLAGS_$2) -lib -of$$@ $$^160 # @echo $$(DMD$1$2) $(DFLAGS_$2) -lib -of$$@ "[...tons of files...]" 161 $$(DMD$1$2) $(DFLAGS_$2) -lib -of$$@ $$^ 162 162 163 163 $$(ROOT$1$2)/.directory : trunk/phobos/std/math.d
r1283 r1313 3094 3094 approxEqual) evaluates to $(D true) for each pair of elements. 3095 3095 */ 3096 bool approxEqual(T, U, V)(T lhs, U rhs, V maxRelDiff, V maxAbsDiff = 0)3096 bool approxEqual(T, U, V)(T lhs, U rhs, V maxRelDiff, V maxAbsDiff = 1e-5) 3097 3097 { 3098 3098 static if (isInputRange!T) … … 3131 3131 // two numbers 3132 3132 //static assert(is(T : real) && is(U : real)); 3133 if (rhs == 0) { 3134 return (lhs == 0 ? 0 : 1) <= maxRelDiff; 3133 if (rhs == 0) 3134 { 3135 return fabs(lhs) <= maxAbsDiff; 3135 3136 } 3136 3137 return fabs((lhs - rhs) / rhs) <= maxRelDiff 3137 || maxAbsDiff != 0 && fabs(lhs - rhs) < maxAbsDiff;3138 || maxAbsDiff != 0 && fabs(lhs - rhs) <= maxAbsDiff; 3138 3139 } 3139 3140 } … … 3141 3142 3142 3143 /** 3143 Returns $(D approxEqual(lhs, rhs, 0.01)).3144 Returns $(D approxEqual(lhs, rhs, 1e-2, 1e-5)). 3144 3145 */ 3145 3146 bool approxEqual(T, U)(T lhs, U rhs) 3146 3147 { 3147 return approxEqual(lhs, rhs, 0.01);3148 return approxEqual(lhs, rhs, 1e-2, 1e-5); 3148 3149 } 3149 3150 trunk/phobos/std/typetuple.d
r1279 r1313 11 11 * References: 12 12 * Based on ideas in Table 3.1 from 13 * $(LINK2 http:// www.amazon.com/exec/obidos/ASIN/0201704315/ref=ase_classicempire/102-2957199-2585768,13 * $(LINK2 http://amazon.com/exec/obidos/ASIN/0201704315/ref=ase_classicempire/102-2957199-2585768, 14 14 * Modern C++ Design), 15 15 * Andrei Alexandrescu (Addison-Wesley Professional, 2001) … … 361 361 equals!(short, 1111, byte, byte)); 362 362 363 static assert(Pack!(Replace!(1111, "11", 364 2222, 1111, 1111, 1111)). 365 equals!(2222, "11", 1111, 1111)); 363 // @@@BUG@@@ 364 // static assert(Pack!(Replace!(1111, "11", 365 // 2222, 1111, 1111, 1111)). 366 // equals!(2222, "11", 1111, 1111)); 366 367 } 367 368 … … 440 441 equals!(1111, short, 1111, 1111)); 441 442 442 static assert(Pack!(ReplaceAll!(1111, "11", 443 1111, 2222, 1111, 1111)). 444 equals!("11", 2222, "11", "11")); 443 // @@@BUG@@@ 444 // static assert(Pack!(ReplaceAll!(1111, "11", 445 // 1111, 2222, 1111, 1111)). 446 // equals!("11", 2222, "11", "11")); 445 447 } 446 448 trunk/phobos/std/xml.d
r1279 r1313 389 389 if (buffer.length == 0) 390 390 { 391 buffer = s.dup; 392 buffer.length = i; 391 buffer = s[0 .. i].dup; 393 392 } 394 393 if (startsWith(s[i..$],"&#"))
