Re: [Cbor] NaN behavior for CDE

Joe Hildebrand <hildjj@cursive.net> Tue, 09 January 2024 19:01 UTC

Return-Path: <hildjj@cursive.net>
X-Original-To: cbor@ietfa.amsl.com
Delivered-To: cbor@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 5CDFBC151981 for <cbor@ietfa.amsl.com>; Tue, 9 Jan 2024 11:01:07 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.106
X-Spam-Level:
X-Spam-Status: No, score=-2.106 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_BLOCKED=0.001, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=cursive.net
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uokZGX1nDqmC for <cbor@ietfa.amsl.com>; Tue, 9 Jan 2024 11:01:03 -0800 (PST)
Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 3A2FFC14F75F for <cbor@ietf.org>; Tue, 9 Jan 2024 11:01:03 -0800 (PST)
Received: by mail-io1-xd32.google.com with SMTP id ca18e2360f4ac-7bc32b04d16so145179639f.0 for <cbor@ietf.org>; Tue, 09 Jan 2024 11:01:03 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cursive.net; s=google; t=1704826862; x=1705431662; darn=ietf.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=BhXyHI6s8bmGr3t2wGR9ngZ74S23SfwS0otQBdTb20s=; b=k1Ig2p2C2sj8gnkI6HIjIkM31WaS9T9/Dq4fGVxny0hTPOrCQy1TDOo0QAAQjqQ+wl Fw8AZ1ig7EYBp4D3Wuvcm03OTb4S9G9TmDckd4I/JkHAiOZtLVr4Xc1mTDORkQNIr+VP SZ+byWuGT8uqq7iMYUIQnX7VMQ7lQD6v7we+Q=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704826862; x=1705431662; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BhXyHI6s8bmGr3t2wGR9ngZ74S23SfwS0otQBdTb20s=; b=FN3OR6C3e1iwTwRZCqL/LrPgv/IKzgKUz1JXwjB3/c7rraRphMzLbjX71Q6zEaIBjm ntVFCVz4y/3Mr2o7XKZVyedk5dMeakRTCQfo4SFHpDA2ONm/1xFyPVNs/eRb3I/lBW3i vTuvKqbShexutLCaa8MqLTgci9nqvnVCW3/30akdZr9CQFB+7sUBiDaHg4xvaRdxxWrG q8HBBANnEjeP34cbHBCsQqF4YgI+IVkWHMcIl6HpnFTHxKKAzIBWT+DH4GERxcEede7T jAzJ3GAwFII/1fpadYhfl1EE67uckS0UCQeqv8Jh4oyVHH/EIJTSydRxan0L2T1KIcnw TzJQ==
X-Gm-Message-State: AOJu0Yxz3NgKd/U9I34GaDPHI8AhAZnh+zQ56GWWdiutd5m7utcmsX3Y e4a0xBpbBJNyZ3UhooxOhSVdXNBIuAGc4k/fd9I5oDbQEA==
X-Google-Smtp-Source: AGHT+IHQ3Q9gZbj/RzuRJc0ufLdZllrZ/4uSK/h5c2Z5mrZKPyyogMBNJa5aMPbjq7xZtgdIpBu4Hw==
X-Received: by 2002:a05:6602:184e:b0:7be:da4d:8bcc with SMTP id d14-20020a056602184e00b007beda4d8bccmr1615050ioi.37.1704826862126; Tue, 09 Jan 2024 11:01:02 -0800 (PST)
Received: from smtpclient.apple ([2601:282:2100:4fc9:55d4:a7e1:9792:46f8]) by smtp.gmail.com with ESMTPSA id fi3-20020a056638630300b0046e2b201668sm786094jab.150.2024.01.09.11.01.01 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jan 2024 11:01:01 -0800 (PST)
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.300.61.1.2\))
From: Joe Hildebrand <hildjj@cursive.net>
In-Reply-To: <A6EBE8A8-2A46-4061-AAD5-177DBC301AA2@island-resort.com>
Date: Tue, 09 Jan 2024 12:00:51 -0700
Cc: Carsten Bormann <cabo@tzi.org>, "cbor@ietf.org" <cbor@ietf.org>
Content-Transfer-Encoding: quoted-printable
Message-Id: <CC160EDF-E9A4-4798-87E3-24219A20C8D8@cursive.net>
References: <B3993FCB-3878-47EE-A9D7-21F34530BE51@island-resort.com> <6B10BDA4-994A-4614-966E-487E0B6F46D3@tzi.org> <AEB51081-00F9-40CC-9043-29EB4A083CFC@island-resort.com> <D5F97344-DFD1-4298-B409-87504E654F0C@tzi.org> <A6EBE8A8-2A46-4061-AAD5-177DBC301AA2@island-resort.com>
To: "lgl island-resort.com" <lgl@island-resort.com>
X-Mailer: Apple Mail (2.3774.300.61.1.2)
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/5PibkUYXS-LitLdMHYkvsoKnIm0>
Subject: Re: [Cbor] NaN behavior for CDE
X-BeenThere: cbor@ietf.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: "Concise Binary Object Representation \(CBOR\)" <cbor.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/cbor>, <mailto:cbor-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cbor/>
List-Post: <mailto:cbor@ietf.org>
List-Help: <mailto:cbor-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/cbor>, <mailto:cbor-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 09 Jan 2024 19:01:07 -0000

Agree with this. I'd go as far as to say that it might be a best current practice that protocols intended for wide interoperability SHOULD NOT rely on sending or receiving NaN payloads (including quiet bits) in CBOR or any other encoding. 

— 
Joe Hildebrand

> On Jan 9, 2024, at 11:39 AM, lgl island-resort.com <lgl@island-resort.com> wrote:
> 
> I understand what you are proposing now. It is the same as Attempt-to-Preserve-Payload in my TL message that you probably DR  because it was TL :-) 
> 
> I still think some of the points I make apply:
> - No support for NaN payloads in CDDL or in other text or literal representations of float
> - Cbor.me does preferred serialization, but not NaN payloads
> - CBOR Sample code for conversion to half-precision doesn’t support NaN payloads
> - No C/C++ APIs to support encoding/decoding of NaN payloads
> - No compelling use cases
> 
> LL
> 
> 
> 
>> On Jan 8, 2024, at 1:20 PM, Carsten Bormann <cabo@tzi.org> wrote:
>> 
>> On 2024-01-02, at 23:27, lgl island-resort.com <lgl@island-resort.com> wrote:
>>> 
>>> I think what you are saying here is that CDE does not make a choice about NaN payloads. It is left up to the protocol / profile.
>> 
>> That is not what I was trying to say.
>> 
>> I was trying to point out that, since CBOR supports NaN payloads, CDE needs to support them, too.
>> 
>>> Thus, a particularly thorough generic CBOR encoder supporting CDE probably has a configuration setting that allows the user to pick NaN payload behavior.
>> 
>> I hope not.
>> 
>> I submitted a -01 that should clarify this:
>> 
>> Status:   https://datatracker.ietf.org/doc/draft-ietf-cbor-cde/
>> HTML:     https://www.ietf.org/archive/id/draft-ietf-cbor-cde-01.html
>> Diff:     https://author-tools.ietf.org/iddiff?url2=draft-ietf-cbor-cde-01
>> 
>> Grüße, Carsten
>> 
>>> 
>>> LL
>>> 
>>> 
>>>> On Jan 2, 2024, at 2:14 PM, Carsten Bormann <cabo@tzi.org> wrote:
>>>> 
>>>> I wish everyone a great new year.
>>>> 
>>>> On Jan 2, 2024, at 23:06, lgl island-resort.com <lgl@island-resort.com> wrote:
>>>>> 
>>>>> The TLDR for this is that I think CDE should not support NaN payloads.
>>>> 
>>>> Since CBOR supports NaN payloads, CDE needs to define how to deterministically represent them.
>>>> 
>>>>> CDE NaN should always be 0xf97e00 the same as dCBOR.
>>>> 
>>>> That is a perfectly fine application profile.
>>>> I think the consensus on this list appears to be that we put very little blame on "generic encoders" that do not support NaN payloads, i.e., aren’t really fully generic in the fullest sense.
>>>> We probably need better nomenclature for “not quite fully generic” encoders in this sense.
>>>> 
>>>>> Also, it appears to me that Preferred Serialization (RFC 8949 section 4.1)  requires NaN payload support. Looking for confirmation on that.
>>>> 
>>>> Preferred Serialization tells you the preferred serialization *if* CBOR provides a choice between multiple encodings with the same semantics.
>>>> If your implementation doesn’t provide support at all for something in the CBOR generic data model, preferred serialization doesn’t place any constraints on you.
>>>> If you convert all NaNs to quiet NaNs with zero payloads before encoding them in CBOR, preferred serialization will make you emit f97e00 for all of them.
>>>> 
>>>> Grüße, Carsten
>>>> 
>>> 
>> 
> 
> _______________________________________________
> CBOR mailing list
> CBOR@ietf.org
> https://www.ietf.org/mailman/listinfo/cbor