use FastMath and Constants
Merge branch 'snap-1.1.x' into opt1
Merge branch 'snap-1.1.x' into opt1