1<?xml version="1.0" encoding="UTF-8"?> 2 3<!--*********************************************************** 4 * 5 * Licensed to the Apache Software Foundation (ASF) under one 6 * or more contributor license agreements. See the NOTICE file 7 * distributed with this work for additional information 8 * regarding copyright ownership. The ASF licenses this file 9 * to you under the Apache License, Version 2.0 (the 10 * "License"); you may not use this file except in compliance 11 * with the License. You may obtain a copy of the License at 12 * 13 * http://www.apache.org/licenses/LICENSE-2.0 14 * 15 * Unless required by applicable law or agreed to in writing, 16 * software distributed under the License is distributed on an 17 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 18 * KIND, either express or implied. See the License for the 19 * specific language governing permissions and limitations 20 * under the License. 21 * 22 ***********************************************************--> 23 24<helpdocument version="1.0"> 25<meta> 26<topic id="textscalc01func_bitrshiftxml" indexer="include" status="PUBLISH"> 27<title id="tit" xml-lang="en-US">BITRSHIFT</title> 28<filename>/text/scalc/01/func_bitrshift.xhp</filename> 29</topic> 30</meta> 31<body> 32<bookmark xml-lang="en-US" branch="index" id="bm_id3160601"> 33<bookmark_value>BITRSHIFT function</bookmark_value> 34<bookmark_value>bitwise right shift</bookmark_value> 35</bookmark> 36<bookmark xml-lang="en-US" branch="hid/SC_HID_FUNC_BITRSHIFT" id="bm_id3160602" localize="false"/> 37<paragraph role="heading" id="hd_id3160601" xml-lang="en-US" level="2" l10n="U"><variable id="bitrshift"><link href="text/scalc/01/func_bitrshift.xhp">BITRSHIFT</link> 38</variable></paragraph> 39<paragraph role="paragraph" id="par_id3160603" xml-lang="en-US" l10n="U"><ahelp hid="HID_FUNC_BITRSHIFT">Bitwise right shift of an integer value.</ahelp> The bits of <emph>Number</emph> are shifted to the right by <emph>Shift</emph> positions, equivalent to dividing by 2 raised to the power of <emph>Shift</emph>.</paragraph> 40<paragraph role="heading" id="hd_id3160604" xml-lang="en-US" level="3" l10n="U">Syntax</paragraph> 41<paragraph role="code" id="par_id3160605" xml-lang="en-US" l10n="U">BITRSHIFT(Number; Shift)</paragraph> 42<paragraph role="paragraph" id="par_id3160606" xml-lang="en-US" l10n="U"><emph>Number</emph> is the integer value to be shifted. It must be greater than or equal to 0 and less than 2^48 (281474976710656).</paragraph> 43<paragraph role="paragraph" id="par_id3160607" xml-lang="en-US" l10n="U"><emph>Shift</emph> is the number of bit positions to shift. A positive value shifts right; a negative value shifts left (the direction is reversed).</paragraph> 44<paragraph role="heading" id="hd_id3160608" xml-lang="en-US" level="3" l10n="U">Remarks</paragraph> 45<paragraph role="paragraph" id="par_id3160609" xml-lang="en-US" l10n="U">If <emph>Shift</emph> is 0, <emph>Number</emph> is returned unchanged.</paragraph> 46<paragraph role="paragraph" id="par_id3160610" xml-lang="en-US" l10n="U">If <emph>Shift</emph> is greater than or equal to 64 (or less than or equal to -64), the result is 0.</paragraph> 47<paragraph role="paragraph" id="par_id3160611" xml-lang="en-US" l10n="U"><emph>Number</emph> and <emph>Shift</emph> are rounded down to integers before the operation. A <emph>Number</emph> that is negative after rounding down, greater than 2^48 - 1, or not finite returns an error (Err:502), as does a <emph>Shift</emph> that is not finite.</paragraph> 48<paragraph role="paragraph" id="par_id3160612" xml-lang="en-US" l10n="U">Example: decimal 8 is binary <quote>1000</quote>. BITRSHIFT(8; 2) shifts right by 2, giving binary <quote>10</quote>, which is decimal 2.</paragraph> 49<paragraph role="heading" id="hd_id3160613" xml-lang="en-US" level="3" l10n="U">Example</paragraph> 50<paragraph role="paragraph" id="par_id3160614" xml-lang="en-US" l10n="U"><item type="input">=BITRSHIFT(8; 2)</item> returns 2.</paragraph> 51<paragraph role="paragraph" id="par_id3160615" xml-lang="en-US" l10n="U"><item type="input">=BITRSHIFT(1; -2)</item> returns 4 because a negative shift reverses direction and shifts left by 2.</paragraph> 52<embed href="text/shared/00/00000001.xhp#siehe"/> 53<paragraph role="paragraph" id="par_id3160616" xml-lang="en-US" l10n="U"><link href="text/scalc/01/func_bitlshift.xhp" name="BITLSHIFT">BITLSHIFT</link>.</paragraph> 54</body> 55</helpdocument> 56