Skip to content

Range of xexpf to clamp to 0 and inf in scalar vs simd #667

@aconz2

Description

@aconz2

I noticed that the scalar and simd xexpf versions seem to use slightly different constants to clamp to 0 or inf. In scalar, it is -104 and 104, but simd uses -104 and 100. Is this intentional?

Scalar

sleef/src/libm/sleefsp.c

Lines 1174 to 1175 in 5533114

if (d < -104) u = 0;
if (d > 104) u = SLEEF_INFINITYf;

SIMD

sleef/src/libm/sleefsimdsp.c

Lines 2047 to 2048 in 5533114

u = vreinterpret_vf_vm(vandnot_vm_vo32_vm(vlt_vo_vf_vf(d, vcast_vf_f(-104)), vreinterpret_vm_vf(u)));
u = vsel_vf_vo_vf_vf(vlt_vo_vf_vf(vcast_vf_f(100), d), vcast_vf_f(SLEEF_INFINITYf), u);

It isn't really making a difference to me as I can guarantee the inputs will be inside that range, so mainly a curiosity question. Thanks for making this project, it is really nice.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions