[Gambas-user] Float equality
Jussi Lahtinen
jussi.lahtinen at gmail.com
Sat Oct 31 03:25:30 CET 2020
This is faster:
If (fA - fPrecision) < fB And If (fA + fPrecision) > fB Then Print "Equal"
Jussi
On Sat, Oct 31, 2020 at 4:16 AM Jussi Lahtinen <jussi.lahtinen at gmail.com>
wrote:
> 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/1ed2c9b5/attachment.htm>
More information about the User
mailing list