@@ -1,6 +1,7 | |||
|
1 | 1 | using System; |
|
2 | 2 | using System.Collections.Generic; |
|
3 | 3 | using System.IO; |
|
4 | using System.Globalization; | |
|
4 | 5 | |
|
5 | 6 | namespace Implab.JSON { |
|
6 | 7 | public class JSONWriter { |
@@ -35,7 +36,6 namespace Implab.JSON { | |||
|
35 | 36 | |
|
36 | 37 | public JSONWriter(TextWriter writer) { |
|
37 | 38 | Safe.ArgumentNotNull(writer, "writer"); |
|
38 | ||
|
39 | 39 | m_writer = writer; |
|
40 | 40 | } |
|
41 | 41 | |
@@ -262,7 +262,14 namespace Implab.JSON { | |||
|
262 | 262 | } |
|
263 | 263 | |
|
264 | 264 | void Write(double value) { |
|
265 |
|
|
|
265 | if (double.IsNaN(value)) | |
|
266 | Write("NaN"); | |
|
267 | else if (double.IsNegativeInfinity(value)) | |
|
268 | Write("-Infinity"); | |
|
269 | else if (double.IsPositiveInfinity(value)) | |
|
270 | Write("Infinity"); | |
|
271 | else | |
|
272 | m_writer.Write(value.ToString(CultureInfo.InvariantCulture)); | |
|
266 | 273 | } |
|
267 | 274 | |
|
268 | 275 | void OperationNotApplicable(string opName) { |
General Comments 0
You need to be logged in to leave comments.
Login now