boostorg / boostorg/serialization

infinity

Open
#386 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
134
Forks
148
Avg merge
2d 23h
Merged PRs (30d)
5

Description

Hi,

If I take the "Very Simple Case" from the [tutorial](https://www.boost.org/doc/libs/1_92_0/libs/serialization/doc/index.html), I get a text file with `22 serialization::archive 20 0 0 35 59 2.456699944e+01`

Then:
```diff
--- 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::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 ?

Contributor guide

No contributing guide indexed for this repository

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.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.