MAMEWorld >> The Loony Bin
View all threads Index   Flat Mode Flat  

lharms
MAME Fan
Reged: 01/07/06
Posts: 908
Send PM
Re: Programming/maths question....soft floats...
07/26/13 09:53 PM


If code size is a real consideration then I would say 'pick your battle'.

Find the bit that is destroying the most precision and then just use fixed point there and then convert it back.

My rule of thumb even with full floating point precision is 1 decimal of lost precision confidence per operation. Not always true but usually close enough.

I would probably 64bit int it (even if it cost a bunch more instructions/memory) shift it and then integer mul/div it then shift it back then drop it back into the float with a round so the rest of the code is ok.

Even that may not be 'ok' depending on how many operations you do. Pretty much for divides think about it as 1 number you cant trust anymore. For multiplies you need 2x the space. You can reduce the error by limiting your inputs. Instead of for example 2 8 bit vals multiplied together can in theory fill a 16 bit value. But by limiting them to 0-15 (4 bits) each you still fit in the 8 bit.







Entire thread
Subject Posted by Posted on
* Programming/maths question....soft floats... italieAdministrator 07/26/13 02:21 PM
. * Thanks for all the suggestions.... italieAdministrator  07/27/13 12:44 AM
. * Re: Programming/maths question....soft floats... krick  07/26/13 10:55 PM
. * Re: Programming/maths question....soft floats... lharms  07/26/13 09:53 PM
. * Re: Programming/maths question....soft floats... amused  07/26/13 07:50 PM
. * Re: Programming/maths question....soft floats... italieAdministrator  07/27/13 12:50 AM
. * Re: Programming/maths question....soft floats... krick  07/27/13 04:52 AM
. * Re: Programming/maths question....soft floats... Vas Crabb  07/26/13 06:31 PM
. * Re: Programming/maths question....soft floats... GatKongModerator  07/26/13 02:56 PM
. * Re: Programming/maths question....soft floats... Gor  07/26/13 03:52 PM
. * Re: Programming/maths question....soft floats... italieAdministrator  07/26/13 04:14 PM

Extra information Permissions
Moderator:  GatKong 
0 registered and 439 anonymous users are browsing this forum.
You cannot start new topics
You cannot reply to topics
HTML is enabled
UBBCode is enabled
Thread views: 1080