Support for CBOR floating point values

This support is needed so that Chrome can process the response from
a FLEDGE Bidding and Auction server.

Bug: 1442274
Change-Id: I4ab7bda0673b836b3541ba6c639070e18a6af9e9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4658097
Reviewed-by: Daniel Cheng <[email protected]>
Auto-Submit: Russ Hamilton <[email protected]>
Reviewed-by: Adam Langley <[email protected]>
Commit-Queue: Russ Hamilton <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1166243}
diff --git a/components/cbor/float_conversions.h b/components/cbor/float_conversions.h
new file mode 100644
index 0000000..5b032d0
--- /dev/null
+++ b/components/cbor/float_conversions.h
@@ -0,0 +1,23 @@
+// Copyright 2023 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_CBOR_FLOAT_CONVERSIONS_H_
+#define COMPONENTS_CBOR_FLOAT_CONVERSIONS_H_
+
+#include <cstdint>
+
+namespace cbor {
+
+// Convert the half-precision float in the provided `value` to a double
+// precision floating point number.
+double DecodeHalfPrecisionFloat(uint16_t value);
+
+// Convert the double precision float in the provided `value` to a
+// half-precision floating point number. The output is only meaningful if the
+// value can be represented in half-precision.
+uint16_t EncodeHalfPrecisionFloat(double value);
+
+}  // namespace cbor
+
+#endif  // COMPONENTS_CBOR_FLOAT_CONVERSIONS_H_