#include <cstdint>
#include <limits>
template <typename T>
constexpr double normalize (T value) {
return value < 0
? -static_cast<double>(value) / std::numeric_limits<T>::min()
: static_cast<double>(value) / std::numeric_limits<T>::max()
;
}
int main () {
// Test cases evaluated at compile time.
static_assert(normalize(int16_t(32767)) == 1, "");
static_assert(normalize(int16_t(0)) == 0, "");
static_assert(normalize(int16_t(-32768)) == -1, "");
static_assert(normalize(int16_t(-16384)) == -0.5, "");
static_assert(normalize(uint16_t(65535)) == 1, "");
static_assert(normalize(uint16_t(0)) == 0, "");
}
I2luY2x1ZGUgPGNzdGRpbnQ+CiNpbmNsdWRlIDxsaW1pdHM+Cgp0ZW1wbGF0ZSA8dHlwZW5hbWUgVD4KY29uc3RleHByIGRvdWJsZSBub3JtYWxpemUgKFQgdmFsdWUpIHsKICByZXR1cm4gdmFsdWUgPCAwCiAgICA/IC1zdGF0aWNfY2FzdDxkb3VibGU+KHZhbHVlKSAvIHN0ZDo6bnVtZXJpY19saW1pdHM8VD46Om1pbigpCiAgICA6ICBzdGF0aWNfY2FzdDxkb3VibGU+KHZhbHVlKSAvIHN0ZDo6bnVtZXJpY19saW1pdHM8VD46Om1heCgpCiAgICA7Cn0KCmludCBtYWluICgpIHsKICAvLyBUZXN0IGNhc2VzIGV2YWx1YXRlZCBhdCBjb21waWxlIHRpbWUuCiAgc3RhdGljX2Fzc2VydChub3JtYWxpemUoaW50MTZfdCgzMjc2NykpID09IDEsICIiKTsKICBzdGF0aWNfYXNzZXJ0KG5vcm1hbGl6ZShpbnQxNl90KDApKSA9PSAwLCAiIik7CiAgc3RhdGljX2Fzc2VydChub3JtYWxpemUoaW50MTZfdCgtMzI3NjgpKSA9PSAtMSwgIiIpOwogIHN0YXRpY19hc3NlcnQobm9ybWFsaXplKGludDE2X3QoLTE2Mzg0KSkgPT0gLTAuNSwgIiIpOwogIHN0YXRpY19hc3NlcnQobm9ybWFsaXplKHVpbnQxNl90KDY1NTM1KSkgPT0gMSwgIiIpOwogIHN0YXRpY19hc3NlcnQobm9ybWFsaXplKHVpbnQxNl90KDApKSA9PSAwLCAiIik7Cn0=