<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 18.0.0 -",
    "visionOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLCompileOptions/mathMode",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(cs)MTLCompileOptions(py)mathMode"
  },
  "title" : "mathMode"
}
-->

# mathMode

An indication of whether the compiler can perform optimizations for floating-point arithmetic that may violate the IEEE 754 standard.

```
var mathMode: MTLMathMode { get set }
```

## Discussion

This property replaces the [`fastMathEnabled`](/documentation/Metal/MTLCompileOptions/fastMathEnabled) property.

If [`fastMathEnabled`](/documentation/Metal/MTLCompileOptions/fastMathEnabled) is `true`, the system sets [`mathMode`](/documentation/Metal/MTLCompileOptions/mathMode) to [`MTLMathMode.fast`](/documentation/Metal/MTLMathMode/fast) and [`mathFloatingPointFunctions`](/documentation/Metal/MTLCompileOptions/mathFloatingPointFunctions) to [`MTLMathFloatingPointFunctions.fast`](/documentation/Metal/MTLMathFloatingPointFunctions/fast).

If [`fastMathEnabled`](/documentation/Metal/MTLCompileOptions/fastMathEnabled) is `false`, the system sets [`mathMode`](/documentation/Metal/MTLCompileOptions/mathMode) to [`MTLMathMode.safe`](/documentation/Metal/MTLMathMode/safe) and [`mathFloatingPointFunctions`](/documentation/Metal/MTLCompileOptions/mathFloatingPointFunctions) to [`MTLMathFloatingPointFunctions.precise`](/documentation/Metal/MTLMathFloatingPointFunctions/precise).

Subsequent calls to [`mathMode`](/documentation/Metal/MTLCompileOptions/mathMode) or [`mathFloatingPointFunctions`](/documentation/Metal/MTLCompileOptions/mathFloatingPointFunctions) set the variables directly.

## Topics

### Supporting types

[`MTLMathMode`](/documentation/Metal/MTLMathMode)

An indication of whether the compiler can perform optimizations for floating-point arithmetic that may violate the IEEE 754 standard.



---

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)