5 #include <hilti/ast/operators/common.h> 6 #include <hilti/ast/types/bool.h> 7 #include <hilti/ast/types/real.h> 8 #include <hilti/ast/types/string.h> 9 #include <hilti/ast/types/type.h> 10 #include <hilti/base/logger.h> 14 STANDARD_OPERATOR_1(real, SignNeg, type::Real(), type::Real(),
"Inverts the sign of the real.");
15 STANDARD_OPERATOR_2(real, Difference, type::Real(), type::Real(), type::Real(),
16 "Returns the difference between the two values.");
17 STANDARD_OPERATOR_2(real, DifferenceAssign, type::Real(), type::Real(), type::Real(),
18 "Subtracts the second value from the first, assigning the new value.");
19 STANDARD_OPERATOR_2(real, Division, type::Real(), type::Real(), type::Real(),
"Divides the first value by the second.");
20 STANDARD_OPERATOR_2(real, DivisionAssign, type::Real(), type::Real(), type::Real(),
21 "Divides the first value by the second, assigning the new value.");
22 STANDARD_OPERATOR_2(real, Equal, type::Bool(), type::Real(), type::Real(),
"Compares the two reals.");
23 STANDARD_OPERATOR_2(real, Greater, type::Bool(), type::Real(), type::Real(),
"Compares the two reals.");
24 STANDARD_OPERATOR_2(real, GreaterEqual, type::Bool(), type::Real(), type::Real(),
"Compares the two reals.");
25 STANDARD_OPERATOR_2(real, Lower, type::Bool(), type::Real(), type::Real(),
"Compares the two reals.");
26 STANDARD_OPERATOR_2(real, LowerEqual, type::Bool(), type::Real(), type::Real(),
"Compares the two reals.");
27 STANDARD_OPERATOR_2(real, Modulo, type::Real(), type::Real(), type::Real(),
28 "Computes the modulus of the first real divided by the second.");
29 STANDARD_OPERATOR_2(real, Multiple, type::Real(), type::Real(), type::Real(),
30 "Multiplies the first real by the second.");
31 STANDARD_OPERATOR_2(real, MultipleAssign, type::Real(), type::Real(), type::Real(),
32 "Multiplies the first value by the second, assigning the new value.");
33 STANDARD_OPERATOR_2(real, Power, type::Real(), type::Real(), type::Real(),
34 "Computes the first real raised to the power of the second.");
35 STANDARD_OPERATOR_2(real, Sum, type::Real(), type::Real(), type::Real(),
"Returns the sum of the reals.");
36 STANDARD_OPERATOR_2(real, SumAssign, type::Real(), type::Real(), type::Real(),
37 "Adds the first real to the second, assigning the new value.");
38 STANDARD_OPERATOR_2(real, Unequal, type::Bool(), type::Real(), type::Real(),
"Compares the two reals.");
40 STANDARD_OPERATOR_2x(real, CastToUnsignedInteger, Cast, operator_::typedType(1,
"uint<*>"), type::Real(),
41 type::Type_(type::UnsignedInteger(type::Wildcard())),
42 "Converts the value to an unsigned integer type, accepting any loss of information.");
43 STANDARD_OPERATOR_2x(real, CastToSignedInteger, Cast, operator_::typedType(1,
"int<*>"), type::Real(),
44 type::Type_(type::SignedInteger(type::Wildcard())),
45 "Converts the value to a signed integer type, accepting any loss of information.");
46 STANDARD_OPERATOR_2x(real, CastToTime, Cast, type::Time(), type::Real(), type::Type_(type::Time()),
47 "Interprets the value as number of seconds since the UNIX epoch.");
48 STANDARD_OPERATOR_2x(real, CastToInterval, Cast, type::Interval(), type::Real(), type::Type_(type::Interval()),
49 "Interprets the value as number of seconds.");