apple / apple/swift-atomics

Implement atomic floats

Open
#2 0 comments 4 reactions 0 assignees View on GitHub
enhancement
Dominant language
Swift
Stars
1.2k
Forks
63
PR merge metrics
No merged PRs in 30d

Description

Implement `AtomicValue` conformances for `Float`, `Double` and `Float16`. Requirements/constraints:

- `compareExchange` must compare the underlying encoded bit patterns rather than performing actual floating point comparisons. (I.e., it must consider negative zero different from positive zero, it must consider a NaN value equal to itself, etc.)
- We should provide as many direct operations as llvm/clang exposes. It would be nice to at least provide an atomic addition.
- We probably don't need/want an `AtomicFloatingPoint` protocol.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the existing AtomicValue conformances and the atomic floating-point operations exposed by llvm/clang. Implement conformances for Float, Double, and Float16, ensuring compareExchange uses encoded bit patterns and adding direct operations where supported. Done means the required behavior and operations are covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.