From f1225ef7dd864de09cd4bab7ae50a511da04d6f0 Mon Sep 17 00:00:00 2001 From: PureFox48 <64583745+PureFox48@users.noreply.github.com> Date: Sun, 31 Jan 2021 05:21:59 +0000 Subject: [PATCH] Add docs for remaining bitwise operators (#887) I mentioned in #881 that the `^`, `<<` and `>>' bitwise operators were currently undocumented so this fixes that. Have also added a note to Num.tau to clarify that this means `twice pi `and is not the golden ratio for which `tau` is sometimes used as an alternative to `phi`. --- doc/site/modules/core/num.markdown | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/doc/site/modules/core/num.markdown b/doc/site/modules/core/num.markdown index 51858d3f..095f6ded 100644 --- a/doc/site/modules/core/num.markdown +++ b/doc/site/modules/core/num.markdown @@ -25,7 +25,7 @@ The value of π. ### Num.**tau** -The value of τ. +The value of τ. This is equivalent to ```2 * Num.pi```. ### Num.**largest** @@ -241,6 +241,24 @@ unsigned values. The result is then a 32-bit unsigned number where each bit is It is a runtime error if `other` is not a number. +### **^**(other) operator + +Performs bitwise exclusive or on the number. Both numbers are first converted to 32-bit unsigned values. The result is then a 32-bit unsigned number where each bit is `true` only where the corresponding bits of one (but not both) inputs were `true`. Each bit is therefore `false` if the corresponding bits of both inputs were either both `true` or both `false`. + +It is a runtime error if `other` is not a number. + +### **<<**(other) operator + +Performs a bitwise left shift on the number. Internally, both numbers are first converted to 32-bit unsigned values and C's left shift operator is then applied to them. + +It is a runtime error if `other` is not a number. + +### **>>**(other) operator + +Performs a bitwise right shift on the number. Internally, both numbers are first converted to 32-bit unsigned values and C's right shift operator is then applied to them. + +It is a runtime error if `other` is not a number. + ### **..**(other) operator Creates a [Range](range.html) representing a consecutive range of numbers