Skip to content

units: Improve precision of angle conversion #18

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion include/boost/units/base_units/angle/degree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
#ifndef BOOST_UNITS_ANGLE_DEGREE_BASE_UNIT_HPP
#define BOOST_UNITS_ANGLE_DEGREE_BASE_UNIT_HPP

#include <boost/math/constants/constants.hpp>

#include <boost/units/conversion.hpp>
#include <boost/units/base_units/angle/radian.hpp>

BOOST_UNITS_DEFINE_BASE_UNIT_WITH_CONVERSIONS(angle,degree,"degree","deg",6.28318530718/360.,boost::units::angle::radian_base_unit,-101);
BOOST_UNITS_DEFINE_BASE_UNIT_WITH_CONVERSIONS(angle,degree,"degree","deg",boost::math::constants::degree<double>(),boost::units::angle::radian_base_unit,-101);

#if BOOST_UNITS_HAS_BOOST_TYPEOF

Expand Down
4 changes: 3 additions & 1 deletion include/boost/units/base_units/angle/gradian.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
#ifndef BOOST_UNITS_ANGLE_GRADIAN_BASE_UNIT_HPP
#define BOOST_UNITS_ANGLE_GRADIAN_BASE_UNIT_HPP

#include <boost/math/constants/constants.hpp>

#include <boost/units/conversion.hpp>
#include <boost/units/base_units/angle/radian.hpp>

BOOST_UNITS_DEFINE_BASE_UNIT_WITH_CONVERSIONS(angle,gradian,"gradian","grad",6.28318530718/400.,boost::units::angle::radian_base_unit,-102);
BOOST_UNITS_DEFINE_BASE_UNIT_WITH_CONVERSIONS(angle,gradian,"gradian","grad",boost::math::constants::two_pi<double>()/400.0,boost::units::angle::radian_base_unit,-102);

#if BOOST_UNITS_HAS_BOOST_TYPEOF

Expand Down