work on manual
authorBen Pfaff <blp@cs.stanford.edu>
Tue, 6 May 2025 16:19:29 +0000 (09:19 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Tue, 6 May 2025 16:19:29 +0000 (09:19 -0700)
rust/doc/src/SUMMARY.md
rust/doc/src/language/expressions/functions/mathematical.md
rust/doc/src/language/expressions/functions/miscellaneous.md [new file with mode: 0644]
rust/doc/src/language/expressions/functions/missing-value.md [new file with mode: 0644]
rust/doc/src/language/expressions/functions/set-membership.md [new file with mode: 0644]
rust/doc/src/language/expressions/functions/statistical.md [new file with mode: 0644]
rust/doc/src/language/expressions/functions/string.md [new file with mode: 0644]
rust/doc/src/language/expressions/functions/time-and-date.md [new file with mode: 0644]
rust/doc/src/language/expressions/functions/trigonometric.md [new file with mode: 0644]

index 52ea354126b6f646beb1c301c0b1804114c2c3b0..dc84f1ee457af0fe855ccd807e5aeaad60d454a3 100644 (file)
   - [Logical Operators](language/expressions/logical.md)
   - [Relational Operators](language/expressions/relational.md)
   - [Functions](language/expressions/functions/index.md)
-    - [Mathemtical Functions](language/expressions/functions/mathematical.md)
+    - [Mathematical Functions](language/expressions/functions/mathematical.md)
+    - [Trigonometric Functions](language/expressions/functions/trigonometric.md)
+    - [Missing Value Functions](language/expressions/functions/missing-value.md)
+    - [Set Membership Functions](language/expressions/functions/set-membership.md)
+    - [Statistical Functions](language/expressions/functions/statistical.md)
+    - [String Functions](language/expressions/functions/string.md)
+    - [Time and Date Functions](language/expressions/functions/time-and-date.md)
+    - [Miscellaneous Functions](language/expressions/functions/miscellaneous.md)
 
 # Developer Documentation
 
index 596d852b615cc5c6171964f4b81d5c0c40e9646d..6181e8669e1c791e62579b9364e09a9d4ca07d14 100644 (file)
@@ -1,24 +1,53 @@
 # Mathematical Functions
 
-Advanced mathematical functions take numeric arguments and produce
-numeric results.
+Mathematical functions take numeric arguments and produce numeric
+results.
+
+* `ABS(X)`  
+  Results in the absolute value of `X`.
 
 * `EXP(EXPONENT)`  
-  Returns e (approximately 2.71828) raised to power `EXPONENT`.
+  Returns *e* (approximately 2.71828) raised to power `EXPONENT`.
 
 * `LG10(X)`  
   Takes the base-10 logarithm of `X`.  If `X` is not positive, the
   result is system-missing.
 
 * `LN(X)`  
-  Takes the base-e logarithm of `X`.  If `X` is not positive, the
+  Takes the base-*e* logarithm of `X`.  If `X` is not positive, the
   result is system-missing.
 
 * `LNGAMMA(X)`  
-  Yields the base-e logarithm of the complete gamma of `X`.  If `X` is
+  Yields the base-*e* logarithm of the complete gamma of `X`.  If `X` is
   a negative integer, the result is system-missing.
 
+* `MOD(A, B)`  
+  Returns the remainder (modulus) of `A` divided by `B`.  If `A` is 0,
+  then the result is 0, even if `B` is missing.  If `B` is 0, the
+  result is system-missing.
+
+* `MOD10(X)`  
+  Returns the remainder when `X` is divided by 10.  If `X` is
+  negative, `MOD10(X)` is negative or zero.
+
+* `RND(X [, MULT[, FUZZBITS]])`  
+  Rounds `X` and rounds it to a multiple of `MULT` (by default 1).
+  Halves are rounded away from zero, as are values that fall short of
+  halves by less than `FUZZBITS` of errors in the least-significant
+  bits of X.  If `FUZZBITS` is not specified then the default is taken
+  from `SET FUZZBITS` (*note SET FUZZBITS::), which is 6 unless
+  overridden.
+
 * `SQRT(X)`  
   Takes the square root of `X`.  If `X` is negative, the result is
   system-missing.
 
+* `TRUNC(X [, MULT[, FUZZBITS]])`  
+  Rounds `X` to a multiple of `MULT`, toward zero.  For the default
+  `MULT` of 1, this is equivalent to discarding the fractional part of
+  `X`.  Values that fall short of a multiple of `MULT` by less than
+  `FUZZBITS` of errors in the least-significant bits of `X` are
+  rounded away from zero.  If `FUZZBITS` is not specified then the
+  default is taken from `SET FUZZBITS` (*note SET FUZZBITS::), which
+  is 6 unless overridden.
+
diff --git a/rust/doc/src/language/expressions/functions/miscellaneous.md b/rust/doc/src/language/expressions/functions/miscellaneous.md
new file mode 100644 (file)
index 0000000..cac7c3b
--- /dev/null
@@ -0,0 +1,42 @@
+# Miscellaneous Functions
+
+* `LAG (VARIABLE[, N])`  
+  `VARIABLE` must be a numeric or string variable name.  `LAG` yields
+  the value of that variable for the case `N` before the current one.
+  Results in system-missing (for numeric variables) or blanks (for
+  string variables) for the first `N` cases.
+
+  `LAG` obtains values from the cases that become the new active
+  dataset after a procedure executes.  Thus, `LAG` will not return
+  values from cases dropped by transformations such as `SELECT IF`,
+  and transformations like `COMPUTE` that modify data will change the
+  values returned by `LAG`.  These are both the case whether these
+  transformations precede or follow the use of `LAG`.
+
+  If `LAG` is used before `TEMPORARY`, then the values it returns are
+  those in cases just before `TEMPORARY`.  `LAG` may not be used
+  after `TEMPORARY`.
+
+  If omitted, `N` defaults to 1.  Otherwise, `N` must be a small
+  positive constant integer.  There is no explicit limit, but use of a
+  large value will increase memory consumption.
+
+* `YRMODA (YEAR, MONTH, DAY)`  
+  YEAR is a year, either between 0 and 99 or at least 1582.  Unlike
+  other PSPP date functions, years between 0 and 99 always correspond
+  to 1900 through 1999.  `MONTH` is a month between 1 and 13.  `DAY`
+  is a day between 0 and 31.  A `DAY` of 0 refers to the last day of
+  the previous month, and a `MONTH` of 13 refers to the first month of
+  the next year.  `YEAR` must be in range.  `YEAR`, `MONTH`, and `DAY`
+  must all be integers.
+
+  `YRMODA` results in the number of days between 15 Oct 1582 and the
+  date specified, plus one.  The date passed to `YRMODA` must be on
+  or after 15 Oct 1582.  15 Oct 1582 has a value of 1.
+
+* `VALUELABEL (VARIABLE)`  
+  Returns a string matching the label associated with the current
+  value of `VARIABLE`.  If the current value of `VARIABLE` has no
+  associated label, then this function returns the empty string.
+  `VARIABLE` may be a numeric or string variable.
+
diff --git a/rust/doc/src/language/expressions/functions/missing-value.md b/rust/doc/src/language/expressions/functions/missing-value.md
new file mode 100644 (file)
index 0000000..613e895
--- /dev/null
@@ -0,0 +1,35 @@
+# Missing-Value Functions
+
+Missing-value functions take various numeric arguments and yield various
+types of results.  Except where otherwise stated below, the normal rules
+of evaluation apply within expression arguments to these functions.  In
+particular, user-missing values for numeric variables are converted to
+system-missing values.
+
+* `MISSING (EXPR)`  
+  When `EXPR` is simply the name of a numeric variable, returns 1 if
+  the variable has the system-missing value or if it is user-missing.
+  For any other value 0 is returned.  If `EXPR` is any other kind of
+  expression, the function returns 1 if the value is system-missing, 0
+  otherwise.
+
+* `NMISS(EXPR [, EXPR]...)`  
+  Each argument must be a numeric expression.  Returns the number of
+  system-missing values in the list, which may include variable ranges
+  using the `VAR1 TO VAR2` syntax.
+
+* `NVALID(EXPR [, EXPR]...)`  
+  Each argument must be a numeric expression.  Returns the number of
+  values in the list that are not system-missing.  The list may
+  include variable ranges using the `VAR1 TO VAR2` syntax.
+
+* `SYSMIS(EXPR)`  
+  Returns 1 if `EXPR` has the system-missing value, 0 otherwise.
+
+* `VALUE(VARIABLE)`  
+  `VALUE(VECTOR(INDEX))`  
+  Prevents the user-missing values of the variable or vector element
+  from being transformed into system-missing values, and always
+  results in its actual value, whether it is valid, user-missing, or
+  system-missing.
+
diff --git a/rust/doc/src/language/expressions/functions/set-membership.md b/rust/doc/src/language/expressions/functions/set-membership.md
new file mode 100644 (file)
index 0000000..1ba35a1
--- /dev/null
@@ -0,0 +1,24 @@
+# Set Membership Functions
+
+Set membership functions determine whether a value is a member of a set.
+They take a set of numeric arguments or a set of string arguments, and
+produce Boolean results.
+
+   String comparisons are performed according to the rules given in
+*note Relational Operators::.  User-missing string values are treated as
+valid values.
+
+* `ANY(VALUE, SET [, SET]...)`  
+  Returns true if `VALUE` is equal to any of the `SET` values, and false
+  otherwise.  For numeric arguments, returns system-missing if `VALUE`
+  is system-missing or if all the values in `SET` are system-missing.
+
+* `RANGE(VALUE, LOW, HIGH [, LOW, HIGH]...)`  
+  Returns true if `VALUE` is in any of the intervals bounded by `LOW`
+  and `HIGH`, inclusive, and false otherwise.  `LOW` and `HIGH` must
+  be given in pairs.  Returns system-missing if any `HIGH` is less
+  than its `LOW` or, for numeric arguments, if `VALUE` is system-missing
+  or if all the `LOW`-`HIGH` pairs contain one (or two) system-missing
+  values.  A pair does not match `VALUE` if either `LOW` or `HIGH` is
+  missing, even if `VALUE` equals the non-missing endpoint.
+
diff --git a/rust/doc/src/language/expressions/functions/statistical.md b/rust/doc/src/language/expressions/functions/statistical.md
new file mode 100644 (file)
index 0000000..4d1971b
--- /dev/null
@@ -0,0 +1,50 @@
+# Statistical Functions
+
+Statistical functions compute descriptive statistics on a list of
+values.  Some statistics can be computed on numeric or string values;
+other can only be computed on numeric values.  Their results have the
+same type as their arguments.  The current case's weighting factor
+(*note WEIGHT::) has no effect on statistical functions.
+
+   These functions' argument lists may include entire ranges of
+variables using the `VAR1 TO VAR2` syntax.
+
+   Unlike most functions, statistical functions can return non-missing
+values even when some of their arguments are missing.  Most
+statistical functions, by default, require only one non-missing value
+to have a non-missing return; `CFVAR`, `SD`, and `VARIANCE` require 2.
+These defaults can be increased (but not decreased) by appending a dot
+and the minimum number of valid arguments to the function name.  For
+example, `MEAN.3(X, Y, Z)` would only return non-missing if all of
+`X`, `Y`, and `Z` were valid.
+
+* `CFVAR(NUMBER, NUMBER[, ...])`  
+  Results in the coefficient of variation of the values of `NUMBER`.
+  (The coefficient of variation is the standard deviation divided by
+  the mean.)
+
+* `MAX(VALUE, VALUE[, ...])`  
+  Results in the value of the greatest `VALUE`.  The `VALUE`s may be
+  numeric or string.
+
+* `MEAN(NUMBER, NUMBER[, ...])`  
+  Results in the mean of the values of `NUMBER`.
+
+* `MEDIAN(NUMBER, NUMBER[, ...])`  
+  Results in the median of the values of `NUMBER`.  Given an even
+  number of nonmissing arguments, yields the mean of the two middle
+  values.
+
+* `MIN(NUMBER, NUMBER[, ...])`  
+  Results in the value of the least `VALUE`.  The `VALUE`s may be
+  numeric or string.
+
+* `SD(NUMBER, NUMBER[, ...])`  
+  Results in the standard deviation of the values of `NUMBER`.
+
+* `SUM(NUMBER, NUMBER[, ...])`  
+  Results in the sum of the values of `NUMBER`.
+
+* `VARIANCE(NUMBER, NUMBER[, ...])`  
+  Results in the variance of the values of `NUMBER`.
+
diff --git a/rust/doc/src/language/expressions/functions/string.md b/rust/doc/src/language/expressions/functions/string.md
new file mode 100644 (file)
index 0000000..24cb62e
--- /dev/null
@@ -0,0 +1,99 @@
+# String Functions
+
+String functions take various arguments and return various results.
+
+* `CONCAT(STRING, STRING[, ...])`  
+  Returns a string consisting of each `STRING` in sequence.
+  `CONCAT("abc", "def", "ghi")` has a value of `"abcdefghi"`.  The
+  resultant string is truncated to a maximum of 32767 bytes.
+
+* `INDEX(HAYSTACK, NEEDLE)`  
+  `RINDEX(HAYSTACK, NEEDLE)`  
+  Returns a positive integer indicating the position of the first
+  (for `INDEX`) or last (for `RINDEX`) occurrence of `NEEDLE` in
+  HAYSTACK.  Returns 0 if HAYSTACK does not contain `NEEDLE`.  Returns
+  1 if `NEEDLE` is the empty string.
+
+* `INDEX(HAYSTACK, NEEDLES, NEEDLE_LEN)`  
+  `RINDEX(HAYSTACK, NEEDLE, NEEDLE_LEN)`  
+  Divides `NEEDLES` into multiple needles, each with length
+  `NEEDLE_LEN`, which must be a positive integer that evenly divides
+  the length of `NEEDLES`.  Searches `HAYSTACK` for the occurrences of
+  each needle and returns a positive integer indicating the byte index
+  of the beginning of the first (for `INDEX`) or last (for `RINDEX`)
+  needle it finds.  Returns 0 if `HAYSTACK` does not contain any of
+  the needles, or if `NEEDLES` is the empty string.
+
+* `LENGTH(STRING)`  
+  Returns the number of bytes in `STRING`.
+
+* `LOWER(STRING)`  
+  Returns a string identical to `STRING` except that all uppercase
+  letters are changed to lowercase letters.  The definitions of
+  "uppercase" and "lowercase" are encoding-dependent.
+
+* `LPAD(STRING, LENGTH[, PADDING])`  
+  `RPAD(STRING, LENGTH[, PADDING])`  
+  If `STRING` is at least `LENGTH` bytes long, these functions return
+  `STRING` unchanged.  Otherwise, they return `STRING` padded with
+  `PADDING` on the left side (for `LPAD`) or right side (for `RPAD`)
+  to `LENGTH` bytes.  These functions report an error and return
+  `STRING` unchanged if `LENGTH` is missing or bigger than 32767.
+
+  The `PADDING` argument must not be an empty string and defaults to a
+  space if not specified.  If its length does not evenly fit the
+  amount of space needed for padding, the returned string will be
+  shorter than `LENGTH`.
+
+* `LTRIM(STRING[, PADDING])`  
+  `RTRIM(STRING[, PADDING])`  
+  These functions return `STRING`, after removing leading (for `LTRIM`)
+  or trailing (for `RTRIM`) copies of `PADDING`.  If `PADDING` is
+  omitted, these functions remove spaces (but not tabs or other white
+  space).  These functions return `STRING` unchanged if `PADDING` is the
+  empty string.
+
+* `NUMBER(STRING, FORMAT)`  
+  Returns the number produced when `STRING` is interpreted according
+  to format specifier `FORMAT`.  If the format width `W` is less than
+  the length of `STRING`, then only the first `W` bytes in `STRING`
+  are used, e.g. `NUMBER("123", F3.0)` and `NUMBER("1234", F3.0)` both
+  have value 123.  If `W` is greater than `STRING`'s length, then it
+  is treated as if it were right-padded with spaces.  If `STRING` is
+  not in the correct format for `FORMAT`, system-missing is returned.
+
+* `REPLACE(HAYSTACK, NEEDLE, REPLACEMENT[, N])`  
+  Returns string `HAYSTACK` with instances of `NEEDLE` replaced by
+  `REPLACEMENT`.  If nonnegative integer `N` is specified, it limits
+  the maximum number of replacements; otherwise, all instances of
+  `NEEDLE` are replaced.
+
+* `STRING(NUMBER, FORMAT)`  
+  Returns a string corresponding to `NUMBER` in the format given by
+  format specifier `FORMAT`.  For example, `STRING(123.56, F5.1)` has
+  the value `"123.6"`.
+
+* `STRUNC(STRING, N)`  
+  Returns `STRING`, first trimming it to at most `N` bytes, then
+  removing trailing spaces (but not tabs or other white space).
+  Returns an empty string if `N` is zero or negative, or `STRING`
+  unchanged if `N` is missing.
+
+* `SUBSTR(STRING, START)`  
+  Returns a string consisting of the value of `STRING` from position
+  `START` onward.  Returns an empty string if `START` is system-missing,
+  less than 1, or greater than the length of `STRING`.
+
+* `SUBSTR(STRING, START, COUNT)`  
+  Returns a string consisting of the first `COUNT` bytes from `STRING`
+  beginning at position `START`.  Returns an empty string if `START`
+  or `COUNT` is system-missing, if `START` is less than 1 or greater
+  than the number of bytes in `STRING`, or if `COUNT` is less than 1.
+  Returns a string shorter than `COUNT` bytes if `START` + `COUNT` - 1
+  is greater than the number of bytes in `STRING`.  Examples:
+  `SUBSTR("abcdefg", 3, 2)` has value `"cd"`; `SUBSTR("nonsense", 4,
+  10)` has the value `"sense"`.
+
+* `UPCASE(STRING)`  
+  Returns `STRING`, changing lowercase letters to uppercase letters.
+
diff --git a/rust/doc/src/language/expressions/functions/time-and-date.md b/rust/doc/src/language/expressions/functions/time-and-date.md
new file mode 100644 (file)
index 0000000..6bf5ed8
--- /dev/null
@@ -0,0 +1,241 @@
+# Time and Date Functions
+
+For compatibility, PSPP considers dates before 15 Oct 1582 invalid.
+Most time and date functions will not accept earlier dates.
+
+## Time and Date Representations
+
+Times and dates are handled by PSPP as single numbers.  A "time" is an
+interval.  PSPP measures times in seconds.  Thus, the following
+intervals correspond with the numeric values given:
+
+|Interval                  |Numeric Value|
+|:-------------------------|----------:|
+|10 minutes                |        600|
+|1 hour                    |      3,600|
+|1 day, 3 hours, 10 seconds|     97,210|
+|40 days                   |  3,456,000|
+
+A "date", on the other hand, is a particular instant in the past or
+the future.  PSPP represents a date as a number of seconds since
+midnight preceding 14 Oct 1582.  Because midnight preceding the dates
+given below correspond with the numeric PSPP dates given:
+
+|Date             |   Numeric Value|
+|:----------------|---------------:|
+|15 Oct 1582      |          86,400|
+| 4 Jul 1776      |   6,113,318,400|
+| 1 Jan 1900      |  10,010,390,400|
+| 1 Oct 1978      |  12,495,427,200|
+|24 Aug 1995      |  13,028,601,600|
+
+## Constructing Times
+
+These functions take numeric arguments and return numeric values that
+represent times.
+
+* `TIME.DAYS (NDAYS)`  
+  Returns a time corresponding to NDAYS days.
+
+* `TIME.HMS (NHOURS, NMINS, NSECS)`  
+  Returns a time corresponding to NHOURS hours, NMINS minutes, and
+  NSECS seconds.  The arguments may not have mixed signs: if any of
+  them are positive, then none may be negative, and vice versa.
+
+## Examining Times
+
+These functions take numeric arguments in PSPP time format and give
+numeric results.
+
+* `CTIME.DAYS (TIME)`  
+  Results in the number of days and fractional days in TIME.
+
+* `CTIME.HOURS (TIME)`  
+  Results in the number of hours and fractional hours in TIME.
+
+* `CTIME.MINUTES (TIME)`  
+  Results in the number of minutes and fractional minutes in TIME.
+
+* `CTIME.SECONDS (TIME)`  
+  Results in the number of seconds and fractional seconds in TIME.
+  (`CTIME.SECONDS` does nothing; `CTIME.SECONDS(X)` is equivalent to
+  `X`.)
+
+## Constructing Dates
+
+These functions take numeric arguments and give numeric results that
+represent dates.  Arguments taken by these functions are:
+
+* `DAY`  
+  Refers to a day of the month between 1 and 31.  Day 0 is also
+  accepted and refers to the final day of the previous month.  Days
+  29, 30, and 31 are accepted even in months that have fewer days and
+  refer to a day near the beginning of the following month.
+
+* `MONTH`  
+  Refers to a month of the year between 1 and 12.  Months 0 and 13
+  are also accepted and refer to the last month of the preceding year
+  and the first month of the following year, respectively.
+
+* `QUARTER`  
+  Refers to a quarter of the year between 1 and 4.  The quarters of
+  the year begin on the first day of months 1, 4, 7, and 10.
+
+* `WEEK`  
+  Refers to a week of the year between 1 and 53.
+
+* `YDAY`  
+  Refers to a day of the year between 1 and 366.
+
+* `YEAR`  
+  Refers to a year, 1582 or greater.  Years between 0 and 99 are
+  treated according to the epoch set on SET EPOCH, by default
+  beginning 69 years before the current date (*note SET EPOCH::).
+
+If these functions' arguments are out-of-range, they are correctly
+normalized before conversion to date format.  Non-integers are rounded
+toward zero.
+
+* `DATE.DMY (DAY, MONTH, YEAR)`  
+  `DATE.MDY (MONTH, DAY, YEAR)`  
+  Results in a date value corresponding to the midnight before day
+  DAY of month MONTH of year YEAR.
+
+* `DATE.MOYR (MONTH, YEAR)`  
+  Results in a date value corresponding to the midnight before the
+  first day of month MONTH of year YEAR.
+
+* `DATE.QYR (QUARTER, YEAR)`  
+  Results in a date value corresponding to the midnight before the
+  first day of quarter QUARTER of year YEAR.
+
+* `DATE.WKYR (WEEK, YEAR)`  
+  Results in a date value corresponding to the midnight before the
+  first day of week WEEK of year YEAR.
+
+* `DATE.YRDAY (YEAR, YDAY)`  
+  Results in a date value corresponding to the day YDAY of year YEAR.
+
+## Examining Dates
+
+These functions take numeric arguments in PSPP date or time format and
+give numeric results.  These names are used for arguments:
+
+* `DATE`  
+  A numeric value in PSPP date format.
+
+* `TIME`  
+  A numeric value in PSPP time format.
+
+* `TIME-OR-DATE`  
+  A numeric value in PSPP time or date format.
+
+The functions for examining dates are:
+
+* `XDATE.DATE (TIME-OR-DATE)`  
+  For a time, results in the time corresponding to the number of
+  whole days DATE-OR-TIME includes.  For a date, results in the date
+  corresponding to the latest midnight at or before DATE-OR-TIME;
+  that is, gives the date that DATE-OR-TIME is in.
+
+* `XDATE.HOUR (TIME-OR-DATE)`  
+  For a time, results in the number of whole hours beyond the number
+  of whole days represented by DATE-OR-TIME.  For a date, results in
+  the hour (as an integer between 0 and 23) corresponding to
+  DATE-OR-TIME.
+
+* `XDATE.JDAY (DATE)`  
+  Results in the day of the year (as an integer between 1 and 366)
+  corresponding to DATE.
+
+* `XDATE.MDAY (DATE)`  
+  Results in the day of the month (as an integer between 1 and 31)
+  corresponding to DATE.
+
+* `XDATE.MINUTE (TIME-OR-DATE)`  
+  Results in the number of minutes (as an integer between 0 and 59)
+  after the last hour in TIME-OR-DATE.
+
+* `XDATE.MONTH (DATE)`  
+  Results in the month of the year (as an integer between 1 and 12)
+  corresponding to DATE.
+
+* `XDATE.QUARTER (DATE)`  
+  Results in the quarter of the year (as an integer between 1 and 4)
+  corresponding to DATE.
+
+* `XDATE.SECOND (TIME-OR-DATE)`  
+  Results in the number of whole seconds after the last whole minute
+  (as an integer between 0 and 59) in TIME-OR-DATE.
+
+* `XDATE.TDAY (DATE)`  
+  Results in the number of whole days from 14 Oct 1582 to DATE.
+
+* `XDATE.TIME (DATE)`  
+  Results in the time of day at the instant corresponding to DATE, as
+  a time value.  This is the number of seconds since midnight on the
+  day corresponding to DATE.
+
+* `XDATE.WEEK (DATE)`  
+  Results in the week of the year (as an integer between 1 and 53)
+  corresponding to DATE.
+
+* `XDATE.WKDAY (DATE)`  
+  Results in the day of week (as an integer between 1 and 7)
+  corresponding to DATE, where 1 represents Sunday.
+
+* `XDATE.YEAR (DATE)`  
+  Returns the year (as an integer 1582 or greater) corresponding to
+  DATE.
+
+## Time and Date Arithmetic
+
+Ordinary arithmetic operations on dates and times often produce sensible
+results.  Adding a time to, or subtracting one from, a date produces a
+new date that much earlier or later.  The difference of two dates yields
+the time between those dates.  Adding two times produces the combined
+time.  Multiplying a time by a scalar produces a time that many times
+longer.  Since times and dates are just numbers, the ordinary addition
+and subtraction operators are employed for these purposes.
+
+   Adding two dates does not produce a useful result.
+
+   Dates and times may have very large values.  Thus, it is not a good
+idea to take powers of these values; also, the accuracy of some
+procedures may be affected.  If necessary, convert times or dates in
+seconds to some other unit, like days or years, before performing
+analysis.
+
+   PSPP supplies a few functions for date arithmetic:
+
+* `DATEDIFF (DATE2, DATE1, UNIT)`  
+  Returns the span of time from `DATE1` to `DATE2` in terms of `UNIT`,
+  which must be a quoted string, one of `years`, `quarters`, `months`,
+  `weeks`, `days`, `hours`, `minutes`, and `seconds`.  The result is
+  an integer, truncated toward zero.
+
+  One year is considered to span from a given date to the same month,
+  day, and time of day the next year.  Thus, from January 1 of one
+  year to January 1 the next year is considered to be a full year, but
+  February 29 of a leap year to the following February 28 is not.
+  Similarly, one month spans from a given day of the month to the same
+  day of the following month.  Thus, there is never a full month from
+  Jan. 31 of a given year to any day in the following February.
+
+* `DATESUM (DATE, QUANTITY, UNIT[, METHOD])`  
+  Returns `DATE` advanced by the given `QUANTITY` of the specified
+  `UNIT`, which must be one of the strings `years`, `quarters`,
+  `months`, `weeks`, `days`, `hours`, `minutes`, and `seconds`.
+
+  When `UNIT` is `years`, `quarters`, or `months`, only the integer
+  part of `QUANTITY` is considered.  Adding one of these units can
+  cause the day of the month to exceed the number of days in the
+  month.  In this case, the `METHOD` comes into play: if it is omitted
+  or specified as `closest` (as a quoted string), then the resulting
+  day is the last day of the month; otherwise, if it is specified as
+  `rollover`, then the extra days roll over into the following month.
+
+  When `UNIT` is `weeks`, `days`, `hours`, `minutes`, or `seconds`,
+  the `QUANTITY` is not rounded to an integer and `METHOD`, if
+  specified, is ignored.
+
diff --git a/rust/doc/src/language/expressions/functions/trigonometric.md b/rust/doc/src/language/expressions/functions/trigonometric.md
new file mode 100644 (file)
index 0000000..a2b4666
--- /dev/null
@@ -0,0 +1,31 @@
+# Trigonometric Functions
+
+Trigonometric functions take numeric arguments and produce numeric
+results.
+
+* `ARCOS(X)`  
+  `ACOS(X)`  
+  Takes the arccosine, in radians, of `X`.  Results in
+  system-missing if `X` is not between -1 and 1 inclusive.  This
+  function is a PSPP extension.
+
+* `ARSIN(X)`  
+  `ASIN(X)`  
+  Takes the arcsine, in radians, of `X`.  Results in
+  system-missing if `X` is not between -1 and 1 inclusive.
+
+* `ARTAN(X)`  
+  `ATAN(X)`  
+  Takes the arctangent, in radians, of `X`.
+
+* `COS(ANGLE)`  
+  Takes the cosine of `ANGLE` which should be in radians.
+
+* `SIN(ANGLE)`  
+  Takes the sine of `ANGLE` which should be in radians.
+
+* `TAN(ANGLE)`  
+  Takes the tangent of `ANGLE` which should be in radians.  Results in
+  system-missing at values of ANGLE that are too close to odd
+  multiples of π/2.
+