Conversation
assert(abs(cdouble(-1+1i)) == sqrt(2.0 ));Fails on Windows_64 |
|
Could the failure be caused by roundoff error? Have you tried |
|
If it is possible There is one thing that I can't understand: auto abs(Num)(Num z) @safe pure nothrow @nogc
if (is(Num* : const(cfloat*)) || is(Num* : const(cdouble*))
|| is(Num* : const(creal*)))Why pointers? |
To exclude types that convert to complex but aren't complex. |
|
@quickfur Seems that |
|
The error seems to happen 1 line above your throw statement. I.e., this line: |
|
Oh, also, you probably should just use |
|
Thanks! |
|
Whoa. Either there's a bug in |
|
Maybe try |
|
This version (linux)
{
assert(stream.data == "1.67 -0X1.47AE147AE147BP+0 nan",
stream.data);
}
else version (OSX)
{
assert(stream.data == "1.67 -0X1.47AE147AE147BP+0 nan",
stream.data);
}
else version (MinGW)
{
assert(stream.data == "1.67 -0XA.3D70A3D70A3D8P-3 nan",
stream.data);
}
else version (CRuntime_Microsoft)
{
assert(stream.data == "1.67 -0X1.47AE14P+0 nan",
stream.data);
} |
|
Blocked by DMD |
|
Did you file a dmd bug? |
|
Looks like https://issues.dlang.org doesn't work. Software error: Can't connect to the database. For help, please send mail to the webmaster (webmaster@puremagic.com), giving this error message and the time and date of the error. |
|
https://issues.dlang.org is back online. |
|
@9il might be possible to break this up in smaller chunks? |
|
@DmitryOlshansky I will create new PR for all changes except hypot update. |
|
Or 2-3 PRs will be better? |
|
2-3 is small ones is faster to pull. |
|
ok |
|
All other changes are already in master. |
|
Unittests are failing, fix plz. :) |
|
See main comment. |
|
Oh, the dmd bug is still not fixed? Nevermind then. |
|
Seems to fail on some 32-bit platforms btw. @9il I have Win64 - where to dig? |
|
Disassembling this code would help, thought. double two = 2.0;
auto a = sqrt(two);auto a = sqrt(2.0)cdouble c = -1+1i;
auto a = hypot(c.re, c.im) ;cdouble c = -1+1i;
auto a = abs(c) ;Can you get it and past please? |
|
After merging your pull and rebuilding phobos this D code: produces this ASM: |
|
Also I added T.stringof to 562 line in math.d and T happens to be cfloat. I guess it's one of 'em codegen bugs with built-in complex numbers. I really-really wish we remove them for good. |
|
Please, can you add asm with |
|
foo1 and foo2 were optimized to single ret + stack push/pop. |
|
Nice, foo3 and foo4 looks identical. |
|
OMG. Seems like abs version calls the wrong function. And it's caused by |
Why you think so? Should not |
Ehm right, I must be tired. |
|
Hypot code looks really crazy. Excuse me please for a lot of asm requests. This is another one: void foo5(){
cdouble c = -1+1i;
auto a = hypot(c.re, cast(double)c.im); //idouble -> double?
} |
|
foo5 is fine, you can ignore previous msg. |
|
I can not find wrong code. |
|
64bit binary: 32bit binary (also asserts for me): Both with debug info I hope you can navigate in them with disassembler. |
|
otool -tvV ./math.exe Please send the text file.
|
|
I can not find any of |
|
I'm certain 64-bit version has names. 32-bit sadly has broken debug symbols and disassembler fails to load them. |
|
I have 32 bit version now ) |
|
But I can not catch error on Mac, because Darwin_64_32 not fails. So my 32bit binaries are useless. |
|
Is there VirtualBox for Mac? At home my Linux sits in VBox on Windows host and find it incredibly easy to switch between the two. |
|
I‘ll try with VB.
|
|
Merge conflict - please rebase :) |
Win64 still fails. Help is needed from someone with Win64.
Blocked
DMD issue:
(workaround)ContentsRemoveremove FPTemporary usage #2637 (merged)FPTemporaryusage instd.complex.Removeremove FPTemporary usage #2637 (merged)FPTemporaryusage instd.numeric.hypottotemplate.<---------- fails(workaround)Clean up imports instd.complex: clean imports #2659 (merged)std.complex.Clean up imports instd.numeric: clean imports #2658 (merged)std.numeric.Change-> std.math: deprecate backwards compatibility with Phobos1 #2636 (merged)isfinite, isinftoisFinite, isInfinityinstd.numericandstd.math.