thegrumpys / odop

Open Design Optimization Platform (ODOP) - Coil spring design app; mechanical springs; compression spring, extension spring, torsion spring
https://www.springdesignsoftware.org
MIT License
4 stars 5 forks source link

Allow save & restore of NaN & Infinite values #868

Open grumpyinca opened 11 months ago

grumpyinca commented 11 months ago

Summary

This issue proposes making changes to permit the save & restore of NaN & Infinite values.

Background

JSON format does not handle NaN and Infinity. Currently, there is a bit of a problem in that File : Save, File : SaveAs & File : Export operations with design values of NaN & Infinity have those values converted to "null" after the corresponding File : Open and File : Import operations.

Issue #861 evaluated but ultimately rejected JSON5 as a solution to this situation.

Possible way forward

Issue #861 recommends: " ... create a post-processor in the client on FileSave, FileSaveAs, or FileExport to encode only what we need. Specifically to encode and transmit NaN, positive Infinity, and negative Infinity as strings to the server. Then the server would receive this encoded form and save it into the database as-is. On the opposite end when loading via FileOpen, or FileImport the server would read the encoded data/message and transmit it to the client. The client would then decode the encoded NaN, positive Infinity, and negative Infinity strings into Number.NaN, Number.POSITIVE_INFINITY, or Number.NEGATIVE_INFINITY."