(self)
| 38 | impl Into<f64> for NumVal |
| 39 | { |
| 40 | fn into(self) -> f64 |
| 41 | { |
| 42 | use num_traits::float::FloatCore as _; |
| 43 | |
| 44 | let sign = if self.neg |
| 45 | { |
| 46 | -1.0 |
| 47 | } |
| 48 | else |
| 49 | { |
| 50 | 1.0 |
| 51 | }; |
| 52 | |
| 53 | (self.int as f64 + self.frac as f64 / 10f64.powi(self.frac_len as i32)) |
| 54 | * 10f64.powi(self.exp) |
| 55 | * sign |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | pub type JsonObj = Vec<(Vec<char>, JsonVal)>; |