averbraeck / djunits

Delft Java UNIT System for using strongly-typed quantities and units
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

Missing constants #13

Closed Peter-Knoppers closed 1 year ago

Peter-Knoppers commented 1 year ago

The file value/vdouble/scalar/base/Constants.java defines a number of physical and mathematical constants. Sorely missing are: pi (but we do have tau) e (Euler's constant) Slighly less important (because it is quite easy to "construct"): phi (The golden ratio; (1+sqrt(5)/2)

averbraeck commented 1 year ago

The constants E, PHI and PI have been added as Dimensionless constants to the Constants class, and as FloatDimensionless constants to the FloatConstants class. Additionally, the FloatConstants class now contains FloatSIScalar, FloatDimensionless, FloatMass, etc, where the previous version defined double constants (which was clearly wrong).

averbraeck commented 1 year ago

The unit tests have also been adapted to test the float values in FloatConstants up to 1 ulp precision for the expected value.

averbraeck commented 1 year ago

All unit tests for Constants and FloatConstants pass, so this issue can be closed.