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

Normalize: Use float instead of double #146

Open
mk-mxp opened this issue Feb 10, 2024 · 5 comments
Open

Normalize: Use float instead of double #146

mk-mxp opened this issue Feb 10, 2024 · 5 comments
Labels
paused Work paused until further notice x:action/improve Improve existing functionality/content x:knowledge/none No existing Exercism knowledge required x:module/representer Work on Representers x:rep/small Small amount of reputation x:size/small Small amount of work x:type/coding Write code that is not student-facing content (e.g. test-runners, generators, but not exercises)

Comments

@mk-mxp
Copy link

mk-mxp commented Feb 10, 2024

I came across this in the PHP track docs:

  • Casts (float) and (real) are normalized to (double)

Was there a discussion about that anywhere? Because double is not seen by PHP as a type, it is seen as an alias for float only:

(double) and (real) are aliases of the (float) cast. These casts do not use the canonical type name and are not recommended.

Througout the PHP documentation float is used as the type for floating point numbers.

See:

Copy link

Hello. Thanks for opening an issue on Exercism 🙂

At Exercism we use our Community Forum, not GitHub issues, as the primary place for discussion. That allows maintainers and contributors from across Exercism's ecosystem to discuss your problems/ideas/suggestions without them having to subscribe to hundreds of repositories.

This issue will be automatically closed. Please use this link to copy your GitHub Issue into a new topic on the forum, where we look forward to chatting with you!

If you're interested in learning more about this auto-responder, please read this blog post.

@homersimpsons
Copy link
Collaborator

homersimpsons commented Feb 11, 2024

Reference forum post: https://forum.exercism.org/t/php-normalize-use-float-instead-of-double/9740

Note that this will require a new run of the representer. It will certainly make sense to batch it with other changes.

I did flag it as "paused", I had other improvements to include in the representer that I could write in new issues. Once all the merge are ready we could increase the representer version.

We should also update the documentation.

@homersimpsons homersimpsons added paused Work paused until further notice x:rep/tiny Tiny amount of reputation x:module/representer Work on Representers x:action/improve Improve existing functionality/content x:knowledge/none No existing Exercism knowledge required x:size/tiny Tiny amount of work x:type/coding Write code that is not student-facing content (e.g. test-runners, generators, but not exercises) php x:rep/small Small amount of reputation x:size/small Small amount of work and removed x:rep/tiny Tiny amount of reputation x:size/tiny Tiny amount of work labels Feb 11, 2024
@tomasnorre
Copy link

If a tool like https://github.com/rectorphp/rector was introduced, changes like this, and PHP Upgrades to new versions later on, would be done quite easily.

@homersimpsons
Copy link
Collaborator

This change cannot be done with rector, technically this is a one-line change:

$node->setAttribute('kind', Double::KIND_DOUBLE);

- $node->setAttribute('kind', Double::KIND_DOUBLE);
+ $node->setAttribute('kind', Double::KIND_FLOAT);

Some tests and documentation has to be updated then.

As this representation is not displayed to any user and this change would require a new run of the representer I'm not in favour of doing it without including other "bigger" changes.

@tomasnorre
Copy link

OK. Fair, I understood it differently. Just ignore my comment.

@github-actions github-actions bot removed the php label Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
paused Work paused until further notice x:action/improve Improve existing functionality/content x:knowledge/none No existing Exercism knowledge required x:module/representer Work on Representers x:rep/small Small amount of reputation x:size/small Small amount of work x:type/coding Write code that is not student-facing content (e.g. test-runners, generators, but not exercises)
Projects
None yet
Development

No branches or pull requests

3 participants