2// GobySoft, LLC (2013-)
3// Massachusetts Institute of Technology (2007-2014)
4// Community contributors (see AUTHORS file)
6// Cadmus To <cadmus.to+dev@gmail.com>
9// This file is part of the Dynamic Compact Control Language Library
12// DCCL is free software: you can redistribute it and/or modify
13// it under the terms of the GNU Lesser General Public License as published by
14// the Free Software Foundation, either version 2.1 of the License, or
15// (at your option) any later version.
17// DCCL is distributed in the hope that it will be useful,
18// but WITHOUT ANY WARRANTY; without even the implied warranty of
19// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20// GNU Lesser General Public License for more details.
22// You should have received a copy of the GNU Lesser General Public License
23// along with DCCL. If not, see <http://www.gnu.org/licenses/>.
25import "dccl/option_extensions.proto";
30 option (dccl.msg).id = 1501;
31 option (dccl.msg).max_bytes = 32;
32 option (dccl.msg).codec_version = 5;
34 optional float f = 1 [
35 (dccl.field).max = 10,
36 (dccl.field).min = -10,
37 (dccl.field).precision = 7
41message NegativePrecisionFloatMsg
43 option (dccl.msg).id = 2101;
44 option (dccl.msg).max_bytes = 32;
45 option (dccl.msg).codec_version = 5;
47 optional float f = 1 [
48 (dccl.field).max = 20,
49 (dccl.field).min = -20,
50 (dccl.field).precision = -1
54message PrecisionRangeFloatMsg
56 option (dccl.msg).id = 2201;
57 option (dccl.msg).max_bytes = 256;
58 option (dccl.msg).codec_version = 5;
60 optional float prec0 = 1 [
61 (dccl.field).max = 10000000,
62 (dccl.field).min = -10000000,
63 (dccl.field).precision = 0
65 optional float prec1 = 2 [
66 (dccl.field).max = 1000000,
67 (dccl.field).min = -1000000,
68 (dccl.field).precision = 1
70 optional float prec2 = 3 [
71 (dccl.field).max = 100000,
72 (dccl.field).min = -100000,
73 (dccl.field).precision = 2
75 optional float prec3 = 4 [
76 (dccl.field).max = 10000,
77 (dccl.field).min = -10000,
78 (dccl.field).precision = 3
80 optional float prec4 = 5 [
81 (dccl.field).max = 1000,
82 (dccl.field).min = -1000,
83 (dccl.field).precision = 4
85 optional float prec5 = 6 [
86 (dccl.field).max = 100,
87 (dccl.field).min = -100,
88 (dccl.field).precision = 5
90 optional float prec6 = 7 [
91 (dccl.field).max = 10,
92 (dccl.field).min = -10,
93 (dccl.field).precision = 6
97// Messages for issue #149: min/max limits of floating point fields are not always inclusive
98// https://github.com/GobySoft/dccl/issues/149
100// v4 codec: encoding a = max = 0.05 fails due to floating-point quantization (issue #149)
103 option (dccl.msg).id = 149;
104 option (dccl.msg).max_bytes = 4;
105 option (dccl.msg).codec_version = 4;
107 optional float a = 1 [
108 (dccl.field).min = 0,
109 (dccl.field).max = 0.05,
110 (dccl.field).precision = 2
114// v5 codec: encoding a = max = 0.05 succeeds (fixed by PR #152 integer-domain arithmetic)
117 option (dccl.msg).id = 150;
118 option (dccl.msg).max_bytes = 4;
119 option (dccl.msg).codec_version = 5;
121 optional float a = 1 [
122 (dccl.field).min = 0,
123 (dccl.field).max = 0.05,
124 (dccl.field).precision = 2