[sysrepo-devel] Handling of SR_DECIMAL64_T
Jan Kundrát
jan.kundrat at cesnet.cz
Wed Oct 12 17:10:09 UTC 2016
Hi,
I have a following type in my YANG:
typedef threshold-power-dBm {
type union {
type decimal64 {
fraction-digits 2;
}
type enumeration {
enum off {
description "No threshold configured";
}
}
}
description "Power in dBm";
}
When I attempt to process a data change callback using latest devel,
setting the double value to -10.0 through C++ bindings like this:
session->set_item("/prefix/foo", std::make_shared<Val>(-10.0,
SR_DECIMAL64_T));
What I get back is off by several orders of magnitude. My C++ module which
is bound to the relevant module says that the value is -1000.0.
When I test an XML modification through `sysrepocfg`:
<foo>-10.00</foo>
this is what a standard ./examples/application_changes_example says:
[...]/foo = -100000
The C++ example shipped with sysrepo needs a trivial patch [1], and after
that it reports that, too, the new value is -100000.000000, i.e. the same
as the C version.
What's going on here? My expectation is to get -10.0 (subject to roudning
error).
WIth kind regards,
Jan
[1] https://github.com/sysrepo/sysrepo/pull/415
More information about the sysrepo-devel
mailing list