---
page_title: 'Plugin Development - Framework: Float32 Function Return'
description: >-
  Learn the float32 function return type in the provider development framework.
---

# Float32 Function Return

<Tip>

Use [Int32 Return](/terraform/plugin/framework/functions/returns/int32) for 32-bit integer numbers. Use [Number Return](/terraform/plugin/framework/functions/returns/number) for arbitrary precision numbers.

</Tip>

Float32 function return expects a 32-bit floating point number value from function logic. Set values in function logic with the Go built-in `float32` type, Go built-in `*float32` type, or the [framework float32 type](/terraform/plugin/framework/handling-data/types/float32).

## Function Definition

Use the [`function.Float32Return` type](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-framework/function#Float32Return) in the [function definition](/terraform/plugin/framework/functions/implementation#definition-method).

In this example, a function definition includes a float32 return:

```go
func (f ExampleFunction) Definition(ctx context.Context, req function.DefinitionRequest, resp *function.DefinitionResponse) {
    resp.Definition = function.Definition{
        // ... other Definition fields ...
        Return: function.Float32Return{
            // ... potentially other Float32Return fields ...
        },
    }
}
```

### Custom Types

You may want to build your own data value and type implementations to allow your provider to combine validation and other behaviors into a reusable bundle. This helps avoid duplication and ensures consistency. These implementations use the `CustomType` field in the return type.

Refer to [Custom Types](/terraform/plugin/framework/handling-data/types/custom) for further details on creating provider-defined types and values.

### Documentation

Return documentation is expected in the top-level function documentation. Refer to [function documentation](/terraform/plugin/framework/functions/documentation) for information about the `Summary`, `Description`, and `MarkdownDescription` fields available.

## Setting Return Data

The [function implementation](/terraform/plugin/framework/functions/implementation) documentation covers the general methods for setting function return data in function logic.

When setting the value for this return:

* If `CustomType` is set, use its associated value type.
* Otherwise, use the Go built-in `float32` type, Go built-in `*float32` type, or [framework float32 type](/terraform/plugin/framework/handling-data/types/float32).

In this example, a function defines a float32 return and sets its value:

```go
func (f ExampleFunction) Definition(ctx context.Context, req function.DefinitionRequest, resp *function.DefinitionResponse) {
    resp.Definition = function.Definition{
        // ... other Definition fields ...
        Return: function.Float32Return{},
    }
}

func (f ExampleFunction) Run(ctx context.Context, req function.RunRequest, resp *function.RunResponse) {
    // ... other logic ...

    // hardcoded value for example brevity
    var result float32 = 1.23

    resp.Error = function.ConcatFuncErrors(resp.Error, resp.Result.Set(ctx, &result))
}
```
