infinity

Open
#386 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
cpp
Domain
backend

Research direction

Start with the tutorial's Very Simple Case in main.cpp and reproduce the text archive containing inf using the float infinity value. Trace the text archive deserialization path and compare it with the existing finite-float case; done means the serialized infinity value can be read back without an archive_exception.

Written by the indexing model from the issue text.

Description

Hi,

If I take the "Very Simple Case" from the tutorial, I get a text file with 22 serialization::archive 20 0 0 35 59 2.456699944e+01

Then:

--- a/main.cpp
+++ b/main.cpp
@@ -39,7 +39,7 @@ int main() {
     std::ofstream ofs("filename");
 
     // create class instance
-    const gps_position g(35, 59, 24.567f);
+    const gps_position g(35, 59, std::numeric_limits<float>::infinity());
 
     // save data to archive
     {

lead to 22 serialization::archive 20 0 0 35 59 inf for the serialization, but deserialization fail with:

terminate called after throwing an instance of 'boost::archive::archive_exception'
  what():  input stream error
Abandon                    (core dumped) ./build/inf

Is there a way to handle this kind of value ?

Dominant language
C++
Stars
135
Forks
148
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from boostorg/serialization

All issues in boostorg/serialization

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.