-
-
Notifications
You must be signed in to change notification settings - Fork 881
Commit 862befd
refactor!: modify C implementation to accept
This commit updates the signature of the C API to accept a double 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 doubles
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: #8029
Reviewed-by: Athan Reines <kgryte@gmail.com>double
instead of int32
in math/base/special/factorial2
1 parent 5967ff0 commit 862befd
File tree
8 files changed
+37
-41
lines changed- lib/node_modules/@stdlib/math/base/special/factorial2
- benchmark/c/native
- examples/c
- include/stdlib/math/base/special
- lib
- src
8 files changed
+37
-41
lines changedLines changed: 6 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
124 | 124 |
| |
125 | 125 |
| |
126 | 126 |
| |
127 | - | ||
128 | - | ||
127 | + | ||
128 | + | ||
129 | 129 |
| |
130 | 130 |
| |
131 | 131 |
| |
132 | 132 |
| |
133 | - | ||
133 | + | ||
134 | 134 |
| |
135 | 135 |
| |
136 | - | ||
136 | + | ||
137 | 137 |
| |
138 | 138 |
| |
139 | 139 |
| |
| |||
157 | 157 |
| |
158 | 158 |
| |
159 | 159 |
| |
160 | - | ||
161 | 160 |
| |
162 | 161 |
| |
163 | - | ||
162 | + | ||
164 | 163 |
| |
165 | 164 |
| |
166 | 165 |
| |
167 | 166 |
| |
168 | 167 |
| |
169 | - | ||
168 | + | ||
170 | 169 |
| |
171 | 170 |
| |
172 | 171 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
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 |
| |
105 | 105 |
| |
|
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 |
| |
| |||
56 | 56 |
| |
57 | 57 |
| |
58 | 58 |
| |
59 | - | ||
59 | + | ||
60 | 60 |
| |
61 | 61 |
| |
62 | 62 |
| |
63 | 63 |
| |
64 | 64 |
| |
65 | - | ||
66 | - | ||
67 | - | ||
68 | 65 |
| |
69 | 66 |
| |
70 | 67 |
| |
|
Lines changed: 6 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
39 | 39 |
| |
40 | 40 |
| |
41 | 41 |
| |
42 | - | ||
42 | + | ||
43 | + | ||
43 | 44 |
| |
44 | 45 |
| |
45 | 46 |
| |
| |||
55 | 56 |
| |
56 | 57 |
| |
57 | 58 |
| |
58 | - | ||
59 | + | ||
60 | + | ||
59 | 61 |
| |
60 | 62 |
| |
61 | 63 |
| |
| |||
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: 17 additions & 17 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
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 | - | ||
33 | - | ||
32 | + | ||
33 | + | ||
34 | 34 |
| |
35 | - | ||
36 | - | ||
35 | + | ||
36 | + | ||
37 | 37 |
| |
38 | - | ||
39 | - | ||
38 | + | ||
39 | + | ||
40 | + | ||
41 | + | ||
42 | + | ||
40 | 43 |
| |
41 | 44 |
| |
42 | 45 |
| |
43 | - | ||
44 | - | ||
45 | - | ||
46 | 46 |
| |
47 | - | ||
48 | - | ||
47 | + | ||
48 | + | ||
49 | 49 |
| |
50 | 50 |
| |
51 | - | ||
51 | + | ||
52 | 52 |
| |
53 | - | ||
53 | + | ||
54 | 54 |
| |
55 | - | ||
56 | - | ||
55 | + | ||
56 | + | ||
57 | 57 |
| |
58 | 58 |
| |
59 | 59 |
| |
|
0 commit comments