# modf

> Splits a float value into an integral part i and a fractional part that gets returned. Both parts take the sign of the input.

## Definition

* **Type:** Method
* **Namespace:** [Unity.Mathematics](/engine/6000.7/script-reference/unity/mathematics.md)
* **Assembly:** UnityEngine.MathematicsModule

## modf(float, float)

Splits a float value into an integral part i and a fractional part that gets returned. Both parts take the sign of the input.

```csharp
public static float modf(float x, out float i)
```

### Parameters

**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): Value to split into integral and fractional part.**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): Output value containing integral part of x.

### Returns

| Type                                                          | Description               |
| ------------------------------------------------------------- | ------------------------- |
| [float](https://learn.microsoft.com/dotnet/api/system.single) | The fractional part of x. |

## modf(float2, float2)

Performs a componentwise split of a float2 vector into an integral part i and a fractional part that gets returned. Both parts take the sign of the corresponding input component.

```csharp
public static float2 modf(float2 x, out float2 i)
```

### Parameters

**** (\[float2]\(/engine/6000.7/script-reference/unity/mathematics/float2)): Value to split into integral and fractional part.**** (\[float2]\(/engine/6000.7/script-reference/unity/mathematics/float2)): Output value containing integral part of x.

### Returns

| Type                                                                  | Description                             |
| --------------------------------------------------------------------- | --------------------------------------- |
| [float2](/engine/6000.7/script-reference/unity/mathematics/float2.md) | The componentwise fractional part of x. |

## modf(float3, float3)

Performs a componentwise split of a float3 vector into an integral part i and a fractional part that gets returned. Both parts take the sign of the corresponding input component.

```csharp
public static float3 modf(float3 x, out float3 i)
```

### Parameters

**** (\[float3]\(/engine/6000.7/script-reference/unity/mathematics/float3)): Value to split into integral and fractional part.**** (\[float3]\(/engine/6000.7/script-reference/unity/mathematics/float3)): Output value containing integral part of x.

### Returns

| Type                                                                  | Description                             |
| --------------------------------------------------------------------- | --------------------------------------- |
| [float3](/engine/6000.7/script-reference/unity/mathematics/float3.md) | The componentwise fractional part of x. |

## modf(float4, float4)

Performs a componentwise split of a float4 vector into an integral part i and a fractional part that gets returned. Both parts take the sign of the corresponding input component.

```csharp
public static float4 modf(float4 x, out float4 i)
```

### Parameters

**** (\[float4]\(/engine/6000.7/script-reference/unity/mathematics/float4)): Value to split into integral and fractional part.**** (\[float4]\(/engine/6000.7/script-reference/unity/mathematics/float4)): Output value containing integral part of x.

### Returns

| Type                                                                  | Description                             |
| --------------------------------------------------------------------- | --------------------------------------- |
| [float4](/engine/6000.7/script-reference/unity/mathematics/float4.md) | The componentwise fractional part of x. |

## modf(double, double)

Splits a double value into an integral part i and a fractional part that gets returned. Both parts take the sign of the input.

```csharp
public static double modf(double x, out double i)
```

### Parameters

**** (\[double]\(https\://learn.microsoft.com/dotnet/api/system.double)): Value to split into integral and fractional part.**** (\[double]\(https\://learn.microsoft.com/dotnet/api/system.double)): Output value containing integral part of x.

### Returns

| Type                                                           | Description               |
| -------------------------------------------------------------- | ------------------------- |
| [double](https://learn.microsoft.com/dotnet/api/system.double) | The fractional part of x. |

## modf(double2, double2)

Performs a componentwise split of a double2 vector into an integral part i and a fractional part that gets returned. Both parts take the sign of the corresponding input component.

```csharp
public static double2 modf(double2 x, out double2 i)
```

### Parameters

**** (\[double2]\(/engine/6000.7/script-reference/unity/mathematics/double2)): Value to split into integral and fractional part.**** (\[double2]\(/engine/6000.7/script-reference/unity/mathematics/double2)): Output value containing integral part of x.

### Returns

| Type                                                                    | Description                             |
| ----------------------------------------------------------------------- | --------------------------------------- |
| [double2](/engine/6000.7/script-reference/unity/mathematics/double2.md) | The componentwise fractional part of x. |

## modf(double3, double3)

Performs a componentwise split of a double3 vector into an integral part i and a fractional part that gets returned. Both parts take the sign of the corresponding input component.

```csharp
public static double3 modf(double3 x, out double3 i)
```

### Parameters

**** (\[double3]\(/engine/6000.7/script-reference/unity/mathematics/double3)): Value to split into integral and fractional part.**** (\[double3]\(/engine/6000.7/script-reference/unity/mathematics/double3)): Output value containing integral part of x.

### Returns

| Type                                                                    | Description                             |
| ----------------------------------------------------------------------- | --------------------------------------- |
| [double3](/engine/6000.7/script-reference/unity/mathematics/double3.md) | The componentwise fractional part of x. |

## modf(double4, double4)

Performs a componentwise split of a double4 vector into an integral part i and a fractional part that gets returned. Both parts take the sign of the corresponding input component.

```csharp
public static double4 modf(double4 x, out double4 i)
```

### Parameters

**** (\[double4]\(/engine/6000.7/script-reference/unity/mathematics/double4)): Value to split into integral and fractional part.**** (\[double4]\(/engine/6000.7/script-reference/unity/mathematics/double4)): Output value containing integral part of x.

### Returns

| Type                                                                    | Description                             |
| ----------------------------------------------------------------------- | --------------------------------------- |
| [double4](/engine/6000.7/script-reference/unity/mathematics/double4.md) | The componentwise fractional part of x. |
