From owner-freebsd-wireless@FreeBSD.ORG Thu Dec 1 00:07:26 2011 Return-Path: Delivered-To: freebsd-wireless@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ACAE3106566B; Thu, 1 Dec 2011 00:07:26 +0000 (UTC) (envelope-from mozolevsky@gmail.com) Received: from mail-yx0-f182.google.com (mail-yx0-f182.google.com [209.85.213.182]) by mx1.freebsd.org (Postfix) with ESMTP id 5AC9F8FC16; Thu, 1 Dec 2011 00:07:26 +0000 (UTC) Received: by yenq9 with SMTP id q9so1761938yen.13 for ; Wed, 30 Nov 2011 16:07:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=G0gpQmVLi4UyeBbR79AdnfPF1AJUN+e7zR9QWLLWOiA=; b=m9Qj812KXi6XzBuRyGwR2mvisy5+MDUYcHL+MMJdh8Fm/E9QPyIKvq76e25VBpnGID 6My2DvHSZNI59cDFLref8+lMQ6Pvmn0qdX/S+q8T85x5xI7yKdu9acSiq4lDhFR/qI4A rso0smwUPxLTIvaqCxNZkfGzlujHq2Te86AK8= Received: by 10.68.12.199 with SMTP id a7mr283817pbc.58.1322698045151; Wed, 30 Nov 2011 16:07:25 -0800 (PST) MIME-Version: 1.0 Received: by 10.68.48.5 with HTTP; Wed, 30 Nov 2011 16:06:44 -0800 (PST) In-Reply-To: <20111201000243.GB44877@freebsd.org> References: <20111130224422.GA36424@freebsd.org> <20111201000243.GB44877@freebsd.org> From: Igor Mozolevsky Date: Thu, 1 Dec 2011 00:06:44 +0000 Message-ID: To: Alexander Best Content-Type: text/plain; charset=UTF-8 Cc: freebsd-wireless@freebsd.org Subject: Re: comparing floating points via "==" or "!=" X-BeenThere: freebsd-wireless@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussions of 802.11 stack, tools device driver development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Dec 2011 00:07:26 -0000 On 1 December 2011 00:02, Alexander Best wrote: > On Wed Nov 30 11, Igor Mozolevsky wrote: >> On 30 November 2011 22:44, Alexander Best wrote: >> >> > i played a bit with the gcc -Wfloat-equal warning and noticed that inside >> > sys/dev/ath/ath_rate/sample/tx_schedules.h, a lot of comparisons of floating >> > points are happening ("=="). is there a better way to deal with this? >> >> as opposed to (abs(a-b) < tolerance)? > > fabs(3) actually, or some other way, e.g. described in: I thought from the context it was fairly clear that the appropriate XabsY variant had to be used without me being unnecessarily verbose in mentioning fabs(), and its fabsl() and fabsf() friends?.. Cheers, -- Igor ;-)