Re: approxEqual() has fooled me for a long time...

2010-10-20 Thread Aelxx
"Don" ÐÏ×?ÄÏÍÉ×/ÐÏ×?ÄÏÍÉÌÁ × ÎÏ×ÉÎÁÈ:i9mhvd$2l5...@digitalmars.com... > Lars T. Kyllingstad wrote: > in all the tricky special cases. Unlike a naive relative equality test > involving divisions, it doesn't fail for values near zero. (I _think_ > that's the reason why people think you need an a

Re: approxEqual() has fooled me for a long time...

2010-10-20 Thread Aelxx
>"Andrei Alexandrescu" wrote: > if (a == within(1e-5) == b) { ... } For me it looks strange. I think something like approxEqual is readable more clear here.

Re: approxEqual() has fooled me for a long time...

2010-10-20 Thread Aelxx
> fabs(a-b) > eps * fabs(a) is typo here: fabs (a-b) < eps * fabs (a)

Re: Higher level built-in strings

2010-07-21 Thread Aelxx
"Walter Bright" ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ ÓÌÅÄÕÀÝÅÅ: news:i24st1$12u...@digitalmars.com... > Jerome M. Berger wrote: >> And what about this one: >> >> void func(T) (T range) { >> foreach (elem; range) >> assert (is (typeof (elem) == ElementType!(T))); >> } >> >> func ("azerty"); >>

Re: safety model in D

2009-11-04 Thread Aelxx
"Andrei Alexandrescu" ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ ÓÌÅÄÕÀÝÅÅ: news:hcr2hb$dv...@digitalmars.com... > Jesse Phillips wrote: >> On Tue, 03 Nov 2009 17:55:15 -0600, Andrei Alexandrescu wrote: >> >>> There's a lot more, but there are a few useful subspaces. One is, if an >>> entire application only u

Re: Detecting inadvertent use of integer division

2009-12-14 Thread Aelxx
"bearophile" wrote: > Don: >> > In Pascal too (and OCaML, but the situation is different) they are >> > separated. I think here having two operators is better, >> >> Why? > > You are intelligent and expert so you must know my answer, so I fear yours > is a trick question :-) > > Two operators a

Re: Implicit enum conversions are a stupid PITA

2010-03-26 Thread Aelxx
"bearophile" wrote : > Regarding base type names I have proposed : > byte => sbyte > wchar => char16 (or shortchar) > dchar => char32 (or intchar) > > http://d.puremagic.com/issues/show_bug.cgi?id=3850 > http://d.puremagic.com/issues/show_bug.cgi?id=3936 > > Bye, > bearophile > In my embedded C p