I want to write a function that performs a floating-point calculation with a specified rounding mode. For example, a call-site might look like this:

```
let x = Float.withRoundingMode(.roundDown) {
// Some floating-point calculation
}
```

The implementation would be along the lines of:

```
extension Float {
enum RoundingMode {
case nearestTiesToEven, nearestTiesAwayFromZero, roundUp, roundDown, towardZero
}
static func withRoundingMode(_ roundingMode: RoundingMode, calculate: ()->Float) -> Float {
// Store the current rounding mode
// Set the rounding mode
let result = calculate()
// Restore the original rounding mode
return result
}
}
```

However, I don’t know how to access and modify the floating-point rounding mode in Swift. Is there a way to do this?