Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perlapi: Combine Strtod, my_strtod #22349

Merged
merged 1 commit into from
Jul 1, 2024
Merged

Conversation

khwilliamson
Copy link
Contributor

And clarify the pod

Copy link
Contributor

@jkeenan jkeenan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When calling perldoc pod/perlapi.pod in the file generated from building your branch, I read:

    "my_strtod"
    "Strtod"
        These are identical.

... and then later I see the signatures:

            NV  my_strtod(const char * const s, char **e)
            NV  Strtod   (const char * const s, char ** e)

... which, on the face of it, are not identical. Is the wordspace before the final e material? If not, can we make the signature end in char**e in both instances?

@mauke
Copy link
Contributor

mauke commented Jun 26, 2024

The space is immaterial. As far as C is concerned, char**e and char * * e are the same token sequence and are parsed the same way.¹

I think this line in perl.h is responsible for giving Strtod the extra space:

=for apidoc AmTR|NV|Strtod|NN const char * const s|NULLOK char ** e

¹ I'd never write char**e (without any spaces) though, because the * is syntactically a unary prefix operator. Fully parenthesized, the declaration would be char (*(*(e))), i.e. it's all grouping to the right.

numeric.c Outdated
Comment on lines 90 to 92
Their return value is an NV. Plain C<strod> returns a double precision value.
NV's are always the largest precision available, which depends on platform
capabilities and F<Configure> options.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NV isn't the largest precision enabled, otherwise it would always be __float128 on gcc.

It's just the floating point type perl is configured to use.

@khwilliamson khwilliamson merged commit f841d64 into Perl:blead Jul 1, 2024
29 checks passed
@khwilliamson khwilliamson deleted the Strtod branch July 1, 2024 02:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants