[Gambas-user] Float equality

Jussi Lahtinen jussi.lahtinen at gmail.com
Sat Oct 31 03:16:36 CET 2020


Umm.. If signs can be different then;  Abs(Abs(fA) - Abs(fB)) <= fPrecision
Then Print "Equal"


Jussi

On Sat, Oct 31, 2020 at 4:14 AM Jussi Lahtinen <jussi.lahtinen at gmail.com>
wrote:

> If Abs(fA - fB) <= fPrecision Then Print "Equal"
>
> What do you mean by efficient? Fastest?
>
> Jussi
>
> On Sat, Oct 31, 2020 at 2:49 AM Bruce <adamnt42 at gmail.com> wrote:
>
>> (Having  bad brain day)
>>
>> What is trhe most efficient way to check for equality between two float
>> values, presuming some arbitryary precision?
>>
>> tia
>> bruce
>>
>> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20201031/74ba00e7/attachment.htm>


More information about the User mailing list