Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6199969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:17:02+00:00 2026-05-24T04:17:02+00:00

While working with a yaml document, I found that one of my values was

  • 0

While working with a yaml document, I found that one of my values was getting parsed as a string with snakeyaml:

-8e-05

I found that ros, which uses yaml-cpp to write yamls is using the following code to write an array

out << YAML::BeginSeq;
for (int i = 0; i < m.rows*m.cols; ++i)
  out << m.data[i];
out << YAML::EndSeq;

but the c++ code above (copied from ros “parse_yml.cpp” in the camera_calibration package) creates -8e-05 while snakeyaml parses it as a string.

So who’s right, should there be a bug report? if so to who? The 1.2 yaml specification seems to allow for optional decimal, but I couldn’t figure out if the 1.1 yaml spec allows it which snakeyaml implements.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T04:17:03+00:00Added an answer on May 24, 2026 at 4:17 am

    The output should be parsed as !!float according to YAML 1.2, but originally was !!str in YAML 1.1; as @psr says, this is to match the JSON spec.

    The YAML 1.2 spec gives a JSON schema and an extension, the “core schema”. In both cases, the !!float regular expression is:

    [-+]? ( \. [0-9]+ | [0-9]+ ( \. [0-9]* )? ) ( [eE] [-+]? [0-9]+ )?
    

    which allows for an optional decimal. (The core schema adds support for infinity and not-a-number.)

    The YAML 1.1 spec didn’t specify this type of tag resolution directly, but it gave several related pages for each type. The !!float page lists the regular expression:

    [-+]?([0-9][0-9_]*)?\.[0-9.]*([eE][-+][0-9]+)?
    

    (as well as versions for base-60, infinity, and not-a-number).
    This appears to require the decimal.

    This has been fixed in SnakeYAML (see http://code.google.com/p/snakeyaml/issues/detail?id=130), as of version 1.9.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have code that relies heavily on yaml for cross-language serialization and while working
while working in c/c++, 1.cin/cout or 2.scanf/printf , which one of both , will
While working a project tonight, I ended up using one .js resource file for
While working on an Xcode project i keep getting the spinning wheel while switching
While working with ActiveRecord I have a table which stores a serialized array of
I am working on a personal project that uses a custom config file. The
While working on a question/answer program for school, it occurred to me that I
While working on an existing Drupal site I've noticed a strange glitch that causes
While working on Hadoop Implementation in Pseudo-Distributed Operation, I found following exception of JAVA_HOME
while working with WF 4.0 I noticed that the WorkflowApplication class exposes action properties

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.