Lines Matching +full:y +full:- +full:min
2 * Single-precision vector erf(x) function.
4 * Copyright (c) 2023-2024, Arm Limited.
5 * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception
14 float min, max, scale, shift, third; member
16 .min = 0x1.cp-7f, /* 1/64 - 1/512. */
17 .max = 3.9375, /* 4 - 8/128. */
20 .third = 0x1.555556p-2f, /* 1/3. */
25 /* Single-precision implementation of vector erf(x).
28 Let d = x - r, and scale = 2 / sqrt(pi) * exp(-r^2). For x near r,
30 erf(x) ~ erf(r) + scale * d * [1 - r * d - 1/3 * d^2]
33 For |x| < 0x1.cp-7, the algorithm sets r = 0, erf(r) = 0, and scale = 2 /
38 - [0, 0x1.cp-7]: 1.93 ULP
39 _ZGVsMxv_erff(0x1.c373e6p-9) got 0x1.fd686cp-9 want 0x1.fd6868p-9
40 - [0x1.cp-7, 4.0]: 1.26 ULP
41 _ZGVsMxv_erff(0x1.1d002ep+0) got 0x1.c4eb9ap-1 want 0x1.c4eb98p-1. */
46 /* |x| > 1/64 - 1/512. */ in SV_NAME_F1()
47 svbool_t a_gt_min = svacgt (pg, x, dat->min); in SV_NAME_F1()
49 /* |x| >= 4.0 - 8/128. */ in SV_NAME_F1()
50 svbool_t a_ge_max = svacge (pg, x, dat->max); in SV_NAME_F1()
53 svfloat32_t shift = sv_f32 (dat->shift); in SV_NAME_F1()
58 /* r and erf(r) set to 0 for |x| below min. */ in SV_NAME_F1()
63 /* scale set to 2/sqrt(pi) for |x| below min. */ in SV_NAME_F1()
66 scale = svsel (a_gt_min, scale, sv_f32 (dat->scale)); in SV_NAME_F1()
68 /* erf(x) ~ erf(r) + scale * d * (1 - r * d + 1/3 * d^2). */ in SV_NAME_F1()
71 svfloat32_t y = svmla_x (pg, r, d, dat->third); in SV_NAME_F1() local
72 y = svmla_x (pg, erfr, scale, svmls_x (pg, d, d2, y)); in SV_NAME_F1()
75 y = svsel (a_ge_max, sv_f32 (1.0f), y); in SV_NAME_F1()
79 svuint32_t iy = svreinterpret_u32 (y); in SV_NAME_F1()
84 TEST_SIG (SV, F, 1, erf, -4.0, 4.0)
87 TEST_SYM_INTERVAL (SV_NAME_F1 (erf), 0, 0x1.cp-7, 40000)
88 TEST_SYM_INTERVAL (SV_NAME_F1 (erf), 0x1.cp-7, 3.9375, 40000)