wasm_conversions

This commit is contained in:
Svyatoslav Nikolsky
2017-06-19 13:24:57 +03:00
parent e56c334391
commit 328e08358d
2 changed files with 6 additions and 2 deletions

View File

@ -274,7 +274,9 @@ macro_rules! impl_try_truncate_into {
return Err(Error::Value("invalid float value for this operation".into()));
}
if self < $into::MIN as $from || self > $into::MAX as $from {
// range check
let result = self as $into;
if result as $from != self.trunc() {
return Err(Error::Value("invalid float value for this operation".into()));
}