<!--
{
  "availability" : [
    "iOS: 5.0.0 -",
    "iPadOS: 5.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.7.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/vvfmod(_:_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "c:@F@vvfmod"
  },
  "title" : "vvfmod(_:_:_:_:)"
}
-->

# vvfmod(_:_:_:_:)

Calculates the modulus after dividing each element in an array by the corresponding element in a second array of double-precision values.

```
func vvfmod(_: UnsafeMutablePointer<Double>, _: UnsafePointer<Double>, _: UnsafePointer<Double>, _: UnsafePointer<Int32>)
```

## Discussion

### Parameters:

- parameter 1: The output array, *z*.
- parameter 2: The numerators input array, *y*.
- parameter 3: The denominators input array, *x*.
- parameter 4: The number of elements in the arrays.

This function calculates *z=y-k*x*, for an integer k such that if x is nonzero, the result has the same sign as y and magnitude less than that of x.

The following code shows an example of using [`vvfmod(_:_:_:_:)`](/documentation/Accelerate/vvfmod(_:_:_:_:)):

```swift
var x: [Double] = [7, 4, 3, 4]
var y: [Double] = [2, 5, 10, 30]
var z = [Double](repeating: 0, count: x.count)
var n = Int32(x.count)
 
vvfmod(&z, &y, &x, &n)
 
print(z) // [2.0, 1.0, 1.0, 2.0]
```

---

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)