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_bitlshiftxml" indexer="include" status="PUBLISH"> 27<title id="tit" xml-lang="en-US">BITLSHIFT</title> 28<filename>/text/scalc/01/func_bitlshift.xhp</filename> 29</topic> 30</meta> 31<body> 32<bookmark xml-lang="en-US" branch="index" id="bm_id3160501"> 33<bookmark_value>BITLSHIFT function</bookmark_value> 34<bookmark_value>bitwise left shift</bookmark_value> 35</bookmark> 36<bookmark xml-lang="en-US" branch="hid/SC_HID_FUNC_BITLSHIFT" id="bm_id3160502" localize="false"/> 37<paragraph role="heading" id="hd_id3160501" xml-lang="en-US" level="2" l10n="U"><variable id="bitlshift"><link href="text/scalc/01/func_bitlshift.xhp">BITLSHIFT</link> 38</variable></paragraph> 39<paragraph role="paragraph" id="par_id3160503" xml-lang="en-US" l10n="U"><ahelp hid="HID_FUNC_BITLSHIFT">Bitwise left shift of an integer value.</ahelp> The bits of <emph>Number</emph> are shifted to the left by <emph>Shift</emph> positions, equivalent to multiplying by 2 raised to the power of <emph>Shift</emph>.</paragraph> 40<paragraph role="heading" id="hd_id3160504" xml-lang="en-US" level="3" l10n="U">Syntax</paragraph> 41<paragraph role="code" id="par_id3160505" xml-lang="en-US" l10n="U">BITLSHIFT(Number; Shift)</paragraph> 42<paragraph role="paragraph" id="par_id3160506" 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_id3160507" xml-lang="en-US" l10n="U"><emph>Shift</emph> is the number of bit positions to shift. A positive value shifts left; a negative value shifts right (the direction is reversed).</paragraph> 44<paragraph role="heading" id="hd_id3160508" xml-lang="en-US" level="3" l10n="U">Remarks</paragraph> 45<paragraph role="paragraph" id="par_id3160509" 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_id3160510" 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_id3160511" 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_id3160512" xml-lang="en-US" l10n="U">Example: decimal 1 is binary <quote>1</quote>. BITLSHIFT(1; 2) shifts left by 2, giving binary <quote>100</quote>, which is decimal 4.</paragraph> 49<paragraph role="heading" id="hd_id3160513" xml-lang="en-US" level="3" l10n="U">Example</paragraph> 50<paragraph role="paragraph" id="par_id3160514" xml-lang="en-US" l10n="U"><item type="input">=BITLSHIFT(1; 2)</item> returns 4.</paragraph> 51<paragraph role="paragraph" id="par_id3160515" xml-lang="en-US" l10n="U"><item type="input">=BITLSHIFT(1; -2)</item> returns 0 because a negative shift reverses direction and the value is shifted right, shifting the only bit out.</paragraph> 52<embed href="text/shared/00/00000001.xhp#siehe"/> 53<paragraph role="paragraph" id="par_id3160516" xml-lang="en-US" l10n="U"><link href="text/scalc/01/func_bitrshift.xhp" name="BITRSHIFT">BITRSHIFT</link>.</paragraph> 54</body> 55</helpdocument> 56