Thread overview
[phobos] phobos commit, revision 1559
May 26, 2010
dsource.org
May 26, 2010
Don Clugston
May 27, 2010
Shin Fujishiro
May 27, 2010
Brad Roberts
May 27, 2010
Shin Fujishiro
May 26, 2010
phobos commit, revision 1559


user: rsinfu

msg:
Reverted r1557 (and r1513 partially).

r1557 relaxed some unittests, as some platforms had accuracy problem with strtold().  But the strict unittests were requirements for D; so r1557 should be reverted.

With this change, these unittests will fail on some platforms such as OSX and Gentoo.  However, the unittests SHOULD fail because using strtold() on these platforms is a 'bug' -- we should provide an accurate implementation.

Related issues:
3758: Create D impementation of to!(float, string), etc.
4200: "to!real(to!string(real.min_normal))" raises std.conv.ConvError

http://www.dsource.org/projects/phobos/changeset/1559

May 26, 2010
What I've been doing for such cases is adding:
    version (OSX)
    {
	pragma(msg, " --- std.socket(" ~ __LINE__.stringof ~ ") broken test ---");
    }
else {
...
}

so that the unittests compile on all platforms but clearly indicate that there is a failure.


On 26 May 2010 16:21, dsource.org <noreply at dsource.org> wrote:
> phobos commit, revision 1559
>
>
> user: rsinfu
>
> msg:
> Reverted r1557 (and r1513 partially).
>
> r1557 relaxed some unittests, as some platforms had accuracy problem with strtold(). ?But the strict unittests were requirements for D; so r1557 should be reverted.
>
> With this change, these unittests will fail on some platforms such as OSX and Gentoo. ?However, the unittests SHOULD fail because using strtold() on these platforms is a 'bug' -- we should provide an accurate implementation.
>
> Related issues:
> 3758: Create D impementation of to!(float, string), etc.
> 4200: "to!real(to!string(real.min_normal))" raises std.conv.ConvError
>
> http://www.dsource.org/projects/phobos/changeset/1559
>
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
>
May 26, 2010
On 5/26/2010 7:21 AM, dsource.org wrote:
> phobos commit, revision 1559
> 
> 
> user: rsinfu
> 
> msg:
> Reverted r1557 (and r1513 partially).
> 
> r1557 relaxed some unittests, as some platforms had accuracy problem with strtold().  But the strict unittests were requirements for D; so r1557 should be reverted.
> 
> With this change, these unittests will fail on some platforms such as OSX and Gentoo.  However, the unittests SHOULD fail because using strtold() on these platforms is a 'bug' -- we should provide an accurate implementation.
> 
> Related issues:
> 3758: Create D impementation of to!(float, string), etc.
> 4200: "to!real(to!string(real.min_normal))" raises std.conv.ConvError
> 
> http://www.dsource.org/projects/phobos/changeset/1559

Um.. double check your revert.. it looks like it's yet again different.

One example:

r1557:
1882	 	    f = to!float("1.17549435e-38");
1883	 	    assert(feq(cast(real)f, cast(real)1.17549e-38));
 	1882	    f = to!float("1.1755e-38");
 	1883	    assert(feq(cast(real)f, cast(real)1.1755e-38));

r1559:
1882	 	    f = to!float("1.1755e-38");
1883	 	    assert(feq(cast(real)f, cast(real)1.1755e-38));
 	1882	    f = to!float("1.17549e-38");
 	1883	    assert(feq(cast(real)f, cast(real)1.17549e-38));

So, the code isn't back the way it was.

Sigh,
Brad
May 27, 2010
Brad Roberts <braddr at puremagic.com> wrote:
> Um.. double check your revert.. it looks like it's yet again different.
> 
> One example:
> 
> r1557:
> 1882	 	    f = to!float("1.17549435e-38");
> 1883	 	    assert(feq(cast(real)f, cast(real)1.17549e-38));
>  	1882	    f = to!float("1.1755e-38");
>  	1883	    assert(feq(cast(real)f, cast(real)1.1755e-38));
> 
> r1559:
> 1882	 	    f = to!float("1.1755e-38");
> 1883	 	    assert(feq(cast(real)f, cast(real)1.1755e-38));
>  	1882	    f = to!float("1.17549e-38");
>  	1883	    assert(feq(cast(real)f, cast(real)1.17549e-38));
> 
> So, the code isn't back the way it was.
> 
> Sigh,
> Brad

It is the initial state (<= r1512).  I have edited those portions twice in r1513 and r1559.  In this revision I reverted both my changes because the two edit were just workarounds for inaccurate strtol*().

I fixed inconsistent test values though:

std.conv [r1512:r1559]
--------------------
1885	 	    f = to!float("3.40282e+38");
 	1885	    f = to!float("3.4028e+38");
1886	1886	    assert(to!string(f) == to!string(3.40282e+38));

1931	 	    d = to!double("2.22507e-308");
 	1931	    d = to!double("2.22508e-308");
1932	1932	    assert(feq(cast(real)d, cast(real) 2.22508e-308));
--------------------
http://www.dsource.org/projects/phobos/changeset?new=trunk/phobos/std/conv.d at 1559&old=trunk/phobos/std/conv.d at 1512


Shin
May 27, 2010
Don Clugston <dclugston at googlemail.com> wrote:
> What I've been doing for such cases is adding:
>     version (OSX)
>     {
> 	pragma(msg, " --- std.socket(" ~ __LINE__.stringof ~ ") broken test ---");
>     }
> else {
> ...
> }
> 
> so that the unittests compile on all platforms but clearly indicate that there is a failure.
> 

I have seen one in std.regex!  It's a good idea.

In this case, I can't use verison blocks.  The unittests fail on Gentoo Linux, however they succeed on some other Linux systems. version (Linux) will bypass the unittests on all Linux systems.

I think I can add try-catch blocks instead:
--------------------
try
{
    r = to!real(to!string(real.min_normal));
    assert(to!string(r) == to!string(real.min_normal));
}
catch (ConvError e)    // strtold() bug on some platforms
{
    printf(" --- std.math(%u) broken test ---\n", cast(uint) __LINE__);
}
--------------------
If there's no problem, I'll commit this after.

Thank you for the advice!

Shin