-
-
Notifications
You must be signed in to change notification settings - Fork 881
Commit 9f18e41
refactor!: modify C implementation to accept
This commit updates the signature of the C API to accept a float rather than int32. The rationale was so that users get the same results/behavior in both JavaScript and C. This arose in the context of ufuncs, where the diverging type signatures meant differences in what dtypes would be permissible. Instead, we decided to unify and ensure the behavior is consistent.
BREAKING CHANGE: update signature to accept floats
User code should behave similarly in the primary case of providing integer-valued input values. However, no longer will real-values truncate. Now, real-valued inputs will result in `NaN`, which is, arguably, better behavior, as real-to-integer truncation can be a source of silent bugs.
PR-URL: #8030
Co-authored-by: Athan Reines <kgryte@gmail.com>
Reviewed-by: Athan Reines <kgryte@gmail.com>float
instead of int32
in math/base/special/factorial2f
1 parent 862befd commit 9f18e41
File tree
8 files changed
+37
-41
lines changed- lib/node_modules/@stdlib/math/base/special/factorial2f
- benchmark/c/native
- examples/c
- include/stdlib/math/base/special
- lib
- src
8 files changed
+37
-41
lines changedLines changed: 5 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
136 | 136 |
| |
137 | 137 |
| |
138 | 138 |
| |
139 | - | ||
139 | + | ||
140 | 140 |
| |
141 | 141 |
| |
142 | 142 |
| |
143 | 143 |
| |
144 | 144 |
| |
145 | - | ||
145 | + | ||
146 | 146 |
| |
147 | 147 |
| |
148 | - | ||
148 | + | ||
149 | 149 |
| |
150 | 150 |
| |
151 | 151 |
| |
| |||
169 | 169 |
| |
170 | 170 |
| |
171 | 171 |
| |
172 | - | ||
173 | 172 |
| |
174 | 173 |
| |
175 | - | ||
174 | + | ||
176 | 175 |
| |
177 | 176 |
| |
178 | 177 |
| |
179 | 178 |
| |
180 | 179 |
| |
181 | - | ||
180 | + | ||
182 | 181 |
| |
183 | 182 |
| |
184 | 183 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
91 | 91 |
| |
92 | 92 |
| |
93 | 93 |
| |
94 | - | ||
94 | + | ||
95 | 95 |
| |
96 | 96 |
| |
97 | 97 |
| |
98 | 98 |
| |
99 | 99 |
| |
100 | 100 |
| |
101 | - | ||
101 | + | ||
102 | 102 |
| |
103 | 103 |
| |
104 | 104 |
| |
|
Lines changed: 2 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
18 | 18 |
| |
19 | 19 |
| |
20 | 20 |
| |
21 | - | ||
22 | 21 |
| |
23 | 22 |
| |
24 | - | ||
23 | + | ||
25 | 24 |
| |
26 | 25 |
| |
27 | 26 |
| |
28 | 27 |
| |
29 | 28 |
| |
30 | - | ||
29 | + | ||
31 | 30 |
| |
32 | 31 |
|
Lines changed: 1 addition & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
19 | 19 |
| |
20 | 20 |
| |
21 | 21 |
| |
22 | - | ||
23 | - | ||
24 | 22 |
| |
25 | 23 |
| |
26 | 24 |
| |
| |||
31 | 29 |
| |
32 | 30 |
| |
33 | 31 |
| |
34 | - | ||
32 | + | ||
35 | 33 |
| |
36 | 34 |
| |
37 | 35 |
| |
|
Lines changed: 2 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
21 | 21 |
| |
22 | 22 |
| |
23 | 23 |
| |
24 | - | ||
24 | + | ||
25 | 25 |
| |
26 | 26 |
| |
27 | 27 |
| |
| |||
62 | 62 |
| |
63 | 63 |
| |
64 | 64 |
| |
65 | - | ||
65 | + | ||
66 | 66 |
| |
67 | 67 |
| |
68 | 68 |
| |
69 | 69 |
| |
70 | 70 |
| |
71 | - | ||
72 | - | ||
73 | - | ||
74 | 71 |
| |
75 | 72 |
| |
76 | 73 |
| |
|
Lines changed: 9 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
37 | 37 |
| |
38 | 38 |
| |
39 | 39 |
| |
40 | - | ||
40 | + | ||
41 | 41 |
| |
42 | - | ||
42 | + | ||
43 | + | ||
43 | 44 |
| |
44 | 45 |
| |
45 | 46 |
| |
| |||
53 | 54 |
| |
54 | 55 |
| |
55 | 56 |
| |
56 | - | ||
57 | + | ||
57 | 58 |
| |
58 | - | ||
59 | + | ||
60 | + | ||
59 | 61 |
| |
60 | 62 |
| |
61 | 63 |
| |
| |||
69 | 71 |
| |
70 | 72 |
| |
71 | 73 |
| |
72 | - | ||
74 | + | ||
73 | 75 |
| |
74 | - | ||
76 | + | ||
77 | + | ||
75 | 78 |
| |
76 | 79 |
| |
77 | 80 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
19 | 19 |
| |
20 | 20 |
| |
21 | 21 |
| |
22 | - | ||
22 | + |
Lines changed: 15 additions & 15 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
17 | 17 |
| |
18 | 18 |
| |
19 | 19 |
| |
20 | - | ||
20 | + | ||
21 | 21 |
| |
22 | 22 |
| |
23 | - | ||
23 | + | ||
24 | 24 |
| |
25 | 25 |
| |
26 | 26 |
| |
27 | 27 |
| |
28 | - | ||
28 | + | ||
29 | 29 |
| |
30 | 30 |
| |
31 | 31 |
| |
32 | - | ||
32 | + | ||
33 | 33 |
| |
34 | 34 |
| |
35 | - | ||
36 | - | ||
37 | - | ||
35 | + | ||
36 | + | ||
38 | 37 |
| |
38 | + | ||
39 | 39 |
| |
40 | + | ||
41 | + | ||
42 | + | ||
40 | 43 |
| |
41 | 44 |
| |
42 | 45 |
| |
43 | - | ||
44 | - | ||
45 | - | ||
46 | - | ||
46 | + | ||
47 | 47 |
| |
48 | 48 |
| |
49 | - | ||
50 | - | ||
49 | + | ||
50 | + | ||
51 | 51 |
| |
52 | - | ||
52 | + | ||
53 | 53 |
| |
54 | 54 |
| |
55 | - | ||
55 | + | ||
56 | 56 |
| |
57 | 57 |
| |
58 | 58 |
| |
|
0 commit comments