https://github.com/somerandomiosdev/half
Swift Half-Precision Floating Point
https://github.com/somerandomiosdev/half
carthage cocoapods hacktoberfest half-precision ios macos swift swiftpm tvos watchos
Last synced: 8 months ago
JSON representation
Swift Half-Precision Floating Point
- Host: GitHub
- URL: https://github.com/somerandomiosdev/half
- Owner: SomeRandomiOSDev
- License: mit
- Created: 2020-02-12T05:39:13.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2023-11-15T19:25:58.000Z (over 2 years ago)
- Last Synced: 2025-10-01T18:55:04.689Z (8 months ago)
- Topics: carthage, cocoapods, hacktoberfest, half-precision, ios, macos, swift, swiftpm, tvos, watchos
- Language: Swift
- Homepage:
- Size: 209 KB
- Stars: 12
- Watchers: 1
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Half
[](https://cocoapods.org/pods/Half)
[](https://cocoapods.org/pods/Half)
[](https://github.com/Carthage/Carthage)
[](https://cocoapods.org/pods/Half)

[](https://codecov.io/gh/SomeRandomiOSDev/Half)
[](https://github.com/SomeRandomiOSDev/Half/actions/workflows/carthage.yml)
[](https://github.com/SomeRandomiOSDev/Half/actions/workflows/cocoapods.yml)
[](https://github.com/SomeRandomiOSDev/Half/actions/workflows/documentation.yml)
[](https://github.com/SomeRandomiOSDev/Half/actions/workflows/swift-package.yml)
[](https://github.com/SomeRandomiOSDev/Half/actions/workflows/swiftlint.yml)
[](https://github.com/SomeRandomiOSDev/Half/actions/workflows/xcframework.yml)
[](https://github.com/SomeRandomiOSDev/Half/actions/workflows/xcodebuild.yml)
**Half** is a lightweight framework containing a Swift implementation for a half-precision floating point type for iOS, macOS, tvOS, and watchOS.
## Installation
**Half** is available through [CocoaPods](https://cocoapods.org), [Carthage](https://github.com/Carthage/Carthage) and the [Swift Package Manager](https://swift.org/package-manager/).
To install via CocoaPods, simply add the following line to your Podfile:
```ruby
pod 'Half'
```
To install via Carthage, simply add the following line to your Cartfile:
```ruby
github "SomeRandomiOSDev/Half"
```
To install via the Swift Package Manager add the following line to your `Package.swift` file's `dependencies`:
```swift
.package(url: "https://github.com/SomeRandomiOSDev/Half.git", from: "1.0.0")
```
## Usage
First import **Half** at the top of your Swift file:
```swift
import Half
```
After importing, use the imported `Half` type excatly like you'd use Swift's builtin `Float`, `Double`, or `Float80` types.
```swift
let value: Half = 7.891
let squareRoot = sqrt(value)
...
```
## NOTE
* [[SE-0277]](https://github.com/apple/swift-evolution/blob/master/proposals/0277-float16.md) added support for a native `Float16` type starting with Swift 5.3, therefore, this library is no longer recommended for projects using Swift 5.3 or later and this will likely be deprecated sometime in the future.
## Contributing
Whether it's submitting a feature request, reporting a bug, or writing code yourself, all contributions to this library are welcome! Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for more information on how you can contribute.
## Author
Joe Newton, somerandomiosdev@gmail.com
## License
**Half** is available under the MIT license. See the `LICENSE` file for more info.