Skip to content

Commit fc82b83

Browse files
committed
docs: document mostly-safe casting mode
1 parent 12ee2c9 commit fc82b83

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

lib/node_modules/@stdlib/ndarray/array/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ The function accepts the following `options`:
105105
- `none`: only allow casting between identical types.
106106
- `equiv`: allow casting between identical and byte swapped types.
107107
- `safe`: only allow "safe" casts.
108+
- `mostly-safe`: allow "safe" casts and, for floating-point data types, downcasts.
108109
- `same-kind`: allow "safe" casts and casts within the same kind (e.g., between signed integers or between floats).
109110
- `unsafe`: allow casting between all types (including between integers and floats).
110111

@@ -230,7 +231,7 @@ var str = arr.toString();
230231

231232
// Serialize the array as JSON:
232233
str = JSON.stringify( arr.toJSON() );
233-
// returns '{"type":"ndarray","dtype":"float32","flags":{},"order":"row-major","shape":[3,3,3,3],"strides":[27,9,3,1],"data":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}'
234+
// e.g., returns '{"type":"ndarray","dtype":"float32","flags":{},"order":"row-major","shape":[3,3,3,3],"strides":[27,9,3,1],"data":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}'
234235
```
235236

236237
</section>

lib/node_modules/@stdlib/ndarray/array/docs/repl.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@
8181
- 'none': only allow casting between identical types.
8282
- 'equiv': allow casting between identical and byte swapped types.
8383
- 'safe': only allow "safe" casts.
84+
- 'mostly-safe': allow "safe casts" and, for floating-point data types,
85+
downcasts.
8486
- 'same-kind': allow "safe" casts and casts within the same kind (e.g.,
8587
between signed integers or between floats).
8688
- 'unsafe': allow casting between all types (including between integers

0 commit comments

Comments
 (0)