Refactoring #1304

Feature #1290: === Core: framework ===

Unify treatment of numeric constants.

Added by wuttke almost 5 years ago. Updated over 4 years ago.

Status:ResolvedStart date:03 Aug 2016
Priority:NormalDue date:
Assignee:-% Done:

100%

Category:-
Target version:-

Description

A constant is not a unit. Constants should be moved from Units.h to a new file Const.h.

At a few places, we are using M_PI though we have our own PI etc. We should eliminate one of the two sets of constants. If we opt against M_PI, we can also remove _USE_MATH_DEFINES from SetUpWindows.cmake.

We should define complex constants cone(1.,0.), cim(0.,1.), and possible zero(0.,0.).


Subtasks

Feature #1564: split "Pi.h" from Units.hArchivedwuttke

History

#1 Updated by wuttke over 4 years ago

  • Description updated (diff)

M_PI is used in several third-party sources. We do not want to patch them. Therefore we cannot get rid of M_PI. We rather need to rely on compiler settings that ensure that M_PI is defined.

Unfortunately, it turns out that those compiler settings are not sufficient to guarantee that M_PI_2 is defined as well.

Per commit ac1d8bb0, the solution is to define or redefine M_PI, M_PI_2 etc, just as they are defined in a section of math.h that is not normally activated.

#2 Updated by wuttke over 4 years ago

  • Description updated (diff)
  • Status changed from New to Resolved

Units.h now only contains physical units.

Complex constants should be locally in math-heavy files.

Also available in: Atom PDF