Re: [Cbor] Implementing float->int numeric reduction

Anders Rundgren <anders.rundgren.net@gmail.com> Wed, 16 August 2023 08:21 UTC

Return-Path: <anders.rundgren.net@gmail.com>
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 9F88BC151991 for <cbor@ietfa.amsl.com>; Wed, 16 Aug 2023 01:21:02 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.197
X-Spam-Level:
X-Spam-Status: No, score=-2.197 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, FREEMAIL_FROM=0.001, NICE_REPLY_A=-0.091, 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_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 (2048-bit key) header.d=gmail.com
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 BLpNvosOhSUe for <cbor@ietfa.amsl.com>; Wed, 16 Aug 2023 01:20:58 -0700 (PDT)
Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) (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 8A0D1C15171F for <cbor@ietf.org>; Wed, 16 Aug 2023 01:20:58 -0700 (PDT)
Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-3fe5c0e5747so37194945e9.0 for <cbor@ietf.org>; Wed, 16 Aug 2023 01:20:58 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692174057; x=1692778857; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=sPCloovhWUClZfzBRfMhmBcS2liJWg5H/ni9N2kc+EQ=; b=Qv2vC3iPWe9ODGatcFTwX+2+TZ6Bz0d2NRGjUreHiGLMB7jzE1QNSfpdmrx6V6B9TA +qP6m/ThO/iC0RQmwVrfHL8pt9uTj6YLDixAeHcKGW9hpPzfgmFAer0LCEyjBQhOIYF8 rcXZZCgIzhEUnEgIiYDVGQYNRxLYlf4iRqJrn3AagHuYk6NWlX1ZmA0/OgS4zID0TkG2 T4byEBfV1z6dNGuD/3bmYOUZt7HAbNJuJa4keuiLCg1PD060/OvXcIKAmz1wcy0d4lw8 Yw0ZmD4/t/rshqhuNrVzZHjIV09mCAGuVhkkXUDqYBoBf6o14mmJgEZpfrO9HXfdx/6I pzpQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692174057; x=1692778857; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=sPCloovhWUClZfzBRfMhmBcS2liJWg5H/ni9N2kc+EQ=; b=J8oYVxPkACbKMytfqV5ECioPNH+y8FXlYaWwcg4MXFdQa5jQ9zewODV4wwq/m3/8st OIGeKIwMZ060obA4ll9zo7OUVO79CTQK67ePyb/1fcB7f8yJQyXYMLi0AZEUuC98Uobw NNO5imB9iK1vJKZoVgpf1eCoWL0TUNqui1dysLSHxQuKmHhLInCaqs9gJpfjXRrm+9oc Qdn7icffoYqai9phaOhzNZpTftBwdxaJt3G8fxXyMQuWU/C/S7L8+cCLjPExLju4R7cq JtdVixZXSujKPop2O1YUCfN30ML6n3l5TQ+vcgYBbNNOPWnxyu09iiosO/QQ/J+zpTik apDg==
X-Gm-Message-State: AOJu0YxZnjUWXGcmyBDM28N1cpBRE6Ue8RoZvMPkSamZHfOeIkX4dH4J l6syK/kb1U55ypxswDKI8VY=
X-Google-Smtp-Source: AGHT+IHgLWKatliKLwtCfQlGzOc5vwsl2KPp60IWRzPe4JkhmA8V7kFThgZf4rQIZ692pshkOowEBQ==
X-Received: by 2002:a05:600c:1ca6:b0:3fe:3389:122f with SMTP id k38-20020a05600c1ca600b003fe3389122fmr3387043wms.1.1692174056701; Wed, 16 Aug 2023 01:20:56 -0700 (PDT)
Received: from ?IPV6:2a01:e34:ec4e:5670:ec72:5435:cd62:bd81? ([2a01:e34:ec4e:5670:ec72:5435:cd62:bd81]) by smtp.googlemail.com with ESMTPSA id k1-20020a05600c0b4100b003fa95f328afsm23308283wmr.29.2023.08.16.01.20.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 16 Aug 2023 01:20:56 -0700 (PDT)
Message-ID: <88ff5010-c8fb-97e8-51f8-d5b26eeb1480@gmail.com>
Date: Wed, 16 Aug 2023 10:20:55 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.14.0
Content-Language: en-US
To: Carsten Bormann <cabo@tzi.org>
Cc: Wolf McNally <wolf@wolfmcnally.com>, "lgl island-resort.com" <lgl@island-resort.com>, "cbor@ietf.org" <cbor@ietf.org>, Shannon Appelcline <shannon.appelcline@gmail.com>, Christopher Allen <christophera@lifewithalacrity.com>
References: <0EBCC710-F7BA-474E-8A6D-D67015FD5EC7@island-resort.com> <dd9bc427-31a7-6d51-2fb1-d02e1b2824ff@gmail.com> <BEAFD785-D282-4C5C-AA7D-FB36970D09D1@island-resort.com> <0B6C4756-6C69-4F66-9B5F-CD5B7A1CB9FA@wolfmcnally.com> <f70f44eb-111c-b1c7-00b5-c9e99af5e88a@gmail.com> <C6D174CC-4ECC-433F-AF16-4FBED1C644EB@wolfmcnally.com> <f5425e41-6cf8-16b7-0ba8-492c67e3d8b0@gmail.com> <8E24A9E2-8563-458E-88D8-C60423118824@wolfmcnally.com> <AA75FF5F-E256-405A-89F2-C46C7DF725C7@tzi.org> <2cb4cfc8-1f60-7701-67fe-675419260ccd@gmail.com> <A9DA2C3A-9923-48F4-B78D-2B6E9CA70BDB@tzi.org>
From: Anders Rundgren <anders.rundgren.net@gmail.com>
In-Reply-To: <A9DA2C3A-9923-48F4-B78D-2B6E9CA70BDB@tzi.org>
Content-Type: text/plain; charset="UTF-8"; format="flowed"
Content-Transfer-Encoding: 8bit
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/QcuGbFbJpIDTG_Qdu85FzFMp83c>
Subject: Re: [Cbor] Implementing float->int numeric reduction
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: Wed, 16 Aug 2023 08:21:02 -0000

On 2023-08-16 10:08, Carsten Bormann wrote:
>>
>> Did I got this right, the "Common CBOR Deterministic Encoding Profile" is incompatible with "Gordian dCBOR"?
> 
> That, of course, depends on what your definition of incompatible is.
> 
> The Common CBOR Deterministic Encoding Profile essentially clarifies actually using the recommended handling of floating point values from Section 4.2.2 and leaving the other discussion items in that section to potential application profiles.  It also clarifies the equivalence (soft boundary) between Major Type 0/1 and Tag 2/3.
> 
> Gordian dCBOR applies a number of exclusions and reductions to the application data it processes.
> After this (conceptual) processing, when encoded in the Common CBOR Deterministic Encoding Profile, the result should be identical to what’s in Wolf’s dCBOR draft.  Score one for “compatible”.  Also, any generic decoder that implements Common CBOR Deterministic Encoding Profile in a checking mode will accept Gordian dCBOR processed (and, implied, Common CBOR Deterministic Encoding Profile encoded) data. Score two for “compatible”.
> 
> Any Common CBOR Deterministic Encoding Profile generic encoder can be used to perform the encoding of Gordian dCBOR processed data.  Score three for “compatible”.

 From a more practical point of view: AFAICT, both https://cbor.me (in its current incarnation NB) and https://cyberphone.github.io/CBOR.js/doc/playground.html generate deterministic CBOR that "bombs" in dCBOR.

Could you please explain for us mere mortals how a "Common CBOR Deterministic Encoding Profile" would fix that?

Anders

> 
> The place where you might want to use “incompatible”:  The Common CBOR Deterministic Encoding Profile does give you a wider selection of instances you can encode, not all of which are Gordian dCBOR instances (“incompatible”).  So it doesn’t magically give you Gordian dCBOR compatibility; you actually have to implement that compatibility: Either by implementing the reductions and exclusions inside the application, or by implementing the reductions in a shim layer or an integral component added to the generic encoder (and of course not using excluded values such as »undefined« in the application, because there is no reduction for them).
> 
> The advantage of having this clear separation is that it becomes easy to later extend the Gordian dCBOR profile (e.g., by i128/u128 values), without having to revisit the deterministic encoding of the extensions where they already are covered by the Common CBOR Deterministic Encoding Profile.
> (It also makes more obvious what a subprofile such as integer-only dCBOR might be.)
> 
> So what was your question about?
> 
> Grüße, Carsten
> 
> _______________________________________________
> CBOR mailing list
> CBOR@ietf.org
> https://www.ietf.org/mailman/listinfo/cbor