1: <?php
2: /**
3: * Hard type support
4: * For when you absolutely want to know what you are getting
5: *
6: * @author Ashley Kitson <akitson@zf4.biz>
7: * @copyright Ashley Kitson, UK, 2014
8: * @licence GPL V3 or later : http://www.gnu.org/licenses/gpl.html
9: */
10: namespace chippyash\Type\Interfaces;
11:
12: /**
13: * A interface to mark numeric types
14: */
15: interface NumericTypeInterface
16: {
17:
18: /**
19: * Negates the number
20: *
21: * @return \chippyash\Type\Interfaces\NumericTypeInterface Fluent Interface
22: */
23: public function negate();
24:
25: /**
26: * Return the number as a Complex number i.e. n+0i
27: *
28: * @return \chippyash\Type\Number\Complex\ComplexType
29: */
30: public function asComplex();
31:
32: /**
33: * Return number as Rational number.
34: * NB, numerator and denominator will be caste as IntTypes
35: *
36: * @return \chippyash\Type\Number\Rational\RationalType
37: */
38: public function asRational();
39:
40: /**
41: * Return number as an IntType number.
42: *
43: * @return \chippyash\Type\Number\IntType
44: */
45: public function asIntType();
46:
47: /**
48: * Return number as a FloatType number.
49: *
50: * @return \chippyash\Type\Number\FloatType
51: */
52: public function asFloatType();
53:
54: /**
55: * Return the absolute value of the number
56: *
57: * @return \chippyash\Type\Interfaces\NumericTypeInterface
58: */
59: public function abs();
60: }
61: