Ticket #6893: boost-angle-precision2.patch

File boost-angle-precision2.patch, 1.8 KB (added by Roger Leigh <rleigh@…>, 7 years ago)

Updated patch; use degree constant directly (not possible for grad--no constant defined)

  • boost/units/base_units/angle/degree.hpp

    diff -urN boost_1_58_0-orig/boost/units/base_units/angle/degree.hpp boost_1_58_0/boost/units/base_units/angle/degree.hpp
    old new  
    1111#ifndef BOOST_UNITS_ANGLE_DEGREE_BASE_UNIT_HPP
    1212#define BOOST_UNITS_ANGLE_DEGREE_BASE_UNIT_HPP
    1313
     14#include <boost/math/constants/constants.hpp>
     15
    1416#include <boost/units/conversion.hpp>
    1517#include <boost/units/base_units/angle/radian.hpp>
    1618
    17 BOOST_UNITS_DEFINE_BASE_UNIT_WITH_CONVERSIONS(angle,degree,"degree","deg",6.28318530718/360.,boost::units::angle::radian_base_unit,-101);
     19BOOST_UNITS_DEFINE_BASE_UNIT_WITH_CONVERSIONS(angle,degree,"degree","deg",boost::math::constants::degree<double>(),boost::units::angle::radian_base_unit,-101);
    1820
    1921#if BOOST_UNITS_HAS_BOOST_TYPEOF
    2022
  • boost/units/base_units/angle/gradian.hpp

    diff -urN boost_1_58_0-orig/boost/units/base_units/angle/gradian.hpp boost_1_58_0/boost/units/base_units/angle/gradian.hpp
    old new  
    1111#ifndef BOOST_UNITS_ANGLE_GRADIAN_BASE_UNIT_HPP
    1212#define BOOST_UNITS_ANGLE_GRADIAN_BASE_UNIT_HPP
    1313
     14#include <boost/math/constants/constants.hpp>
     15
    1416#include <boost/units/conversion.hpp>
    1517#include <boost/units/base_units/angle/radian.hpp>
    1618
    17 BOOST_UNITS_DEFINE_BASE_UNIT_WITH_CONVERSIONS(angle,gradian,"gradian","grad",6.28318530718/400.,boost::units::angle::radian_base_unit,-102);
     19BOOST_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);
    1820
    1921#if BOOST_UNITS_HAS_BOOST_TYPEOF
    2022