<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/ExpressibleByFloatLiteral",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:s25ExpressibleByFloatLiteralP"
  },
  "title" : "ExpressibleByFloatLiteral"
}
-->

# ExpressibleByFloatLiteral

A type that can be initialized with a floating-point literal.

```
protocol ExpressibleByFloatLiteral
```

## Overview

The standard library floating-point types—`Float`, `Double`, and
`Float80` where available—all conform to the `ExpressibleByFloatLiteral`
protocol. You can initialize a variable or constant of any of these types
by assigning a floating-point literal.

```
// Type inferred as 'Double'
let threshold = 6.0

// An array of 'Double'
let measurements = [2.2, 4.1, 3.65, 4.2, 9.1]
```

# Conforming to ExpressibleByFloatLiteral

To add `ExpressibleByFloatLiteral` conformance to your custom type,
implement the required initializer.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)