Re: opCmp with double values

2017-12-24 Thread drug via Digitalmars-d-learn
25.12.2017 10:40, drug пишет: 25.12.2017 09:50, Ali Çehreli пишет: On 12/24/2017 02:10 AM, kerdemdemir wrote:  >  if (  fabs(diff) < 0.0001 ) I can't answer your question but I know that the comparison above is wrong because it can be meaningful only if the values are

Re: opCmp with double values

2017-12-24 Thread drug via Digitalmars-d-learn
25.12.2017 09:50, Ali Çehreli пишет: On 12/24/2017 02:10 AM, kerdemdemir wrote: >  if (  fabs(diff) < 0.0001 ) I can't answer your question but I know that the comparison above is wrong because it can be meaningful only if the values are sufficiently larger than that hard-coded

Re: opCmp with double values

2017-12-24 Thread Ali Çehreli via Digitalmars-d-learn
On 12/24/2017 02:10 AM, kerdemdemir wrote: > if ( fabs(diff) < 0.0001 ) I can't answer your question but I know that the comparison above is wrong because it can be meaningful only if the values are sufficiently larger than that hard-coded value. I think feqrel() will be

opCmp with double values

2017-12-24 Thread kerdemdemir via Digitalmars-d-learn
In documentation and forums I found some example for overloading opCmp for int values. But I couldn't see any examples for double values. That is what I come up with my own: struct AdjustableVal ( T = double ) { this ( T initVal ) { curVal = initVal;