[Kde-games-devel] KPat broken for Windows

Casper van Donderen casper.vandonderen at gmail.com
Mon Aug 17 18:28:18 CEST 2009


Haha, 

I just tested for you: 
Float test = -0.0f; 

That returns as -0 with cout and is smaller than 0. 

MSVC2008. 

Casper 
------Original Message------
From: Parker Coates
To: KDE games development
ReplyTo: KDE games development
Subject: Re: [Kde-games-devel] KPat broken for Windows
Sent: Aug 17, 2009 18:14

On Mon, Aug 17, 2009 at 09:40, Casper van Donderen wrote:
> Hi, While trying to compile trunk KPat fails for me on this part:
>
>        if ( std::signbit( p->pilePos().x() ) == std::signbit(
> p->reservedSpace().width() ) )
>            neededPileArea.setWidth( qAbs( p->pilePos().x() +
> p->reservedSpace().width() ) );
>        else
>            neededPileArea.setWidth( qMax( qAbs( p->pilePos().x() ),
> qAbs( p->reservedSpace().width() ) ) );
>
>        if ( std::signbit( p->pilePos().y() ) == std::signbit(
> p->reservedSpace().height() ) )
>            neededPileArea.setHeight( qAbs( p->pilePos().y() +
> p->reservedSpace().height() ) );
>        else
>            neededPileArea.setHeight( qMax( qAbs( p->pilePos().y() ),
> qAbs( p->reservedSpace().height() ) ) );
>
> (dealer.cpp line 1925 onwards)
>
> signbit() is not available in BSD & (MSVC) Windows. it is not
> available in math.h on Windows.

Hmm. That's interesting. On such platforms, how does one determine the
sign of a floating point number with proper handling of -0.0? In most
situations "n >= 0.0" is enough, but that returns true if n is -0.0.

> Please use another solution for this....

Fortunately for us, the code in question can probably get by without
properly handling -0.0 (although it would be nice if it could), so I
replaced the conditions with simple comparisons. See
http://websvn.kde.org/?view=rev&revision=1012405 .

Parker
_______________________________________________
kde-games-devel mailing list
kde-games-devel at kde.org
https://mail.kde.org/mailman/listinfo/kde-games-devel



More information about the kde-games-devel mailing list