MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / DegToDeg

Function DegToDeg

extern/ttmath/ttmath.h:1626–1658  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1624 */
1625 template<class ValueType>
1626 ValueType DegToDeg( const ValueType & d, const ValueType & m, const ValueType & s,
1627 ErrorCode * err = 0)
1628 {
1629 ValueType delimiter, multipler;
1630 uint c = 0;
1631
1632 if( d.IsNan() || m.IsNan() || s.IsNan() || m.IsSign() || s.IsSign() )
1633 {
1634 if( err )
1635 *err = err_improper_argument;
1636
1637 delimiter.SetZeroNan(); // not needed, only to get rid of GCC warning about an uninitialized variable
1638
1639 return delimiter;
1640 }
1641
1642 multipler = 60;
1643 delimiter = 3600;
1644
1645 c += multipler.Mul(m);
1646 c += multipler.Add(s);
1647 c += multipler.Div(delimiter);
1648
1649 if( d.IsSign() )
1650 multipler.ChangeSign();
1651
1652 c += multipler.Add(d);
1653
1654 if( err )
1655 *err = c ? err_overflow : err_ok;
1656
1657 return multipler;
1658 }
1659
1660
1661 /*!

Callers 2

DegToRadFunction · 0.85
DegToGradFunction · 0.85

Calls 5

IsSignMethod · 0.80
ChangeSignMethod · 0.80
MulMethod · 0.45
AddMethod · 0.45
DivMethod · 0.45

Tested by

no test coverage detected