---
title: float_divide
description: Divide an XFL by another XFL floating point number
---
import { Tabs, TabItem, LinkButton } from '@astrojs/starlight/components';

### Concepts

<LinkButton href="/docs/hooks/concepts/floating-point-numbers-xfl">Floating Point Numbers (XFL)</LinkButton>

### Behaviour

<Tabs>
<TabItem label="C">
* Divide an XFL by another XFL
* Return a new XFL as an int64_t
</TabItem>

<TabItem label="JavaScript">
* Divides one float representation by another.
* An error code or the quotient as a bigint.
</TabItem>
</Tabs>



### Definition

<Tabs>
<TabItem label="C">
```c
int64_t float_divide (
    int64_t float1,
    int64_t float2
);
```
</TabItem>

<TabItem label="JavaScript">
```javascript
 function float_divide(f1: bigint, f2: bigint): ErrorCode | bigint
```
</TabItem>
</Tabs>



### Example

<Tabs>
<TabItem label="C">
```c
int64_t still_one =
    float_divide(float_one(), float_one());
```
</TabItem>

<TabItem label="JavaScript">
```javascript
const still_one =
    float_divide(float_one(), float_one())
```
</TabItem>
</Tabs>



### Parameters

<Tabs>
<TabItem label="C">
| Name   | Type     | Description                                                  |
| ------ | -------- | ------------------------------------------------------------ |
| float1 | int64_t | An XFL floating point enclosing number to act as numerator   |
| float2 | int64_t | An XFL floating point enclosing number to act as denominator |
</TabItem>

<TabItem label="JavaScript">
| Name | Type   | Description         |
| ---- | ------ | ------------------- |
| f1   | bigint | The dividend float. |
| f2   | bigint | The divisor float.  |
</TabItem>
</Tabs>



### Return Code

<Tabs>
<TabItem label="C">
| Type     | Description                                                                                                                                                                                                                                                                                                    |
| -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| int64_t | <p>The XFL (xls17) enclosing number<br /><br />If negative, an error:<br /><code>INVALID_FLOAT</code><br />- the supplied parameter was not a valid XFL enclosing number or the division resulted in an XFL that cannot be represented.<br /><br /><code>DIVISION_BY_ZERO</code><br />- the supplied parameter was zero.</p> |
</TabItem>

<TabItem label="JavaScript">
| Type                | Description                                |
| ------------------- | ------------------------------------------ |
| bigint or ErrorCode | An error code or the quotient as a bigint. |
</TabItem>
</Tabs>

