Spicy
real.h
1 // Copyright (c) 2020-2021 by the Zeek Project. See LICENSE for details.
2 
3 #pragma once
4 
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>
11 
12 namespace hilti::operator_ {
13 STANDARD_OPERATOR_1(real, SignNeg, type::Real(), type::Real(), "Inverts the sign of the real.");
14 STANDARD_OPERATOR_2(real, Difference, type::Real(), type::Real(), type::Real(),
15  "Returns the difference between the two values.");
16 STANDARD_OPERATOR_2(real, DifferenceAssign, type::Real(), type::Real(), type::Real(),
17  "Subtracts the second value from the first, assigning the new value.");
18 STANDARD_OPERATOR_2(real, Division, type::Real(), type::Real(), type::Real(), "Divides the first value by the second.");
19 STANDARD_OPERATOR_2(real, DivisionAssign, type::Real(), type::Real(), type::Real(),
20  "Divides the first value by the second, assigning the new value.");
21 STANDARD_OPERATOR_2(real, Equal, type::Bool(), type::Real(), type::Real(), "Compares the two reals.");
22 STANDARD_OPERATOR_2(real, Greater, type::Bool(), type::Real(), type::Real(), "Compares the two reals.");
23 STANDARD_OPERATOR_2(real, GreaterEqual, type::Bool(), type::Real(), type::Real(), "Compares the two reals.");
24 STANDARD_OPERATOR_2(real, Lower, type::Bool(), type::Real(), type::Real(), "Compares the two reals.");
25 STANDARD_OPERATOR_2(real, LowerEqual, type::Bool(), type::Real(), type::Real(), "Compares the two reals.");
26 STANDARD_OPERATOR_2(real, Modulo, type::Real(), type::Real(), type::Real(),
27  "Computes the modulus of the first real divided by the second.");
28 STANDARD_OPERATOR_2(real, Multiple, type::Real(), type::Real(), type::Real(),
29  "Multiplies the first real by the second.");
30 STANDARD_OPERATOR_2(real, MultipleAssign, type::Real(), type::Real(), type::Real(),
31  "Multiplies the first value by the second, assigning the new value.");
32 STANDARD_OPERATOR_2(real, Power, type::Real(), type::Real(), type::Real(),
33  "Computes the first real raised to the power of the second.");
34 STANDARD_OPERATOR_2(real, Sum, type::Real(), type::Real(), type::Real(), "Returns the sum of the reals.");
35 STANDARD_OPERATOR_2(real, SumAssign, type::Real(), type::Real(), type::Real(),
36  "Adds the first real to the second, assigning the new value.");
37 STANDARD_OPERATOR_2(real, Unequal, type::Bool(), type::Real(), type::Real(), "Compares the two reals.");
38 
39 STANDARD_OPERATOR_2x(real, CastToUnsignedInteger, Cast, operator_::typedType(1, "uint<*>"), type::Real(),
40  type::Type_(type::UnsignedInteger(type::Wildcard())),
41  "Converts the value to an unsigned integer type, accepting any loss of information.");
42 STANDARD_OPERATOR_2x(real, CastToSignedInteger, Cast, operator_::typedType(1, "int<*>"), type::Real(),
43  type::Type_(type::SignedInteger(type::Wildcard())),
44  "Converts the value to a signed integer type, accepting any loss of information.");
45 STANDARD_OPERATOR_2x(real, CastToTime, Cast, type::Time(), type::Real(), type::Type_(type::Time()),
46  "Interprets the value as number of seconds since the UNIX epoch.");
47 STANDARD_OPERATOR_2x(real, CastToInterval, Cast, type::Interval(), type::Real(), type::Type_(type::Interval()),
48  "Interprets the value as number of seconds.");
49 
50 } // namespace hilti::operator_
Definition: operator-registry.h:15