dimforge / dimforge/nalgebra

Buggy behavior with simd_clamp: it regards all lanes collectively rather than independently

Open
#1,185 4 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
4.8k
Forks
565
PR merge metrics
No merged PRs in 30d

Description

```
dbg!(vector![0,2].simd_clamp(vector![-1,-1], vector![1,1]));
```

returns
```
vector![0, 2].simd_clamp(vector![- 1, - 1], vector![1, 1]) = [
[
0,
2,
],
]
```

I'd expect [0,1]

Similarly:
```
[src/main.rs:45] vector![- 2, 2].simd_clamp(vector![- 1, - 1], vector![1, 1]) = [
[
-2,
2,
],
]
```

I'd expect -1,1

It seems to only work if _all_ values exceed the clamping vector:
```
vector![2, 2].simd_clamp(vector![- 1, - 1], vector![1, 1]) = [
[
1,
1,
],
]
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.