@@ -25,28 +25,28 @@ <h1><a href="../../../../index.html">All files</a> / <a href="index.html">ndarra
2525 < div class ='fl pad1y space-right2 '>
2626 < span class ="strong "> 100% </ span >
2727 < span class ="quiet "> Statements</ span >
28- < span class ='fraction '> 332/332 </ span >
28+ < span class ='fraction '> 373/373 </ span >
2929 </ div >
3030
3131
3232 < div class ='fl pad1y space-right2 '>
3333 < span class ="strong "> 100% </ span >
3434 < span class ="quiet "> Branches</ span >
35- < span class ='fraction '> 28/28 </ span >
35+ < span class ='fraction '> 34/34 </ span >
3636 </ div >
3737
3838
3939 < div class ='fl pad1y space-right2 '>
4040 < span class ="strong "> 100% </ span >
4141 < span class ="quiet "> Functions</ span >
42- < span class ='fraction '> 8/8 </ span >
42+ < span class ='fraction '> 10/10 </ span >
4343 </ div >
4444
4545
4646 < div class ='fl pad1y space-right2 '>
4747 < span class ="strong "> 100% </ span >
4848 < span class ="quiet "> Lines</ span >
49- < span class ='fraction '> 332/332 </ span >
49+ < span class ='fraction '> 373/373 </ span >
5050 </ div >
5151
5252
@@ -395,7 +395,64 @@ <h1><a href="../../../../index.html">All files</a> / <a href="index.html">ndarra
395395< a name ='L330 '> </ a > < a href ='#L330 '> 330</ a >
396396< a name ='L331 '> </ a > < a href ='#L331 '> 331</ a >
397397< a name ='L332 '> </ a > < a href ='#L332 '> 332</ a >
398- < a name ='L333 '> </ a > < a href ='#L333 '> 333</ a > </ td > < td class ="line-coverage quiet "> < span class ="cline-any cline-yes "> 2x</ span >
398+ < a name ='L333 '> </ a > < a href ='#L333 '> 333</ a >
399+ < a name ='L334 '> </ a > < a href ='#L334 '> 334</ a >
400+ < a name ='L335 '> </ a > < a href ='#L335 '> 335</ a >
401+ < a name ='L336 '> </ a > < a href ='#L336 '> 336</ a >
402+ < a name ='L337 '> </ a > < a href ='#L337 '> 337</ a >
403+ < a name ='L338 '> </ a > < a href ='#L338 '> 338</ a >
404+ < a name ='L339 '> </ a > < a href ='#L339 '> 339</ a >
405+ < a name ='L340 '> </ a > < a href ='#L340 '> 340</ a >
406+ < a name ='L341 '> </ a > < a href ='#L341 '> 341</ a >
407+ < a name ='L342 '> </ a > < a href ='#L342 '> 342</ a >
408+ < a name ='L343 '> </ a > < a href ='#L343 '> 343</ a >
409+ < a name ='L344 '> </ a > < a href ='#L344 '> 344</ a >
410+ < a name ='L345 '> </ a > < a href ='#L345 '> 345</ a >
411+ < a name ='L346 '> </ a > < a href ='#L346 '> 346</ a >
412+ < a name ='L347 '> </ a > < a href ='#L347 '> 347</ a >
413+ < a name ='L348 '> </ a > < a href ='#L348 '> 348</ a >
414+ < a name ='L349 '> </ a > < a href ='#L349 '> 349</ a >
415+ < a name ='L350 '> </ a > < a href ='#L350 '> 350</ a >
416+ < a name ='L351 '> </ a > < a href ='#L351 '> 351</ a >
417+ < a name ='L352 '> </ a > < a href ='#L352 '> 352</ a >
418+ < a name ='L353 '> </ a > < a href ='#L353 '> 353</ a >
419+ < a name ='L354 '> </ a > < a href ='#L354 '> 354</ a >
420+ < a name ='L355 '> </ a > < a href ='#L355 '> 355</ a >
421+ < a name ='L356 '> </ a > < a href ='#L356 '> 356</ a >
422+ < a name ='L357 '> </ a > < a href ='#L357 '> 357</ a >
423+ < a name ='L358 '> </ a > < a href ='#L358 '> 358</ a >
424+ < a name ='L359 '> </ a > < a href ='#L359 '> 359</ a >
425+ < a name ='L360 '> </ a > < a href ='#L360 '> 360</ a >
426+ < a name ='L361 '> </ a > < a href ='#L361 '> 361</ a >
427+ < a name ='L362 '> </ a > < a href ='#L362 '> 362</ a >
428+ < a name ='L363 '> </ a > < a href ='#L363 '> 363</ a >
429+ < a name ='L364 '> </ a > < a href ='#L364 '> 364</ a >
430+ < a name ='L365 '> </ a > < a href ='#L365 '> 365</ a >
431+ < a name ='L366 '> </ a > < a href ='#L366 '> 366</ a >
432+ < a name ='L367 '> </ a > < a href ='#L367 '> 367</ a >
433+ < a name ='L368 '> </ a > < a href ='#L368 '> 368</ a >
434+ < a name ='L369 '> </ a > < a href ='#L369 '> 369</ a >
435+ < a name ='L370 '> </ a > < a href ='#L370 '> 370</ a >
436+ < a name ='L371 '> </ a > < a href ='#L371 '> 371</ a >
437+ < a name ='L372 '> </ a > < a href ='#L372 '> 372</ a >
438+ < a name ='L373 '> </ a > < a href ='#L373 '> 373</ a >
439+ < a name ='L374 '> </ a > < a href ='#L374 '> 374</ a > </ td > < td class ="line-coverage quiet "> < span class ="cline-any cline-yes "> 2x</ span >
440+ < span class ="cline-any cline-yes "> 2x</ span >
441+ < span class ="cline-any cline-yes "> 2x</ span >
442+ < span class ="cline-any cline-yes "> 2x</ span >
443+ < span class ="cline-any cline-yes "> 2x</ span >
444+ < span class ="cline-any cline-yes "> 2x</ span >
445+ < span class ="cline-any cline-yes "> 2x</ span >
446+ < span class ="cline-any cline-yes "> 2x</ span >
447+ < span class ="cline-any cline-yes "> 2x</ span >
448+ < span class ="cline-any cline-yes "> 2x</ span >
449+ < span class ="cline-any cline-yes "> 2x</ span >
450+ < span class ="cline-any cline-yes "> 2x</ span >
451+ < span class ="cline-any cline-yes "> 2x</ span >
452+ < span class ="cline-any cline-yes "> 2x</ span >
453+ < span class ="cline-any cline-yes "> 2x</ span >
454+ < span class ="cline-any cline-yes "> 2x</ span >
455+ < span class ="cline-any cline-yes "> 2x</ span >
399456< span class ="cline-any cline-yes "> 2x</ span >
400457< span class ="cline-any cline-yes "> 2x</ span >
401458< span class ="cline-any cline-yes "> 2x</ span >
@@ -684,6 +741,28 @@ <h1><a href="../../../../index.html">All files</a> / <a href="index.html">ndarra
684741< span class ="cline-any cline-yes "> 2x</ span >
685742< span class ="cline-any cline-yes "> 2x</ span >
686743< span class ="cline-any cline-yes "> 2x</ span >
744+ < span class ="cline-any cline-yes "> 18x</ span >
745+ < span class ="cline-any cline-yes "> 18x</ span >
746+ < span class ="cline-any cline-yes "> 18x</ span >
747+ < span class ="cline-any cline-yes "> 2x</ span >
748+ < span class ="cline-any cline-yes "> 2x</ span >
749+ < span class ="cline-any cline-yes "> 2x</ span >
750+ < span class ="cline-any cline-yes "> 2x</ span >
751+ < span class ="cline-any cline-yes "> 2x</ span >
752+ < span class ="cline-any cline-yes "> 2x</ span >
753+ < span class ="cline-any cline-yes "> 2x</ span >
754+ < span class ="cline-any cline-yes "> 2x</ span >
755+ < span class ="cline-any cline-yes "> 22x</ span >
756+ < span class ="cline-any cline-yes "> 22x</ span >
757+ < span class ="cline-any cline-yes "> 22x</ span >
758+ < span class ="cline-any cline-yes "> 2x</ span >
759+ < span class ="cline-any cline-yes "> 2x</ span >
760+ < span class ="cline-any cline-yes "> 2x</ span >
761+ < span class ="cline-any cline-yes "> 2x</ span >
762+ < span class ="cline-any cline-yes "> 2x</ span >
763+ < span class ="cline-any cline-yes "> 2x</ span >
764+ < span class ="cline-any cline-yes "> 2x</ span >
765+ < span class ="cline-any cline-yes "> 2x</ span >
687766< span class ="cline-any cline-yes "> 2x</ span >
688767< span class ="cline-any cline-yes "> 2x</ span >
689768< span class ="cline-any cline-yes "> 2x</ span >
@@ -718,8 +797,11 @@ <h1><a href="../../../../index.html">All files</a> / <a href="index.html">ndarra
718797< span class ="cline-any cline-yes "> 99x</ span >
719798< span class ="cline-any cline-yes "> 99x</ span >
720799< span class ="cline-any cline-yes "> 198x</ span >
721- < span class ="cline-any cline-yes "> 198x</ span >
722- < span class ="cline-any cline-yes "> 198x</ span >
800+ < span class ="cline-any cline-yes "> 297x</ span >
801+ < span class ="cline-any cline-yes "> 158x</ span >
802+ < span class ="cline-any cline-yes "> 158x</ span >
803+ < span class ="cline-any cline-yes "> 40x</ span >
804+ < span class ="cline-any cline-yes "> 40x</ span >
723805< span class ="cline-any cline-yes "> 28x</ span >
724806< span class ="cline-any cline-yes "> 440x</ span >
725807< span class ="cline-any cline-yes "> 2x</ span >
@@ -764,6 +846,7 @@ <h1><a href="../../../../index.html">All files</a> / <a href="index.html">ndarra
764846var isBooleanIndexDataType = require( '@stdlib/ndarray/base/assert/is-boolean-index-data-type' );
765847var isMaskIndexDataType = require( '@stdlib/ndarray/base/assert/is-mask-index-data-type' );
766848var isDataType = require( '@stdlib/ndarray/base/assert/is-data-type' );
849+ var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
767850var promoteDataTypes = require( '@stdlib/ndarray/base/promote-dtypes' );
768851var defaults = require( '@stdlib/ndarray/defaults' );
769852var join = require( '@stdlib/array/base/join' );
@@ -777,6 +860,7 @@ <h1><a href="../../../../index.html">All files</a> / <a href="index.html">ndarra
777860var DEFAULT_SIGNED_INTEGER_DTYPE = defaults.get( 'dtypes.signed_integer' );
778861var DEFAULT_UNSIGNED_INTEGER_DTYPE = defaults.get( 'dtypes.unsigned_integer' );
779862var DEFAULT_REAL_FLOATING_POINT_DTYPE = defaults.get( 'dtypes.real_floating_point' );
863+ var DEFAULT_COMPLEX_FLOATING_POINT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );
780864
781865// Table where, for each respective policy, the value is a function which applies the policy to an input data type...
782866var POLICY_TABLE1 = {
@@ -800,19 +884,19 @@ <h1><a href="../../../../index.html">All files</a> / <a href="index.html">ndarra
800884 ],
801885 'real_floating_point': [
802886 isRealFloatingPointDataType,
803- DEFAULT_REAL_FLOATING_POINT_DTYPE
887+ resolveDefaultRealFloatingPoint
804888 ],
805889 'real_floating_point_and_generic': [
806890 wrap( isRealFloatingPointDataType ),
807- DEFAULT_REAL_FLOATING_POINT_DTYPE
891+ resolveDefaultRealFloatingPoint
808892 ],
809893 'complex_floating_point': [
810894 isComplexFloatingPointDataType,
811- defaults.get( 'dtypes.complex_floating_point' )
895+ resolveDefaultComplexFloatingPoint
812896 ],
813897 'complex_floating_point_and_generic': [
814898 wrap( isComplexFloatingPointDataType ),
815- defaults.get( 'dtypes.complex_floating_point' )
899+ resolveDefaultComplexFloatingPoint
816900 ],
817901
818902 // Integer policies...
@@ -898,6 +982,20 @@ <h1><a href="../../../../index.html">All files</a> / <a href="index.html">ndarra
898982 ]
899983};
900984
985+ // Table mapping complex-valued floating-point data types to real-valued floating-point data types having the same precision:
986+ var COMPLEX2FLOAT = {
987+ 'complex128': 'float64',
988+ 'complex64': 'float32',
989+ 'complex32': 'float16'
990+ };
991+
992+ // Table mapping real-valued floating-point data types to complex-valued floating-point data types having the same precision:
993+ var FLOAT2COMPLEX = {
994+ 'float64': 'complex128',
995+ 'float32': 'complex64',
996+ 'float16': 'complex32'
997+ };
998+
901999
9021000// FUNCTIONS //
9031001
@@ -1009,6 +1107,28 @@ <h1><a href="../../../../index.html">All files</a> / <a href="index.html">ndarra
10091107 return DEFAULT_REAL_FLOATING_POINT_DTYPE;
10101108}
10111109
1110+ /**
1111+ * Resolves a default real-valued floating-point data type which preserves floating-point precision.
1112+ *
1113+ * @private
1114+ * @param {string} dtype - input ndarray data type
1115+ * @returns {string} output ndarray data type
1116+ */
1117+ function resolveDefaultRealFloatingPoint( dtype ) {
1118+ return COMPLEX2FLOAT[ dtype ] || DEFAULT_REAL_FLOATING_POINT_DTYPE;
1119+ }
1120+
1121+ /**
1122+ * Resolves a default complex-valued floating-point data type which preserves floating-point precision.
1123+ *
1124+ * @private
1125+ * @param {string} dtype - input ndarray data type
1126+ * @returns {string} output ndarray data type
1127+ */
1128+ function resolveDefaultComplexFloatingPoint( dtype ) {
1129+ return FLOAT2COMPLEX[ dtype ] || DEFAULT_COMPLEX_FLOATING_POINT_DTYPE;
1130+ }
1131+
10121132
10131133// MAIN //
10141134
@@ -1049,8 +1169,11 @@ <h1><a href="../../../../index.html">All files</a> / <a href="index.html">ndarra
10491169 // If so, we can just return the promoted data type:
10501170 return dt;
10511171 }
1052- // Otherwise, we need to fallback to a default data type belonging to that "kind":
1053- return p[ 1 ];
1172+ // Otherwise, we need to fallback to a default data type belonging to that "kind"...
1173+ if ( isString( p[ 1 ] ) ) {
1174+ return p[ 1 ];
1175+ }
1176+ return p[ 1 ]( dt );
10541177 }
10551178 throw new TypeError( format( 'invalid argument. Second argument must be a supported data type policy. Value: `%s`.', policy ) );
10561179}
@@ -1066,7 +1189,7 @@ <h1><a href="../../../../index.html">All files</a> / <a href="index.html">ndarra
10661189 < div class ='footer quiet pad2 space-top1 center small '>
10671190 Code coverage generated by
10681191 < a href ="https://istanbul.js.org/ " target ="_blank " rel ="noopener noreferrer "> istanbul</ a >
1069- at 2025-05-10T11:02:22.696Z
1192+ at 2025-09-13T09:08:12.367Z
10701193 </ div >
10711194 < script src ="../../../../prettify.js "> </ script >
10721195 < script >
0 commit comments