[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnash-commit] gnash ChangeLog backend/render_handler_agg.cpp
From: |
strk |
Subject: |
Re: [Gnash-commit] gnash ChangeLog backend/render_handler_agg.cpp |
Date: |
Tue, 14 Nov 2006 13:06:14 +0100 |
On Tue, Nov 14, 2006 at 11:08:29AM +0000, Bastiaan Jacques wrote:
> +#ifndef trunc
> +#define trunc(a) static_cast<long>(a)
> +#endif
mmm... the manual page says:
These functions round x to the nearest integer not larger in absolute
value.
So I'd assume:
orig trunc
-1.2 -1
1.2 1
-2.9 -2
3.9 2
Now, the trunc() function takes and returns a 'double' type so we
must make sure we don't overflow the 'long' type.
BTW, floor does just that if we make sure we swap sign:
#define TRUNC(x) ( x < 0 ? -floor(-x) : floor(x) )
tested:
1.2: floor=1 trunc=1 TRUNC=1
-1.2: floor=-2 trunc=-1 TRUNC=-1
1.9: floor=1 trunc=1 TRUNC=1
-1.9: floor=-2 trunc=-1 TRUNC=-1
1.5: floor=1 trunc=1 TRUNC=1
-1.5: floor=-2 trunc=-1 TRUNC=-1
--strk;
- [Gnash-commit] gnash ChangeLog backend/render_handler_agg.cpp, Udo Giacomozzi, 2006/11/04
- [Gnash-commit] gnash ChangeLog backend/render_handler_agg.cpp, Udo Giacomozzi, 2006/11/04
- [Gnash-commit] gnash ChangeLog backend/render_handler_agg.cpp, Udo Giacomozzi, 2006/11/04
- [Gnash-commit] gnash ChangeLog backend/render_handler_agg.cpp, Udo Giacomozzi, 2006/11/06
- [Gnash-commit] gnash ChangeLog backend/render_handler_agg.cpp, Bastiaan Jacques, 2006/11/14
- Re: [Gnash-commit] gnash ChangeLog backend/render_handler_agg.cpp,
strk <=
- [Gnash-commit] gnash ChangeLog backend/render_handler_agg.cpp, Sandro Santilli, 2006/11/15
- [Gnash-commit] gnash ChangeLog backend/render_handler_agg.cpp, Sandro Santilli, 2006/11/26