-
-
Notifications
You must be signed in to change notification settings - Fork 587
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* @license Apache-2.0 | ||
* | ||
* Copyright (c) 2019 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. | ||
*/ | ||
|
||
// TypeScript Version: 2.0 | ||
|
||
/** | ||
* Computes the natural logarithm of \\( 1-\exp(-|x|) \\). | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
kgryte
Member
|
||
* | ||
* @param x - input value | ||
* @returns function value | ||
* | ||
* @example | ||
* var v = log1mexp( 1.1 ); | ||
* // returns ~-0.40477 | ||
* | ||
* @example | ||
* var v = log1mexp( 0.0 ); | ||
* // returns -Infinity | ||
* | ||
* @example | ||
* var v = log1mexp( NaN ); | ||
* // returns NaN | ||
*/ | ||
declare function log1mexp( x: number ): number; | ||
|
||
|
||
// EXPORTS // | ||
|
||
export = log1mexp; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* @license Apache-2.0 | ||
* | ||
* Copyright (c) 2019 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. | ||
*/ | ||
|
||
import log1mexp = require( './index' ); | ||
|
||
|
||
// TESTS // | ||
|
||
// The function returns a number... | ||
{ | ||
log1mexp( 8 ); // $ExpectType number | ||
} | ||
|
||
// The function does not compile if provided a value other than an a number... | ||
{ | ||
log1mexp( true ); // $ExpectError | ||
log1mexp( false ); // $ExpectError | ||
log1mexp( '5' ); // $ExpectError | ||
log1mexp( [] ); // $ExpectError | ||
log1mexp( {} ); // $ExpectError | ||
log1mexp( ( x ) => x ); // $ExpectError | ||
} | ||
|
||
// The function does not compile if provided insufficient arguments... | ||
{ | ||
log1mexp(); // $ExpectError | ||
} | ||
|
||
|
||
log1mexp( ) |
@athan Shall we avoid including LaTeX equations, as these won't render and I am doubting that editors like VSCode will ever include something like MathJax or KaTeX?