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

The TAU constant. #21308

Closed
DartBot opened this issue Oct 12, 2014 · 8 comments
Closed

The TAU constant. #21308

DartBot opened this issue Oct 12, 2014 · 8 comments
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. closed-duplicate Closed in favor of an existing report library-math type-enhancement A request for a change that isn't a bug

Comments

@DartBot
Copy link

DartBot commented Oct 12, 2014

This issue was originally filed by @si-robertson


This is a small request for the TAU constant to be added to the math.dart library.

  /**
   * The TAU constant.
   */
  const double TAU = 6.2831853071795864;

I'm sure most of the Dart team will understand why this would be useful :)

@DartBot
Copy link
Author

DartBot commented Oct 12, 2014

This comment was originally written by @mezoni


I agree too.
The following constants also should be added:

E = 2.71828182845904523536028747135266250 // Neper number
SQRT_2 = 1,41421356237309504880168872420969808
SQRT_3 = 1,73205080756887729352744634150587237
PHI = 1,61803398874989484820458683436563812 // Golden ratio

@lrhn
Copy link
Member

lrhn commented Oct 13, 2014

Added Library-Math, Area-Library, Triaged labels.

@lrhn
Copy link
Member

lrhn commented Oct 13, 2014

Another options is to have the values as static constants on the double class.
That would avoid adding top-level constants that may conflict with existing constants in other libraries.

@floitschG
Copy link
Contributor

Closing this bug as duplicate of issue #4.

Wrt comment #­2, we already have: E and SQRT2.
Please open new bugs for PHI and SQRT3, if you think they should be added.


Added Duplicate label.
Marked as being merged into #14.

@DartBot
Copy link
Author

DartBot commented Oct 13, 2014

This comment was originally written by @si-robertson


I'm not sure merging this request with a 32 month old "WontFix" bug was the best thing to do because this request has more or less been flatlined as a result. The TAU constant is still being requested so I believe reconsideration by the Dart team is warranted at this time.

@lrhn
Copy link
Member

lrhn commented Oct 13, 2014

The arguments used to close the request the first time are still valid.

Filing a new issue for the same change won't change that - this is a duplicate of issue #14.

A solution would be to add a package, e.g., "math_constants", with all the constants you can think of. They don't have to be in dart:math.

The expression (2.0*PI) is a compile-time constant in Dart, so there should be no performance penalty.

@DartBot
Copy link
Author

DartBot commented Oct 13, 2014

This comment was originally written by @si-robertson


I didn't say this request wasn't a duplicate, I said the Dart team should reconsider the request for TAU seeing as it's still being requested almost three years later. I wasn't even aware of issue #14 until this request was merged with it.

If the Dart team is refusing to add this due to possible conflicts with user created libraries then that excuse also blocks any new APIs from being added to Dart in the future, right? What happens if someone has a FileLoader class in their library and the W3C one day decide to add a class with the same name to the standard JavaScript File API, how are the Dart team doing to handle that without breaking existing code.

E, LN10, LOG2E, PI and all the others are also compile-time constants.

@floitschG
Copy link
Contributor

The need for E, LN10, ... is higher than for Tau. While I remember how to get to Tau (= 2PI) I don't remember the values for E, LN10, ...
Furthermore, 2
PI doesn't even lose in precision (because it's just a multiplication by two which is a trivial increment of the exponent in binary floating-point representation).

Finally: http://www.thepimanifesto.com/

@DartBot DartBot added Type-Enhancement library-math area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. closed-duplicate Closed in favor of an existing report labels Oct 13, 2014
@kevmoo kevmoo added type-enhancement A request for a change that isn't a bug and removed priority-unassigned labels Mar 1, 2016
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. closed-duplicate Closed in favor of an existing report library-math type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

4 participants