double yang_dnode_get_dec64(const struct lyd_node *dnode, const char *xpath_fmt,
			    ...)
{
	const double denom[19] = {1e0,   1e-1,  1e-2,  1e-3,  1e-4,
				  1e-5,  1e-6,  1e-7,  1e-8,  1e-9,
				  1e-10, 1e-11, 1e-12, 1e-13, 1e-14,
				  1e-15, 1e-16, 1e-17, 1e-18};
	const struct lysc_type_dec *dectype;
	const struct lyd_value *dvalue;

	dvalue = YANG_DNODE_XPATH_GET_VALUE(dnode, xpath_fmt);
	dectype = (const struct lysc_type_dec *)dvalue->realtype;
	assert(dectype->basetype == LY_TYPE_DEC64);
	assert(dectype->fraction_digits < sizeof(denom) / sizeof(*denom));
	return (double)dvalue->dec64 * denom[dectype->fraction_digits];
}
double yang_dnode_get_dec64(const struct lyd_node *dnode, const char *xpath_fmt,
			    ...)
{
	const double denom[19] = {1e0,   1e-1,  1e-2,  1e-3,  1e-4,
				  1e-5,  1e-6,  1e-7,  1e-8,  1e-9,
				  1e-10, 1e-11, 1e-12, 1e-13, 1e-14,
				  1e-15, 1e-16, 1e-17, 1e-18};
	const struct lysc_type_dec *dectype;
	const struct lyd_value *dvalue;

	dvalue = YANG_DNODE_XPATH_GET_VALUE(dnode, xpath_fmt);
	dectype = (const struct lysc_type_dec *)dvalue->realtype;
	assert(dectype->basetype == LY_TYPE_DEC64);
	assert(dectype->fraction_digits < sizeof(denom) / sizeof(*denom));
	return (double)dvalue->dec64 * denom[dectype->fraction_digits];
}