blob: 5b032d0d59fbc419834bdbbcb0eedbe428454ef3 [file] [log] [blame]
Russ Hamilton385541b2023-07-06 00:30:381// Copyright 2023 The Chromium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef COMPONENTS_CBOR_FLOAT_CONVERSIONS_H_
6#define COMPONENTS_CBOR_FLOAT_CONVERSIONS_H_
7
8#include <cstdint>
9
10namespace cbor {
11
12// Convert the half-precision float in the provided `value` to a double
13// precision floating point number.
14double DecodeHalfPrecisionFloat(uint16_t value);
15
16// Convert the double precision float in the provided `value` to a
17// half-precision floating point number. The output is only meaningful if the
18// value can be represented in half-precision.
19uint16_t EncodeHalfPrecisionFloat(double value);
20
21} // namespace cbor
22
23#endif // COMPONENTS_CBOR_FLOAT_CONVERSIONS_H_