Table of Contents
This function will evaluate a mathematical expression that may contain variables and format the result according to the provided formatt string.
The formatting string uses the standard POSIX printf format.
All the mathematical computations are done using floats.
The supported infix mathematical syntax, in order of precedence, is:
-
(
and)
parentheses for grouping expressions -
^
operator for exponentiation -
*
and/
operators for multiplication and division -
%
operators for modulo operation -
+
and-
operators for addition and subtraction -
==
"close enough" operator to tell if two expressions evaluate to the same number, with a tiny margin to tolerate floating point errors. It returns 1 or 0. -
>=
"greater or close enough" operator with a tiny margin to tolerate floating point errors. It returns 1 or 0. -
>
"greater than" operator. It returns 1 or 0. -
<=
"less than or close enough" operator with a tiny margin to tolerate floating point errors. It returns 1 or 0. -
<
"less than" operator. It returns 1 or 0.
The numbers can be in any format acceptable to the C scanf
function
with the %lf
format specifier, followed by the k
, m
, g
, t
, or
p
SI units. So e.g. -100
and 2.34m
are valid numbers.
In addition, the following constants are recognized:
-
e
: 2.7182818284590452354 -
log2e
: 1.4426950408889634074 -
log10e
: 0.43429448190325182765 -
ln2
: 0.69314718055994530942 -
ln10
: 2.30258509299404568402 -
pi
: 3.14159265358979323846 -
pi_2
: 1.57079632679489661923 (pi over 2) -
pi_4
: 0.78539816339744830962 (pi over 4) -
1_pi
: 0.31830988618379067154 (1 over pi) -
2_pi
: 0.63661977236758134308 (2 over pi) -
2_sqrtpi
: 1.12837916709551257390 (2 over square root of pi) -
sqrt2
: 1.41421356237309504880 (square root of 2) -
sqrt1_2
: 0.70710678118654752440 (square root of 1/2)
The following functions can be used, with parentheses:
-
ceil
andfloor
: the next highest or the previous highest integer -
log10
,log2
,log
-
sqrt
-
sin
,cos
,tan
,asin
,acos
,atan
-
abs
: absolute value -
step
: 0 if the argument is negative, 1 otherwise
The format field supports the following specifiers:
-
%d
for decimal integer -
%x
for hexadecimal integer -
%o
for octal integer -
%f
for decimal floating point
You can use usual flags, width and precision syntax.
If you use:
variable_string("prefix", "var", "10"); variable_string_from_math_expression("prefix", "sum", "2.0+3.0", "%d"); variable_string_from_math_expression("prefix", "product", "3*${prefix.var}", "%d");
The prefix.sum
string variable will contain 5
and prefix.product
will contain 30
.
- variable_prefix: The prefix of the variable name
- variable_name: The variable to define, the full name will be variable_prefix.variable_name
- expression: The mathematical expression to evaluate
- format: The format string to use
variable_string_from_math_expression_${variable_name}_{kept, repaired, not_ok, reached}
Ensure that a specific windows component is absent from the system.
Compatible with nodes running Rudder 4.1 or higher.
Ensure that a specific windows component is absent from the system.
- component: Windows component name
windows_component_absent_${component}_{kept, repaired, not_ok, reached}
Ensure that a specific windows component is present on the system.
Compatible with nodes running Rudder 4.1 or higher.
Ensure that a specific windows component is present on the system.
- component: Windows component name
windows_component_present_${component}_{kept, repaired, not_ok, reached}
Ensure that a specific windows hotfix is absent from the system.
Compatible with nodes running Rudder 4.1 or higher.
Ensure that a specific windows hotfix is absent from the system.
- hotfix: Windows hotfix name (ex: KB4033369)
windows_hotfix_absent_${hotfix}_{kept, repaired, not_ok, reached}
Ensure that a specific windows hotfix is present from the system.
Compatible with nodes running Rudder 4.1 or higher.
Ensure that a specific windows hotfix is present from the system.
- hotfix: Windows hotfix name (ex: KB4033369)
- package_path: Windows hotfix package absolute path, can be a .msu archive or a .cab file
windows_hotfix_present_${hotfix}_{kept, repaired, not_ok, reached}