Skip to content

Commit

Permalink
Use fmt library in Double stringify
Browse files Browse the repository at this point in the history
  • Loading branch information
f0reachARR committed Sep 26, 2024
1 parent f0b2eb3 commit 6017248
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion openscenario/openscenario_interpreter/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

<depend>concealer</depend>
<depend>geometry_msgs</depend>
<depend>fmt</depend>
<depend>libboost-dev</depend>
<depend>libgoogle-glog-dev</depend>
<depend>lifecycle_msgs</depend>
Expand All @@ -37,4 +38,4 @@
<export>
<build_type>ament_cmake</build_type>
</export>
</package>
</package>
4 changes: 3 additions & 1 deletion openscenario/openscenario_interpreter/src/syntax/double.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <fmt/format.h>

#include <boost/lexical_cast.hpp>
#include <iomanip>
#include <limits>
Expand Down Expand Up @@ -97,7 +99,7 @@ auto operator>>(std::istream & is, Double & datum) -> std::istream &

auto operator<<(std::ostream & os, const Double & datum) -> std::ostream &
{
return os << std::fixed << std::setprecision(30) << datum.data;
return os << fmt::format("{:.30f}", datum.data);
}
} // namespace syntax
} // namespace openscenario_interpreter

0 comments on commit 6017248

Please sign in to comment.