Math.ClearBit
-------------

Clears a bit in a 64-bit number.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Math](component_Math.md) | [15.3](newinversion153.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "Math.ClearBit"; Value; Bit ) 

**MBS**( **"Math.ClearBit";** /\* Clears a bit in a 64-bit number. \*/  
**$Value**; /\* The current value.e.g. 0 \*/   
**$Bit**) /\* The bit number to set.  
From 0 to 63.e.g. 0 \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| Value | The current value. | 0 |
| Bit | The bit number to set.   From 0 to 63. | 0 |

### Result

Returns OK or error.

### Description

Clears a bit in a 64-bit number.  
### Examples

Clear 1st bit, which removes 1 from 5:

 MBS ( "Math.ClearBit"; 5; 0 )  
<small>  
Example result: 4</small>Clear 2nd bit, which does nothing here:

 MBS ( "Math.ClearBit"; 5; 1 )  
<small>  
Example result: 5</small>Clear 3rd bit, which removes 4:

 MBS ( "Math.ClearBit"; 5; 2 )  
<small>  
Example result: 1</small>Try function:

 Let(\[  
  
v1 = 16;  
r = MBS ("[Math.GetBit](MathGetBit.md)"; v1; 4);  
v2 = MBS ("[Math.SetBit](MathSetBit.md)"; v1; 5);  
v3 = MBS ("Math.ClearBit"; v2; 5)  
  
\];   
"Value before: " &amp; v1 &amp; ¶ &amp;   
"Bit 4 is set? " &amp; r &amp; ¶ &amp;   
"Value with bit 5 set: " &amp; v2 &amp; ¶ &amp;   
"Value with bit 5 cleared: " &amp; v3)  
<small>  
Example result:   
Value before: 16  
Bit 4 is set? 1  
Value with bit 5 set: 48  
Value with bit 5 cleared: 16</small>### See also

- [Math.GetBit](MathGetBit.md)
- [Math.SetBit](MathSetBit.md)

### Release notes

- **Version 15.3**
    - Added [Math.SetBit](https://www.mbsplugins.eu/MathSetBit.shtml), [Math.ClearBit](https://www.mbsplugins.eu/MathClearBit.shtml) and [Math.GetBit](https://www.mbsplugins.eu/MathGetBit.shtml) functions.

### Blog Entries

- [MBS FileMaker Plugin 15.3 News](https://www.mbsplugins.de/archive/2025-07-29/MBS_FileMaker_Plugin_153_News/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 15.3pr1](https://www.mbsplugins.de/archive/2025-06-01/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)

This function is free to use.

Created 21st May 2025 , last changed 29th June 2025

  
[Math.BitwiseXOR](MathBitwiseXOR.md) - [Math.DecToHex](MathDecToHex.md)

[HTML Version](MathClearBit.shtml)