diff --git a/lib/node_modules/@stdlib/math/base/special/cabs2/README.md b/lib/node_modules/@stdlib/math/base/special/cabs2/README.md index 30f9a5e2defc..45f74a2237b5 100644 --- a/lib/node_modules/@stdlib/math/base/special/cabs2/README.md +++ b/lib/node_modules/@stdlib/math/base/special/cabs2/README.md @@ -135,18 +135,20 @@ for ( i = 0; i < 100; i++ ) { Computes the squared [absolute value][absolute-value] of a double-precision complex floating-point number. ```c -#include +#include "stdlib/complex/float64.h" -double y = stdlib_base_cabs2( 5.0+3.0*I ); +stdlib_complex128_t z = stdlib_complex128( 5.0, 3.0 ); + +double y = stdlib_base_cabs2( z ); // returns 34.0 ``` The function accepts the following arguments: -- **z**: `[in] double complex` input value. +- **z**: `[in] stdlib_complex128_t` input value. ```c -double stdlib_base_cabs2( const double complex z ); +double stdlib_base_cabs2( const stdlib_complex128_t z ); ``` @@ -169,19 +171,28 @@ double stdlib_base_cabs2( const double complex z ); ```c #include "stdlib/math/base/special/cabs2.h" +#include "stdlib/complex/float64.h" +#include "stdlib/complex/reim.h" #include -#include int main() { - double complex x[] = { 3.14+1.0*I, -3.14-1.0*I, 0.0+0.0*I, 0.0/0.0+0.0/0.0*I }; - - double complex v; + const stdlib_complex128_t x[] = { + stdlib_complex128( 3.14, 1.0 ), + stdlib_complex128( -3.14, -1.0 ), + stdlib_complex128( 0.0, 0.0 ), + stdlib_complex128( 0.0/0.0, 0.0/0.0 ) + }; + + stdlib_complex128_t v; + double re; + double im; double y; int i; for ( i = 0; i < 4; i++ ) { v = x[ i ]; y = stdlib_base_cabs2( v ); - printf( "f(%lf + %lf) = %lf\n", creal( v ), cimag( v ), y ); + stdlib_reim( v, &re, &im ); + printf( "f(%lf + %lf) = %lf\n", re, im, y ); } } ``` diff --git a/lib/node_modules/@stdlib/math/base/special/cabs2/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/cabs2/benchmark/benchmark.native.js new file mode 100644 index 000000000000..e14f39c1b255 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/cabs2/benchmark/benchmark.native.js @@ -0,0 +1,65 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2023 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/base/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var Complex128 = require( '@stdlib/complex/float64' ); +var tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var cabs2 = tryRequire( resolve( __dirname, './../lib/native.js' ) ); +var opts = { + 'skip': ( cabs2 instanceof Error ) +}; + + +// MAIN // + +bench( pkg+'::native', opts, function benchmark( b ) { + var values; + var y; + var i; + + values = [ + new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), + new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + y = cabs2( values[ i%values.length ] ); + if ( isnan( y ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/math/base/special/cabs2/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/cabs2/benchmark/c/native/benchmark.c index d58e34c96c88..b5ba4915962d 100644 --- a/lib/node_modules/@stdlib/math/base/special/cabs2/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/cabs2/benchmark/c/native/benchmark.c @@ -20,7 +20,8 @@ * Benchmark `cabs2`. */ #include "stdlib/math/base/special/cabs2.h" -#include +#include "stdlib/complex/float64.h" +#include "stdlib/complex/reim.h" #include #include #include @@ -94,7 +95,6 @@ double rand_double() { * @return elapsed time in seconds */ double benchmark() { - double complex z; double elapsed; double re; double im; @@ -102,11 +102,13 @@ double benchmark() { double t; int i; + stdlib_complex128_t z; + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { re = ( 1000.0*rand_double() ) - 500.0; im = ( 1000.0*rand_double() ) - 500.0; - z = re + im*I; + z = stdlib_complex128( re, im ); y = stdlib_base_cabs2( z ); if ( y != y ) { printf( "should not return NaN\n" ); diff --git a/lib/node_modules/@stdlib/math/base/special/cabs2/binding.gyp b/lib/node_modules/@stdlib/math/base/special/cabs2/binding.gyp new file mode 100644 index 000000000000..f2b466aef5c4 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/cabs2/binding.gyp @@ -0,0 +1,170 @@ +# @license Apache-2.0 +# +# Copyright (c) 2023 The Stdlib Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A `.gyp` file for building a Node.js native add-on. +# +# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md +# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md +{ + # List of files to include in this file: + 'includes': [ + './include.gypi', + ], + + # Define variables to be used throughout the configuration for all targets: + 'variables': { + # Target name should match the add-on export name: + 'addon_target_name%': 'addon', + + # Set variables based on the host OS: + 'conditions': [ + [ + 'OS=="win"', + { + # Define the object file suffix: + 'obj': 'obj', + }, + { + # Define the object file suffix: + 'obj': 'o', + } + ], # end condition (OS=="win") + ], # end conditions + }, # end variables + + # Define compile targets: + 'targets': [ + + # Target to generate an add-on: + { + # The target name should match the add-on export name: + 'target_name': '<(addon_target_name)', + + # Define dependencies: + 'dependencies': [], + + # Define directories which contain relevant include headers: + 'include_dirs': [ + # Local include directory: + '<@(include_dirs)', + ], + + # List of source files: + 'sources': [ + '<@(src_files)', + ], + + # Settings which should be applied when a target's object files are used as linker input: + 'link_settings': { + # Define libraries: + 'libraries': [ + '<@(libraries)', + ], + + # Define library directories: + 'library_dirs': [ + '<@(library_dirs)', + ], + }, + + # C/C++ compiler flags: + 'cflags': [ + # Enable commonly used warning options: + '-Wall', + + # Aggressive optimization: + '-O3', + ], + + # C specific compiler flags: + 'cflags_c': [ + # Specify the C standard to which a program is expected to conform: + '-std=c99', + ], + + # C++ specific compiler flags: + 'cflags_cpp': [ + # Specify the C++ standard to which a program is expected to conform: + '-std=c++11', + ], + + # Linker flags: + 'ldflags': [], + + # Apply conditions based on the host OS: + 'conditions': [ + [ + 'OS=="mac"', + { + # Linker flags: + 'ldflags': [ + '-undefined dynamic_lookup', + '-Wl,-no-pie', + '-Wl,-search_paths_first', + ], + }, + ], # end condition (OS=="mac") + [ + 'OS!="win"', + { + # C/C++ flags: + 'cflags': [ + # Generate platform-independent code: + '-fPIC', + ], + }, + ], # end condition (OS!="win") + ], # end conditions + }, # end target <(addon_target_name) + + # Target to copy a generated add-on to a standard location: + { + 'target_name': 'copy_addon', + + # Declare that the output of this target is not linked: + 'type': 'none', + + # Define dependencies: + 'dependencies': [ + # Require that the add-on be generated before building this target: + '<(addon_target_name)', + ], + + # Define a list of actions: + 'actions': [ + { + 'action_name': 'copy_addon', + 'message': 'Copying addon...', + + # Explicitly list the inputs in the command-line invocation below: + 'inputs': [], + + # Declare the expected outputs: + 'outputs': [ + '<(addon_output_dir)/<(addon_target_name).node', + ], + + # Define the command-line invocation: + 'action': [ + 'cp', + '<(PRODUCT_DIR)/<(addon_target_name).node', + '<(addon_output_dir)/<(addon_target_name).node', + ], + }, + ], # end actions + }, # end target copy_addon + ], # end targets +} diff --git a/lib/node_modules/@stdlib/math/base/special/cabs2/examples/c/example.c b/lib/node_modules/@stdlib/math/base/special/cabs2/examples/c/example.c index efdaaef0906c..4ee5bc8e0532 100644 --- a/lib/node_modules/@stdlib/math/base/special/cabs2/examples/c/example.c +++ b/lib/node_modules/@stdlib/math/base/special/cabs2/examples/c/example.c @@ -17,19 +17,27 @@ */ #include "stdlib/math/base/special/cabs2.h" +#include "stdlib/complex/float64.h" +#include "stdlib/complex/reim.h" #include -#include int main() { - // cppcheck-suppress nanInArithmeticExpression - double complex x[] = { 3.14+1.0*I, -3.14-1.0*I, 0.0+0.0*I, 0.0/0.0+0.0/0.0*I }; + const stdlib_complex128_t x[] = { + stdlib_complex128( 3.14, 1.0 ), + stdlib_complex128( -3.14, -1.0 ), + stdlib_complex128( 0.0, 0.0 ), + stdlib_complex128( 0.0/0.0, 0.0/0.0 ) + }; - double complex v; + stdlib_complex128_t v; + double re; + double im; double y; int i; for ( i = 0; i < 4; i++ ) { v = x[ i ]; y = stdlib_base_cabs2( v ); - printf( "f(%lf + %lf) = %lf\n", creal( v ), cimag( v ), y ); + stdlib_reim( v, &re, &im ); + printf( "f(%lf + %lf) = %lf\n", re, im, y ); } } diff --git a/lib/node_modules/@stdlib/math/base/special/cabs2/include.gypi b/lib/node_modules/@stdlib/math/base/special/cabs2/include.gypi new file mode 100644 index 000000000000..78db9faf8c74 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/cabs2/include.gypi @@ -0,0 +1,53 @@ +# @license Apache-2.0 +# +# Copyright (c) 2023 The Stdlib Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A GYP include file for building a Node.js native add-on. +# +# Main documentation: +# +# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md +# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md +{ + # Define variables to be used throughout the configuration for all targets: + 'variables': { + # Source directory: + 'src_dir': './src', + + # Include directories: + 'include_dirs': [ + ' +#include "stdlib/complex/float64.h" /* * If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. @@ -31,7 +31,7 @@ extern "C" { /** * Computes the squared absolute value of a double-precision complex floating-point number. */ -double stdlib_base_cabs2( const double complex z ); +double stdlib_base_cabs2( const stdlib_complex128_t z ); #ifdef __cplusplus } diff --git a/lib/node_modules/@stdlib/math/base/special/cabs2/lib/native.js b/lib/node_modules/@stdlib/math/base/special/cabs2/lib/native.js new file mode 100644 index 000000000000..e756a861bec0 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/cabs2/lib/native.js @@ -0,0 +1,48 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2023 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var addon = require( './../src/addon.node' ); + + +// MAIN // + +/** +* Computes the squared absolute value of a double-precision complex floating-point number. +* +* @private +* @param {Complex128} z - complex number +* @returns {number} squared absolute value +* +* @example +* var Complex128 = require( '@stdlib/complex/float64' ); +* +* var v = cabs2( new Complex128( 5.0, 3.0 ) ); +* // returns 34.0 +*/ +function cabs2( z ) { + return addon( z ); +} + + +// EXPORTS // + +module.exports = cabs2; diff --git a/lib/node_modules/@stdlib/math/base/special/cabs2/manifest.json b/lib/node_modules/@stdlib/math/base/special/cabs2/manifest.json index 890a937a3dc0..fbdbc1923a74 100644 --- a/lib/node_modules/@stdlib/math/base/special/cabs2/manifest.json +++ b/lib/node_modules/@stdlib/math/base/special/cabs2/manifest.json @@ -1,38 +1,75 @@ { - "options": {}, + "options": { + "task": "build" + }, "fields": [ - { - "field": "src", - "resolve": true, - "relative": true - }, - { - "field": "include", - "resolve": true, - "relative": true - }, - { - "field": "libraries", - "resolve": false, - "relative": false - }, - { - "field": "libpath", - "resolve": true, - "relative": false - } + { + "field": "src", + "resolve": true, + "relative": true + }, + { + "field": "include", + "resolve": true, + "relative": true + }, + { + "field": "libraries", + "resolve": false, + "relative": false + }, + { + "field": "libpath", + "resolve": true, + "relative": false + } ], "confs": [ - { - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [] - } + { + "task": "build", + "src": [ + "./src/main.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/math/base/napi/unary", + "@stdlib/complex/float64", + "@stdlib/complex/reim" + ] + }, + { + "task": "benchmark", + "src": [ + "./src/main.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/complex/float64", + "@stdlib/complex/reim" + ] + }, + { + "task": "examples", + "src": [ + "./src/main.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/complex/float64", + "@stdlib/complex/reim" + ] + } ] } diff --git a/lib/node_modules/@stdlib/math/base/special/cabs2/package.json b/lib/node_modules/@stdlib/math/base/special/cabs2/package.json index d530e9c53a10..6019d38e4bb3 100644 --- a/lib/node_modules/@stdlib/math/base/special/cabs2/package.json +++ b/lib/node_modules/@stdlib/math/base/special/cabs2/package.json @@ -14,6 +14,7 @@ } ], "main": "./lib", + "gypfile": true, "directories": { "benchmark": "./benchmark", "doc": "./docs", diff --git a/lib/node_modules/@stdlib/math/base/special/cabs2/src/Makefile b/lib/node_modules/@stdlib/math/base/special/cabs2/src/Makefile new file mode 100644 index 000000000000..904c7dc4bd7a --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/cabs2/src/Makefile @@ -0,0 +1,70 @@ +#/ +# @license Apache-2.0 +# +# Copyright (c) 2023 The Stdlib Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#/ + +# VARIABLES # + +ifndef VERBOSE + QUIET := @ +else + QUIET := +endif + +# Determine the OS ([1][1], [2][2]). +# +# [1]: https://en.wikipedia.org/wiki/Uname#Examples +# [2]: http://stackoverflow.com/a/27776822/2225624 +OS ?= $(shell uname) +ifneq (, $(findstring MINGW,$(OS))) + OS := WINNT +else +ifneq (, $(findstring MSYS,$(OS))) + OS := WINNT +else +ifneq (, $(findstring CYGWIN,$(OS))) + OS := WINNT +else +ifneq (, $(findstring Windows_NT,$(OS))) + OS := WINNT +endif +endif +endif +endif + + +# RULES # + +#/ +# Removes generated files for building an add-on. +# +# @example +# make clean-addon +#/ +clean-addon: + $(QUIET) -rm -f *.o *.node + +.PHONY: clean-addon + +#/ +# Removes generated files. +# +# @example +# make clean +#/ +clean: clean-addon + +.PHONY: clean diff --git a/lib/node_modules/@stdlib/math/base/special/cabs2/src/addon.c b/lib/node_modules/@stdlib/math/base/special/cabs2/src/addon.c new file mode 100644 index 000000000000..0cb17ea425ce --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/cabs2/src/addon.c @@ -0,0 +1,23 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2023 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "stdlib/math/base/special/cabs2.h" +#include "stdlib/math/base/napi/unary.h" + +// cppcheck-suppress shadowFunction +STDLIB_MATH_BASE_NAPI_MODULE_Z_D( stdlib_base_cabs2 ) diff --git a/lib/node_modules/@stdlib/math/base/special/cabs2/src/main.c b/lib/node_modules/@stdlib/math/base/special/cabs2/src/main.c index 6f47a6413593..0102502056c8 100644 --- a/lib/node_modules/@stdlib/math/base/special/cabs2/src/main.c +++ b/lib/node_modules/@stdlib/math/base/special/cabs2/src/main.c @@ -17,7 +17,8 @@ */ #include "stdlib/math/base/special/cabs2.h" -#include +#include "stdlib/complex/float64.h" +#include "stdlib/complex/reim.h" /** * Computes the squared absolute value of a double-precision complex floating-point number. @@ -26,11 +27,16 @@ * @return result * * @example -* double y = stdlib_base_cabs2( 5.0+3.0*I ); +* #include "stdlib/complex/float64.h" +* +* stdlib_complex128_t z = stdlib_complex128( 5.0, 3.0 ); +* +* double y = stdlib_base_cabs2( z ); * // returns 34.0 */ -double stdlib_base_cabs2( const double complex z ) { - double re = creal( z ); - double im = cimag( z ); - return (re*re) + (im*im); +double stdlib_base_cabs2( const stdlib_complex128_t z ) { + double re; + double im; + stdlib_reim( z, &re, &im ); + return ( re * re ) + ( im * im ); } diff --git a/lib/node_modules/@stdlib/math/base/special/cabs2/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/cabs2/test/test.native.js new file mode 100644 index 000000000000..6927534ea14f --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/cabs2/test/test.native.js @@ -0,0 +1,92 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2023 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var resolve = require( 'path' ).resolve; +var tape = require( 'tape' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var EPS = require( '@stdlib/constants/float64/eps' ); +var abs = require( '@stdlib/math/base/special/abs' ); +var Complex128 = require( '@stdlib/complex/float64' ); +var tryRequire = require( '@stdlib/utils/try-require' ); + + +// VARIABLES // + +var cabs2 = tryRequire( resolve( __dirname, './../lib/native.js' ) ); +var opts = { + 'skip': ( cabs2 instanceof Error ) +}; + + +// FIXTURES // + +var data = require( './fixtures/julia/data.json' ); + + +// TESTS // + +tape( 'main export is a function', opts, function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof cabs2, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function computes the squared absolute value of a complex number', opts, function test( t ) { + var expected; + var delta; + var tol; + var re; + var im; + var y; + var i; + + re = data.re; + im = data.im; + expected = data.expected; + + for ( i = 0; i < re.length; i++ ) { + y = cabs2( new Complex128( re[ i ], im[ i ] ) ); + if ( y === expected[ i ] ) { + t.equal( y, expected[ i ], 're: '+re[i]+'. im: '+im[i]+'. Expected: '+expected[i] ); + } else { + delta = abs( y - expected[i] ); + tol = EPS * abs( expected[i] ); + t.ok( delta <= tol, 'within tolerance. re: '+re[i]+'. im: '+im[i]+' y: '+y+'. Expected: '+expected[i]+'. delta: '+delta+'. tol: '+tol+'.' ); + } + } + t.end(); +}); + +tape( 'if either the real or imaginary component is `NaN`, the function returns `NaN`', opts, function test( t ) { + var v; + + v = cabs2( new Complex128( NaN, 3.0 ) ); + t.strictEqual( isnan( v ), true, 'returns NaN' ); + + v = cabs2( new Complex128( 5.0, NaN ) ); + t.strictEqual( isnan( v ), true, 'returns NaN' ); + + v = cabs2( new Complex128( NaN, NaN ) ); + t.strictEqual( isnan( v ), true, 'returns NaN' ); + + t.end(); +});