Re: [AD] float math function inconsistencies

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Really?! In favour of double? Whilst I think performance is probably identical on PC I don't think that would be good for mobile platforms. 

http://www.xyster.net/blog/?p=40

iPhone 4 has somewhat better single precision floating point performance while double precision is the same. This benchmark does not explicitly utilize the ARM NEON SIMD instructions available through the Accelerate framework. Apple claims (in their WWDC presentations) that NEON can provide an up to 8x performance gain for single precision floating point operations. So that 36.2 MFlops figure could be significantly improved by modifying the code to use iOS4′s BLAS libraries (assuming the very optimistic full 8x speedup that’s ~290MFlops!). NEON does not support double precision operations so those are relegated to the ARM VFP which has the same performance as the 3G/3GS devices.

This is why it is quite important to be careful about type promotion.

I guess you could define a "real" type for Allegro and then users could choose, but I don't think it is worth the effort. Allegro's value is in having a good cross platform abstraction, with all the things you need to make simple games. If you look at things like Chipmunk, which perhaps require higher precision math, that is all float internally.

Nick


On 29 January 2013 14:48, Elias Pschernig <elias.pschernig@xxxxxxxxxxxxxxxxx> wrote:
>
> I wonder if we shouldn't try and get rid of float wherever possible.
>
> On Tue, Jan 29, 2013 at 2:47 PM, Nick Trout <chinbillybilbo@xxxxxxxxxx> wrote:
> > Any thoughts on this?
> >
> >
> > On 26 January 2013 20:11, Nick Trout <chinbillybilbo@xxxxxxxxxx> wrote:
> >>
> >> I noticed whilst going through the code that float math functions are
> >> sometimes used inconsistently, e.g. fabs instead of fabsf where <math.h>
> >> declares:
> >>
> >> double fabs(double);
> >> float fabsf(float);
> >>
> >> The compiler should promote the argument to a double. This might not be
> >> inefficient on some platforms, but it is inconsistent, and could inefficient
> >> on some lesser platforms.
> >>
> >> Cheers, Nick
> >>
> >
> >
> > ------------------------------------------------------------------------------
> > Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> > MVC, Windows 8 Apps, _javascript_ and much more. Keep your skills current
> > with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> > MVPs and experts. ON SALE this month only -- learn more at:
> > http://p.sf.net/sfu/learnnow-d2d
> > --
> > https://lists.sourceforge.net/lists/listinfo/alleg-developers
>
> ------------------------------------------------------------------------------
> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> MVC, Windows 8 Apps, _javascript_ and much more. Keep your skills current
> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> MVPs and experts. ON SALE this month only -- learn more at:
> http://p.sf.net/sfu/learnnow-d2d
> --
> https://lists.sourceforge.net/lists/listinfo/alleg-developers



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/