Blitz (164/459)

From:Sami N��t�nen
Date:12 Jan 2000 at 21:08:24
Subject:Re: MC68000(+) command execution times.

On 12-Jan-00, C. Dimitrakakis wrote.

> On 11-Jan-00, Vic E Babes wrote:
>
>> Just thought I`d mention that it is quicker to multiply by decimals, than
>> to divide by integers, i.e.
>>
>> 5 * 0.25
>>
>> is quicker than 5/4
>>
>> However - when I tried this in Blitz - I got incorrect answers.
> Of course.. If you type say 0.26 this gets translated to the closest
> possible 16.16 number..you lose some bits. This is especially true with .f
> numbers - all constants get translated to integer/fixed-point and then to
> floating point in the blitz environment. This sux.:)
> The 16.16x16.16 multiplication routine in blitz, however is very good and
> accurate.

Well got nothing to do, with conversion of 0.25 to 16.16 or float number.
But if the first number is integer, then the next one is converted to
integer as well. So try to put them in the other way around.

NPrint 5*0.25 ; result is 0
NPrint 0.25*5 ; result is 1.25

This is perfectly normal way for math operations in many other languages
too, not just in blitz.



Sami N��t�nen
EMail: sami.naatanen@dlc.fi

---------------------------------------------------------------------
To unsubscribe, e-mail: blitz-list-unsubscribe@netsoc.ucd.ie
For additional commands, e-mail: blitz-list-help@netsoc.ucd.ie