April 18, 2012 Re: appending newly initialized struct to array | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | On Wednesday, 18 April 2012 at 16:36:39 UTC, bearophile wrote:
> Ali:
>> That a thousandth time I have made that mistake and still have not learned. :( Yes, .nan may not be compared with any other value, including .nan.
>
> Today I'll present an enhancement request to remove this problem from D.
>
> Hugs,
> bearophile
I don't see how this could be enhanced.
|
April 18, 2012 Re: appending newly initialized struct to array | ||||
---|---|---|---|---|
| ||||
Posted in reply to SomeDude | On Wednesday, April 18, 2012 19:04:12 SomeDude wrote:
> On Wednesday, 18 April 2012 at 16:36:39 UTC, bearophile wrote:
> > Ali:
> >> That a thousandth time I have made that mistake and still have not learned. :( Yes, .nan may not be compared with any other value, including .nan.
> >
> > Today I'll present an enhancement request to remove this problem from D.
> >
> > Hugs,
> > bearophile
>
> I don't see how this could be enhanced.
It's by design. An enhancement request is a waste of time. Comparisons with NaN _always_ return false regardless of what they're compared against - even NaN. It's not going to change.
- Jonathan M Davis
|
April 18, 2012 Re: appending newly initialized struct to array | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | On 04/18/2012 10:13 AM, Jonathan M Davis wrote: > On Wednesday, April 18, 2012 19:04:12 SomeDude wrote: >> On Wednesday, 18 April 2012 at 16:36:39 UTC, bearophile wrote: >>> Ali: >>>> That a thousandth time I have made that mistake and still have >>>> not learned. :( Yes, .nan may not be compared with any other >>>> value, including .nan. >>> >>> Today I'll present an enhancement request to remove this >>> problem from D. >>> >>> Hugs, >>> bearophile >> >> I don't see how this could be enhanced. > > It's by design. An enhancement request is a waste of time. Comparisons with > NaN _always_ return false regardless of what they're compared against - even > NaN. It's not going to change. > > - Jonathan M Davis It shouldn't be a problem to detect comparisons against literal .nan values. The compiler can warn with "comparison is always false". Ali |
April 18, 2012 Re: appending newly initialized struct to array | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ali Çehreli | On Wednesday, 18 April 2012 at 18:18:44 UTC, Ali Çehreli wrote:
> On 04/18/2012 10:13 AM, Jonathan M Davis wrote:
> >
> > It's by design. An enhancement request is a waste of time.
> Comparisons with
> > NaN _always_ return false regardless of what they're compared
> against - even
> > NaN. It's not going to change.
> >
> > - Jonathan M Davis
>
> It shouldn't be a problem to detect comparisons against literal .nan values. The compiler can warn with "comparison is always false".
>
> Ali
Now THAT makes sense.
|
April 18, 2012 Re: appending newly initialized struct to array | ||||
---|---|---|---|---|
| ||||
Posted in reply to SomeDude | On Wed, Apr 18, 2012 at 08:50:10PM +0200, SomeDude wrote: > On Wednesday, 18 April 2012 at 18:18:44 UTC, Ali Çehreli wrote: > >On 04/18/2012 10:13 AM, Jonathan M Davis wrote: > >> > >> It's by design. An enhancement request is a waste of time. Comparisons with NaN _always_ return false regardless of what they're compared against - even NaN. It's not going to change. > >> > >> - Jonathan M Davis > > > >It shouldn't be a problem to detect comparisons against literal .nan values. The compiler can warn with "comparison is always false". > > > >Ali > > Now THAT makes sense. +1. T -- "Computer Science is no more about computers than astronomy is about telescopes." -- E.W. Dijkstra |
April 18, 2012 Re: appending newly initialized struct to array | ||||
---|---|---|---|---|
| ||||
Posted in reply to SomeDude | SomeDude:
>> It shouldn't be a problem to detect comparisons against literal .nan values. The compiler can warn with "comparison is always false".
>>
>> Ali
>
> Now THAT makes sense.
That's what my proposal is going to be, with small refinements :-) (And it think it's not the first time someone proposes it).
Bye,
bearophile
|
April 18, 2012 Re: appending newly initialized struct to array | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ali Çehreli | On Wednesday, April 18, 2012 11:18:44 Ali Çehreli wrote:
> On 04/18/2012 10:13 AM, Jonathan M Davis wrote:
> > On Wednesday, April 18, 2012 19:04:12 SomeDude wrote:
> >> On Wednesday, 18 April 2012 at 16:36:39 UTC, bearophile wrote:
> >>> Ali:
> >>>> That a thousandth time I have made that mistake and still have not learned. :( Yes, .nan may not be compared with any other value, including .nan.
> >>>
> >>> Today I'll present an enhancement request to remove this problem from D.
> >>>
> >>> Hugs,
> >>> bearophile
> >>
> >> I don't see how this could be enhanced.
> >
> > It's by design. An enhancement request is a waste of time.
>
> Comparisons with
>
> > NaN _always_ return false regardless of what they're compared against
>
> - even
>
> > NaN. It's not going to change.
> >
> > - Jonathan M Davis
>
> It shouldn't be a problem to detect comparisons against literal .nan values. The compiler can warn with "comparison is always false".
Yes, that would make sense. Heck, I'd be tempted to argue that using == with floating point values in general should be a warning, since that's pretty much never what you actually want, but that's probably not going to fly.
But the behavior itself isn't going to change.
- Jonathan M Davis
|
April 19, 2012 Re: appending newly initialized struct to array | ||||
---|---|---|---|---|
| ||||
Posted in reply to SomeDude | SomeDude: >> Today I'll present an enhancement request to remove this problem from D. >> >> Hugs, >> bearophile > > I don't see how this could be enhanced. Take a look here: http://forum.dlang.org/thread/undjpdewiqmghmhndedw@forum.dlang.org Bye, bearophile |
Copyright © 1999-2021 by the D Language Foundation