#integer-arithmetic #arithmetic #tan #sin #cos

erydanos

Optimized routines for ARM NEON and SSE

19 releases

0.2.16 Oct 11, 2024
0.2.15 Sep 24, 2024
0.2.14 Aug 19, 2024
0.2.11 Jul 31, 2024
0.1.1 Jul 10, 2024

#382 in Math

Download history 104/week @ 2024-08-21 28/week @ 2024-08-28 30/week @ 2024-09-04 109/week @ 2024-09-11 363/week @ 2024-09-18 293/week @ 2024-09-25 154/week @ 2024-10-02 408/week @ 2024-10-09 243/week @ 2024-10-16 178/week @ 2024-10-23 161/week @ 2024-10-30 182/week @ 2024-11-06 135/week @ 2024-11-13 82/week @ 2024-11-20 78/week @ 2024-11-27 88/week @ 2024-12-04

390 downloads per month
Used in 6 crates (2 directly)

Apache-2.0 OR BSD-3-Clause

450KB
11K SLoC

Math utilities for NEON, SSE, AVX and scalar implementation

Contains basic math routines for scalar implementations and NEON simd and SSE and AVX routines. Everything implemented in single precision and double precision. Almost all routines have ULP under 1.5 that is absolutely enough for media processing application (for some media application it can be too high). All methods reasonable fast for general purpose use. Performance comparable to libm, sometimes faster, sometimes slower, but may be worse than CPU integrated solutions. Have complementary NEON (double, double) type, and uint128. Adds 64 bits integer arithmetics for SSE.

Implemented routines:

  • abs
  • acos
  • asin
  • atan
  • atan2
  • cbrt
  • floor
  • exp
  • fmod
  • ln
  • hypot
  • pow
  • sin
  • cos
  • tan
  • sqrt
  • ceil
  • hypot3
  • hypot4

Example

let value = 0.1f32.esin();

// For NEON simd
let value = vsinq_f32(vdupq_n_f32(0.1f32));

Performance against libm

Sine Erydanos time: [17.785 ns 17.884 ns 18.095 ns]
Sine libm time: [27.928 ns 28.595 ns 29.398 ns]

Tan Erydanos time: [27.593 ns 27.607 ns 27.621 ns]
Tan libm time: [28.854 ns 29.165 ns 29.467 ns]

Cbrt Erydanos time: [23.260 ns 23.452 ns 23.650 ns]
Cbrt Erydanos time: [23.260 ns 23.452 ns 23.650 ns]

Pow Erydanos time: [66.930 ns 67.465 ns 68.025 ns]
Pow libm time: [170.74 ns 172.71 ns 174.67 ns]

Asin Erydanos time: [23.730 ns 23.953 ns 24.156 ns]
Asin libm time: [349.02 ns 350.39 ns 352.24 ns]

Atan Erydanos time: [20.882 ns 21.115 ns 21.347 ns]
Atan libm time: [20.128 ns 20.309 ns 20.494 ns]

Dependencies