// -*- c -*-
//
// PSPP - a program for statistical analysis.
-// Copyright (C) 2005, 2006, 2009, 2010, 2011, 2012, 2015 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2009, 2010, 2011, 2012, 2015, 2016 Free Software Foundation, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
function SIN (x) = sin (x);
function SQRT (x >= 0) = sqrt (x);
function TAN (x) = check_errno (tan (x));
-function TRUNC (x) = x >= 0. ? floor (x) : -floor (-x);
+function TRUNC (x) = round_zero (x, 1, 0);
+function TRUNC (x, mult != 0) = round_zero (x, mult, 0);
+function TRUNC (x, mult != 0, fuzzbits >= 0) = round_zero (x, mult, fuzzbits);
absorb_miss function MOD (n, d)
{
return mean;
}
+function MEDIAN.1 (a[n])
+{
+ return median (a, n);
+}
+
function MIN.1 (a[n])
{
double min;
}
}
-
function RINDEX (string haystack, string needle)
{
if (needle.length == 0)
function RINDEX (string haystack, string needles, needle_len_d)
{
- if (needle_len_d <= INT_MIN || needle_len_d >= INT_MAX
+ if (needle_len_d <= 0 || needle_len_d >= INT_MAX
|| (int) needle_len_d != needle_len_d
|| needles.length == 0)
return SYSMIS;
}
}
+string function REPLACE (string haystack, string needle, string replacement)
+ expression e;
+ = replace_string (e, haystack, needle, replacement, DBL_MAX);
+
+absorb_miss string function REPLACE (string haystack, string needle,
+ string replacement, n)
+ expression e;
+ = replace_string (e, haystack, needle, replacement, n);
+
absorb_miss string function RPAD (string s, n)
expression e;
{
return dst;
}
+absorb_miss string function STRUNC (string s, n)
+{
+ if (n < 1 || n == SYSMIS)
+ return empty_string;
+
+ if (n < s.length)
+ s.length = n;
+ while (s.length > 0 && s.string[s.length - 1] == ' ')
+ s.length--;
+ return s;
+}
+
absorb_miss string function SUBSTR (string s, ofs)
expression e;
{