Why approxEqual not working for integers in dmd 2068-b2

Daniel Kozák via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jul 28 00:10:42 PDT 2015


On Tue, 28 Jul 2015 08:50:53 +0200
Daniel Kozák <kozzi at dlang.cz> wrote:

> 
> On Tue, 28 Jul 2015 02:16:56 +0000
> "lobo" <swamplobo at gmail.com> wrote:
> 
> I would say it is a compiler bug.
> 
> consider this:
> 
> bool some(real x, real y) {
> 	return true;
> }
> 
> bool some(float x, float y) {
> 	return true;
> }
> 
> void main() {
> 	some(4.0L, 4.0L); // ok
> 	some(4L,4L); // this should implicit convert to real,real
> }
> 
> but:
> 
> //m.d(11): Error: m.some called with argument types (long, long)
> matches both: //m.d(1):     m.some(real x, real y) //and: //m.d(5):
> m.some(float x, float y
> 
> It is in confrontance with TDPL p.44 figure 2.3

OTOH D has same behaviour as C++



More information about the Digitalmars-d-learn mailing list