# Swift Numerics

**URL:** https://forums.swift.org/c/related-projects/swift-numerics/56.md

[Latest](https://forums.swift.org/latest.md) · [Categories](https://forums.swift.org/categories.md) · [Tags](https://forums.swift.org/tags.md)

---

## [About the Swift Numerics category](https://forums.swift.org/t/about-the-swift-numerics-category/30578)

<div class="topic-metadata">

**Author:** [@mishal\_shah](https://forums.swift.org/u/mishal_shah)\
**Replies:** 0

</div>

Swift Numerics provides a set of modules that support numerical computing in Swift.

---

## [Wrong component signs in Complex.cosh/sinh for large negative real parts](https://forums.swift.org/t/wrong-component-signs-in-complex-cosh-sinh-for-large-negative-real-parts/89383)

<div class="topic-metadata">

**Author:** [@KhamitKadirbekov](https://forums.swift.org/u/KhamitKadirbekov)\
**Replies:** 0\
**Last updated:** [September 5, 2026, 6:55am UTC](https://forums.swift.org/t/wrong-component-signs-in-complex-cosh-sinh-for-large-negative-real-parts/89383 "2026-09-05T06:55:42Z")

</div>

While independently testing Swift Numerics main at commit 899af71c0256d0ad181e3b7eb3453c1065d928a5, I found that the overflow-avoiding fast paths for Complex.cosh and Complex.sinh return the wrong sign for one component …

---

## [API proposal: fast difference-of-products](https://forums.swift.org/t/api-proposal-fast-difference-of-products/81884)

<div class="topic-metadata">

**Author:** [@scanon](https://forums.swift.org/u/scanon)\
**Replies:** 12\
**Last updated:** [February 27, 2026, 1:20am UTC](https://forums.swift.org/t/api-proposal-fast-difference-of-products/81884 "2026-02-27T01:20:57Z")

</div>

Motivation Expressions of the form a\*b - c\*d or a\*b + c\*d are extremely common and notorious sources of cancellation error in floating-point arithmetic. Some well-known examples include 2x2 matrix determinants and the d…

---

## [1.1 release thread](https://forums.swift.org/t/1-1-release-thread/81649)

<div class="topic-metadata">

**Author:** [@scanon](https://forums.swift.org/u/scanon)\
**Replies:** 3\
**Last updated:** [August 28, 2025, 7:56pm UTC](https://forums.swift.org/t/1-1-release-thread/81649 "2025-08-28T19:56:38Z")

</div>

Hi all – I’m preparing to tag the 1.1 release of numerics. This release branch introduces the following features and significant changes: Expanded documentation and docc catalogs for ComplexModule and RealModule “…

---

## [New Version VecLab 2.0 of Swift Real/Complex Vector DSP Library](https://forums.swift.org/t/new-version-veclab-2-0-of-swift-real-complex-vector-dsp-library/80477)

<div class="topic-metadata">

**Author:** [@marcuspainter](https://forums.swift.org/u/marcuspainter)\
**Replies:** 0\
**Last updated:** [June 16, 2025, 12:16am UTC](https://forums.swift.org/t/new-version-veclab-2-0-of-swift-real-complex-vector-dsp-library/80477 "2025-06-16T00:16:12Z")

</div>

Hello! I’ve updated my VecLab DSP package to follow more Swift-like conventions. The package uses Accelerate to provide real and complex vector operations. Here’s a quick summary of its features: Mixed scalar, vector, …

---

## [Calculate dot product using Real type from Numerics package](https://forums.swift.org/t/calculate-dot-product-using-real-type-from-numerics-package/76485)

<div class="topic-metadata">

**Author:** [@wigging](https://forums.swift.org/u/wigging)\
**Replies:** 8\
**Last updated:** [December 10, 2024, 9:04pm UTC](https://forums.swift.org/t/calculate-dot-product-using-real-type-from-numerics-package/76485 "2024-12-10T21:04:09Z")

</div>

I have a Vector struct that I use for linear algebra calculations where the generic values conform to the Real type provided by the Numerics package. The example shown below is a simplified version of the struct. I can …

---

## [\[API review\] trig-pi functions](https://forums.swift.org/t/api-review-trig-pi-functions/71931)

<div class="topic-metadata">

**Author:** [@scanon](https://forums.swift.org/u/scanon)\
**Replies:** 32\
**Last updated:** [May 21, 2024, 5:31pm UTC](https://forums.swift.org/t/api-review-trig-pi-functions/71931 "2024-05-21T17:31:14Z")

</div>

Hi all -- I've been dusting off some work from a few years ago on trig-pi functions for Numerics, and would appreciate any feedback you might have on these API to be added as requirements on the RealFunctions protocol: …

---

## [DecimalFloatingPoint Protocol Review](https://forums.swift.org/t/decimalfloatingpoint-protocol-review/65047)

<div class="topic-metadata">

**Author:** [@mgriebling](https://forums.swift.org/u/mgriebling)\
**Replies:** 22\
**Last updated:** [October 26, 2023, 10:01pm UTC](https://forums.swift.org/t/decimalfloatingpoint-protocol-review/65047 "2023-10-26T22:01:12Z")

</div>

In another post, @scanon outlined some basic requirements before we can define fixed-width Decimal numbers: There is now a newly updated DecimalFloatingPoint protocol incorporating all known comments to be reviewed by…

---

## [How do we access the transcendental functions (sin, log, etc) in Swift?](https://forums.swift.org/t/how-do-we-access-the-transcendental-functions-sin-log-etc-in-swift/67974)

<div class="topic-metadata">

**Author:** [@CTMacUser](https://forums.swift.org/u/CTMacUser)\
**Replies:** 1\
**Last updated:** [October 20, 2023, 7:33pm UTC](https://forums.swift.org/t/how-do-we-access-the-transcendental-functions-sin-log-etc-in-swift/67974 "2023-10-20T19:33:09Z")

</div>

Just checked the Standard Library pages, and functions like sine or natural logarithm aren’t provided. Now (most?) operating systems have implementations of those functions. What is the current way to access them? The Nu…

---

## [Linker error using swift-numerics and C module](https://forums.swift.org/t/linker-error-using-swift-numerics-and-c-module/67857)

<div class="topic-metadata">

**Author:** [@bbrk24](https://forums.swift.org/u/bbrk24)\
**Replies:** 7\
**Last updated:** [October 16, 2023, 6:44pm UTC](https://forums.swift.org/t/linker-error-using-swift-numerics-and-c-module/67857 "2023-10-16T18:44:18Z")

</div>

$ swift build Building for debugging... error: link command failed with exit code 1 (use -v to see invocation) .build/checkouts/swift-numerics/Sources/\_NumericsShims/include/\_NumericsShims.h:220: error: undefined referen…

---

## [Would it be possible to remove Clang dependencies from swift-numerics?](https://forums.swift.org/t/would-it-be-possible-to-remove-clang-dependencies-from-swift-numerics/67366)

<div class="topic-metadata">

**Author:** [@toph42](https://forums.swift.org/u/toph42)\
**Replies:** 4\
**Last updated:** [September 19, 2023, 6:20pm UTC](https://forums.swift.org/t/would-it-be-possible-to-remove-clang-dependencies-from-swift-numerics/67366 "2023-09-19T18:20:47Z")

</div>

Since Swift Playgrounds 4 on iPad won’t allow any package dependencies that have non-Swift code in them, I’m wondering how feasible it is to separate whatever C dependencies that the swift-numerics package currently has.…

---

## [Missing required module '\_NumericsShims'](https://forums.swift.org/t/missing-required-module-numericsshims/67155)

<div class="topic-metadata">

**Author:** [@warrennn](https://forums.swift.org/u/warrennn)\
**Replies:** 1\
**Last updated:** [September 8, 2023, 2:49am UTC](https://forums.swift.org/t/missing-required-module-numericsshims/67155 "2023-09-08T02:49:34Z")

</div>

Hello, this has been asked before, but my project seems to need NumericsShims" and it didn't seem to have been resolved in the earlier post. I installed the Numerics package and made it part of my target. My app runs onl…

---

## [Working on a general algebra library for Swift](https://forums.swift.org/t/working-on-a-general-algebra-library-for-swift/65944)

<div class="topic-metadata">

**Author:** [@SylvanM](https://forums.swift.org/u/SylvanM)\
**Replies:** 4\
**Last updated:** [July 1, 2023, 10:58pm UTC](https://forums.swift.org/t/working-on-a-general-algebra-library-for-swift/65944 "2023-07-01T22:58:13Z")

</div>

Hello! I've been working on a lot of projects having to do with general algebra in Swift dealing with groups, rings, fields, etc, as well as a library for fast matrix computations that allows for parametrization of any t…

---

## [\`BigInt\` status](https://forums.swift.org/t/bigint-status/65566)

<div class="topic-metadata">

**Author:** [@mgriebling](https://forums.swift.org/u/mgriebling)\
**Replies:** 6\
**Last updated:** [June 19, 2023, 1:14am UTC](https://forums.swift.org/t/bigint-status/65566 "2023-06-19T01:14:56Z")

</div>

Does anyone know when BigInt (in one of the subdirectories) would be released? As well is there a BigDecimal in the works somewhere. I'm aware of the GitHub project.

---

## [Decimal32, Decimal64, and Decimal128 Design Approach](https://forums.swift.org/t/decimal32-decimal64-and-decimal128-design-approach/65317)

<div class="topic-metadata">

**Author:** [@mgriebling](https://forums.swift.org/u/mgriebling)\
**Replies:** 21\
**Last updated:** [June 9, 2023, 7:52pm UTC](https://forums.swift.org/t/decimal32-decimal64-and-decimal128-design-approach/65317 "2023-06-09T19:52:04Z")

</div>

I've completed an initial design of the Decimal math module with Decimal32 being the first implementation. The design attempts to use generic algorithms so that additional types can be easily defined by specifying a few …

---

## [Multiplication by juxtaposition](https://forums.swift.org/t/multiplication-by-juxtaposition/64128)

<div class="topic-metadata">

**Author:** [@Nevin](https://forums.swift.org/u/Nevin)\
**Replies:** 5\
**Last updated:** [April 3, 2023, 9:03am UTC](https://forums.swift.org/t/multiplication-by-juxtaposition/64128 "2023-04-03T09:03:57Z")

</div>

Multiplication by juxtaposition Proposal: SN–NNNN Author: @Nevin Status: Ready to go Introduction We propose to allow multiplication to be written by juxtaposition, as in “n(n+1)”. Motivation One of the goals of the …

---

## [\[GSoC\] Fraction, MixedFraction, ContinuedFraction, and Percentage](https://forums.swift.org/t/gsoc-fraction-mixedfraction-continuedfraction-and-percentage/56801)

<div class="topic-metadata">

**Author:** [@alexandrehsaad](https://forums.swift.org/u/alexandrehsaad)\
**Replies:** 10\
**Last updated:** [July 27, 2022, 2:06am UTC](https://forums.swift.org/t/gsoc-fraction-mixedfraction-continuedfraction-and-percentage/56801 "2022-07-27T02:06:28Z")

</div>

Hi Everyone, I'm really excited to write my first post in the Swift forums :slightly\_smiling\_face: I'm very interested in participating in this year's GSoC, I've been contemplating to contribute to Swift for a long tim…

---

## [Is there a way to find the error in values like \`.log(2)\` and \`.pi / 3\`?](https://forums.swift.org/t/is-there-a-way-to-find-the-error-in-values-like-log-2-and-pi-3/56490)

<div class="topic-metadata">

**Author:** [@Nevin](https://forums.swift.org/u/Nevin)\
**Replies:** 4\
**Last updated:** [April 4, 2022, 4:33pm UTC](https://forums.swift.org/t/is-there-a-way-to-find-the-error-in-values-like-log-2-and-pi-3/56490 "2022-04-04T16:33:42Z")

</div>

Suppose I have a value x of some type T: Real, which is close to ln(2), and I want to know how far off it is. Calculating the difference y = x - .log(2) causes catastrophic cancelation, with only a few bits of precision …

---

## [Notes on GSoC Decimal arithmetic](https://forums.swift.org/t/notes-on-gsoc-decimal-arithmetic/46789)

<div class="topic-metadata">

**Author:** [@scanon](https://forums.swift.org/u/scanon)\
**Replies:** 8\
**Last updated:** [November 30, 2021, 8:11pm UTC](https://forums.swift.org/t/notes-on-gsoc-decimal-arithmetic/46789 "2021-11-30T20:11:46Z")

</div>

Hi all -- A few people have reached out about the Decimal64 GSoC project, so I thought I would write up one set of notes and have a single thread to answer any questions. This project is about implementing arithmetic a…

---

## [\[GSoC2021\] Decimal64 in Swift](https://forums.swift.org/t/gsoc2021-decimal64-in-swift/45763)

<div class="topic-metadata">

**Author:** [@briansun](https://forums.swift.org/u/briansun)\
**Replies:** 3\
**Last updated:** [March 21, 2021, 3:02pm UTC](https://forums.swift.org/t/gsoc2021-decimal64-in-swift/45763 "2021-03-21T15:02:15Z")

</div>

Hello everyone. My name is Song Zhi. I am a second-year Software Engineering student from Xi’an University of Post & Telecommunications, China. I have a strong curiosity to implement Decimal64 in Swift with @scanon aft…

---

## [Swift Numerics and integers](https://forums.swift.org/t/swift-numerics-and-integers/30866)

<div class="topic-metadata">

**Author:** [@Edward\_Connell](https://forums.swift.org/u/Edward_Connell)\
**Replies:** 8\
**Last updated:** [March 13, 2022, 8:02pm UTC](https://forums.swift.org/t/swift-numerics-and-integers/30866 "2022-03-13T20:02:58Z")

</div>

Hi, I was trying out the new Swift Numerics package. I wrote a generic function to add two numbers where lhs and rhs conformed to Real. In my case when adding integers, the compiler complains that Int32 and UInt8 do not …

---

## [DoubleWidth Use in Other Projects](https://forums.swift.org/t/doublewidth-use-in-other-projects/55064)

<div class="topic-metadata">

**Author:** [@crichez](https://forums.swift.org/u/crichez)\
**Replies:** 3\
**Last updated:** [February 3, 2022, 3:40pm UTC](https://forums.swift.org/t/doublewidth-use-in-other-projects/55064 "2022-02-03T15:40:41Z")

</div>

I've been building a series of FNV-1 hashers with different digest sizes. I used the DoubleWidth code in \_TestSupport to get unsigned integers more than 64 bits wide. Since it isn't part of the public API for Swift Numer…

---

## [Compiling with swift-numerics failed with error in ApproximateEquality.swift](https://forums.swift.org/t/compiling-with-swift-numerics-failed-with-error-in-approximateequality-swift/54512)

<div class="topic-metadata">

**Author:** [@AlanHoo1974](https://forums.swift.org/u/AlanHoo1974)\
**Replies:** 2\
**Last updated:** [January 10, 2022, 6:35pm UTC](https://forums.swift.org/t/compiling-with-swift-numerics-failed-with-error-in-approximateequality-swift/54512 "2022-01-10T18:35:57Z")

</div>

I import a library 'Chart' as project into my project and compile, the result is failed due to an error in dependency package 'swift-numerics'. The error indicates 'Type of expression is ambiguous without more context' …

---

## [Converting back to Double](https://forums.swift.org/t/converting-back-to-double/54127)

<div class="topic-metadata">

**Author:** [@yalishanda](https://forums.swift.org/u/yalishanda)\
**Replies:** 1\
**Last updated:** [December 17, 2021, 11:52pm UTC](https://forums.swift.org/t/converting-back-to-double/54127 "2021-12-17T23:52:17Z")

</div>

Is there a way to create a Double from an AlgebraicField or Real type? I have a use case where a have a function like func f\<X: AlgebraicField\>(\_ x: X, minimum a: X, peak b: X, maximum c: X) -\> Double { switch x { …

---

## [Does RealModule only support Float?](https://forums.swift.org/t/does-realmodule-only-support-float/53796)

<div class="topic-metadata">

**Author:** [@sxbsxb](https://forums.swift.org/u/sxbsxb)\
**Replies:** 7\
**Last updated:** [November 30, 2021, 10:41pm UTC](https://forums.swift.org/t/does-realmodule-only-support-float/53796 "2021-11-30T22:41:22Z")

</div>

I spent a long time in a swift playground trying to get answers for functions found in the Numerics package. Finally, I tried Float instead of Double and it worked. Is this expected or am I missing something import Sw…

---

## [Spelling of relaxed floating-point arithmetic operations](https://forums.swift.org/t/spelling-of-relaxed-floating-point-arithmetic-operations/53689)

<div class="topic-metadata">

**Author:** [@scanon](https://forums.swift.org/u/scanon)\
**Replies:** 15\
**Last updated:** [December 1, 2021, 1:55pm UTC](https://forums.swift.org/t/spelling-of-relaxed-floating-point-arithmetic-operations/53689 "2021-12-01T13:55:36Z")

</div>

Hi all-- I'm looking into adding "relaxed" floating-point operations in Swift Numerics to allow the compiler to loop-unroll and vectorize floating-point accumulations. See feature request and PR for more information. A…

---

## [1.0.0 Release Notes](https://forums.swift.org/t/1-0-0-release-notes/51641)

<div class="topic-metadata">

**Author:** [@scanon](https://forums.swift.org/u/scanon)\
**Replies:** 1\
**Last updated:** [August 31, 2021, 8:38pm UTC](https://forums.swift.org/t/1-0-0-release-notes/51641 "2021-08-31T20:38:12Z")

</div>

Welcome to the first stable release of Swift Numerics! Not much has changed from 0.1.0, except that I'm declaring the API of RealModule and ComplexModule to be stable. There is some expanded documentation for the recipr…

---

## [Vectors/Matrix in Swift Numerics](https://forums.swift.org/t/vectors-matrix-in-swift-numerics/51301)

<div class="topic-metadata">

**Author:** [@alexanderUV](https://forums.swift.org/u/alexanderUV)\
**Replies:** 14\
**Last updated:** [August 31, 2021, 8:33pm UTC](https://forums.swift.org/t/vectors-matrix-in-swift-numerics/51301 "2021-08-31T20:33:22Z")

</div>

This may have been asked before but I couldn't find anything on the topic. Is Vectors/Matrix (linear algebra) part of the roadmap for Swift Numerics? I've seen several implementations of Swift-only libraries which attem…

---

## [Numerics 1.0 release plans](https://forums.swift.org/t/numerics-1-0-release-plans/51311)

<div class="topic-metadata">

**Author:** [@scanon](https://forums.swift.org/u/scanon)\
**Replies:** 11\
**Last updated:** [August 24, 2021, 2:33pm UTC](https://forums.swift.org/t/numerics-1-0-release-plans/51311 "2021-08-24T14:33:48Z")

</div>

Hi all -- I am planning to tag Numerics 1.0.0 in the next couple weeks (and have created a release/1.0 branch from which it will be tagged). From that point forward, there will be a somewhat higher bar to any source-bre…

---

## [Floating-point shift operators](https://forums.swift.org/t/floating-point-shift-operators/51125)

<div class="topic-metadata">

**Author:** [@Nevin](https://forums.swift.org/u/Nevin)\
**Replies:** 25\
**Last updated:** [August 14, 2021, 2:28pm UTC](https://forums.swift.org/t/floating-point-shift-operators/51125 "2021-08-14T14:28:05Z")

</div>

I’ve been doing some floating-point programming and found that I often need to scale numbers by a power of 2. In other words, to change the exponent. If I were using integers this would be easy: let y = x \<\< n But tha…

[Next page](https://forums.swift.org/c/related-projects/swift-numerics/56.md?page=1)
