summaryrefslogtreecommitdiff
path: root/lib.go
diff options
context:
space:
mode:
authorxuri <xuri.me@gmail.com>2021-11-09 00:10:09 +0800
committerxuri <xuri.me@gmail.com>2021-11-09 00:10:09 +0800
commita68bc34b0c60143bc649415fd7ff7acca70d6bdf (patch)
treee749f940f7d3a9995020f2c0e53fe56e22e8e3bf /lib.go
parent8f82d8b02909ca96a9c7f7c3431d1ae990c90191 (diff)
ref #65: new formula functions PERCENTRANK.EXC, PERCENTRANK.INC and PERCENTRANK
Diffstat (limited to 'lib.go')
-rw-r--r--lib.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib.go b/lib.go
index c8e957c..f592fbe 100644
--- a/lib.go
+++ b/lib.go
@@ -381,6 +381,17 @@ func inStrSlice(a []string, x string) int {
return -1
}
+// inFloat64Slice provides a method to check if an element is present in an
+// float64 array, and return the index of its location, otherwise return -1.
+func inFloat64Slice(a []float64, x float64) int {
+ for idx, n := range a {
+ if x == n {
+ return idx
+ }
+ }
+ return -1
+}
+
// boolPtr returns a pointer to a bool with the given value.
func boolPtr(b bool) *bool { return &b }