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 5972433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:39:25+00:00 2026-05-22T20:39:25+00:00

I find this strange. While it makes sense that strtod accepts ‘e’ as one

  • 0

I find this strange.

While it makes sense that strtod accepts ‘e’ as one of the characters (exactly one to be precise) in the input string I find that it also accepts ‘d’.

Can someone please explain?

#include < stdio.h >
#include < stdlib.h >
int main ()
{
char *s[] = {"1a1", "1e1", "1d1", "1f1"};
char * pEnd;
double d0, d1, d2, d3;
d0 = strtod (s[0],&pEnd);
d1 = strtod (s[1],NULL);
d2 = strtod (s[2],NULL);
d3 = strtod (s[3],NULL);
printf ("::: [%f] [%f] [%f] [%f] \n", d0, d1, d2, d3);
return 0;
}
  • 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-22T20:39:27+00:00Added an answer on May 22, 2026 at 8:39 pm

    What Compiler/Libraries are you using to compile this code? Assuming you’re on Visual Studio, this behaviour is expected (quoting text from the MSDN):

    strtod expects nptr to point to a
    string of the following form:

    [whitespace] [sign] [digits] [.digits]
    [ {d | D | e | E}[sign]digits]

    You can find the full documentation for strtod here

    Other implementations of the library would probably support something similar. However, the man-page for strtod found here, doesn’t state that d is recognized as a valid character for the conversion purpose. In such a case, it would cause the parsing of the input string to stop and only characters parsed until that point would be converted (the same happens for the strings containing a and f).

    Perhaps you should look at documentation for your library implementation and find out the format that strtod would be able to parse for your specific case.

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

Sidebar

Related Questions

I find this very strange, must be something I'm doing wrong, but still... I'm
I have this strange issue where anytime I open a XAML file that contains
I've spent a while reading up on this and have yet to find an
I'm trying to find a really strange bug in my application and while looking
I'm using this function that helps my webdevelopers to find a piece of code
I find this comes up a lot, and I'm not sure the best way
I find this line in the ZenTest source code: result = @test_mappings.find { |file_re,
I find this pretty confusing. When you want to rotate a view, it's going
I find this question a little tricky. Maybe someone knows an approach to answer
i find this question tricky but what files store method signature info for xml

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.