From 3e2f92c753d28b18d2de04abde3ae1e45ab46efd Mon Sep 17 00:00:00 2001 From: Felix Krause Date: Wed, 7 Sep 2022 16:54:11 +0200 Subject: [PATCH] Fixed a bug in float deserialization. * fixes #124 --- yaml/serialization.nim | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/yaml/serialization.nim b/yaml/serialization.nim index 6b27c17..00d68bb 100644 --- a/yaml/serialization.nim +++ b/yaml/serialization.nim @@ -297,9 +297,13 @@ proc constructObject*[T: float|float32|float64]( let hint = guessType(item.scalarContent) case hint of yTypeFloat: - discard parseBiggestFloat(item.scalarContent, result) + var res: BiggestFloat + discard parseBiggestFloat(item.scalarContent, res) + result = res of yTypeInteger: - discard parseBiggestFloat(item.scalarContent, result) + var res: BiggestFloat + discard parseBiggestFloat(item.scalarContent, res) + result = res of yTypeFloatInf: if item.scalarContent[0] == '-': result = NegInf else: result = Inf