Update copyright for 2022
[pgsql.git] / src / include / common / shortest_dec.h
blobf919f7f9b787b7b28279639b27c5d48eeefbebc2
1 /*---------------------------------------------------------------------------
3 * Ryu floating-point output.
5 * Portions Copyright (c) 2018-2022, PostgreSQL Global Development Group
7 * IDENTIFICATION
8 * src/include/common/shortest_dec.h
10 * This is a modification of code taken from github.com/ulfjack/ryu under the
11 * terms of the Boost license (not the Apache license). The original copyright
12 * notice follows:
14 * Copyright 2018 Ulf Adams
16 * The contents of this file may be used under the terms of the Apache
17 * License, Version 2.0.
19 * (See accompanying file LICENSE-Apache or copy at
20 * http://www.apache.org/licenses/LICENSE-2.0)
22 * Alternatively, the contents of this file may be used under the terms of the
23 * Boost Software License, Version 1.0.
25 * (See accompanying file LICENSE-Boost or copy at
26 * https://www.boost.org/LICENSE_1_0.txt)
28 * Unless required by applicable law or agreed to in writing, this software is
29 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
30 * KIND, either express or implied.
32 *---------------------------------------------------------------------------
34 #ifndef SHORTEST_DEC_H
35 #define SHORTEST_DEC_H
37 /*----
38 * The length of 25 comes from:
40 * Case 1: -9.9999999999999999e-299 = 24 bytes, plus 1 for null
42 * Case 2: -0.00099999999999999999 = 23 bytes, plus 1 for null
44 #define DOUBLE_SHORTEST_DECIMAL_LEN 25
46 int double_to_shortest_decimal_bufn(double f, char *result);
47 int double_to_shortest_decimal_buf(double f, char *result);
48 char *double_to_shortest_decimal(double f);
51 * The length of 16 comes from:
53 * Case 1: -9.99999999e+29 = 15 bytes, plus 1 for null
55 * Case 2: -0.000999999999 = 15 bytes, plus 1 for null
57 #define FLOAT_SHORTEST_DECIMAL_LEN 16
59 int float_to_shortest_decimal_bufn(float f, char *result);
60 int float_to_shortest_decimal_buf(float f, char *result);
61 char *float_to_shortest_decimal(float f);
63 #endif /* SHORTEST_DEC_H */