From owner-freebsd-wireless@FreeBSD.ORG Thu Dec 1 00:49:25 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 872B0106566B; Thu, 1 Dec 2011 00:49:25 +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 1D5708FC14; Thu, 1 Dec 2011 00:49:24 +0000 (UTC) Received: by yenq9 with SMTP id q9so1811088yen.13 for ; Wed, 30 Nov 2011 16:49:24 -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=0/09BguyKsyyW6NlWg+9H5WxJ3LFE0FYI89Ut7mnlXw=; b=vvxK0yR9P/L4JkvZtJLVSnse7oW1+RA0ozJctsAywvPpwUIcnpjXqc5+Jl1XKJFDqk kePvyZDNJ9FLdPx87kbc+jzVx8bLH6IhRufTnwWDJ3VTDfH1YqmBPTlHdvtQOjWwSrr5 /Cs4WnCi7s7eFlCTCaZs7fgCOleMwYPA4/79M= Received: by 10.68.30.68 with SMTP id q4mr52490pbh.75.1322700564073; Wed, 30 Nov 2011 16:49:24 -0800 (PST) MIME-Version: 1.0 Received: by 10.68.48.5 with HTTP; Wed, 30 Nov 2011 16:48:43 -0800 (PST) In-Reply-To: References: <20111130224422.GA36424@freebsd.org> <20111201000243.GB44877@freebsd.org> <20111201001158.GA48051@freebsd.org> <20111201003938.GA52503@freebsd.org> From: Igor Mozolevsky Date: Thu, 1 Dec 2011 00:48:43 +0000 Message-ID: To: Adrian Chadd Content-Type: text/plain; charset=UTF-8 Cc: Alexander Best , 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:49:25 -0000 On 1 December 2011 00:43, Adrian Chadd wrote: > Erm, these aren't run-time comparisons though, these are done at compile time. Aren't they macro expansions: % gcc -E - #define NA1(_r) \ 59 (((_r) == 6.5) ? 8 : (((_r) == 13) ? 9 : (((_r) == 19.5)? 10 : \ 60 (((_r) == 26) ? 11 : (((_r) == 39) ? 12 : (((_r) == 52) ? 13 : \ 61 (((_r) == 58.5)? 14 : (((_r) == 65) ? 15 : 0)))))))) NA1(7) # 1 "" # 1 "" # 1 "" # 1 "" 59 (((7) == 6.5) ? 8 : (((7) == 13) ? 9 : (((7) == 19.5)? 10 : 60 (((7) == 26) ? 11 : (((7) == 39) ? 12 : (((7) == 52) ? 13 : 61 (((7) == 58.5)? 14 : (((7) == 65) ? 15 : 0)))))))) Cheers, -- Igor M :-)