Syntax
s=signthr(x)
Input Parameter
Output Parameter
Copyright 2014-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth
Algorithm (Workflow)
This algorithm is a simple function named signthr
that determines the sign of a given input value x
based on a specified threshold. The function is part of the SG-Library and was created by Tim Lueth on January 8, 2014, as an auxiliary procedure.
Input Parameters
- x: The input value for which the sign is to be determined.
Output Results
- s: The sign of the input value
x
, determined based on the threshold.
Algorithm Explanation
The function signthr
operates as follows:
- A threshold value
thr
is defined as 1e-12
.
- The function checks the value of
x
against this threshold:
- If
x
is greater than thr
, the function returns +1
.
- If
x
is less than -thr
, the function returns -1
.
- If
x
is between -thr
and thr
(inclusive), the function returns 0
.
This approach effectively categorizes the input value x
into positive, negative, or zero based on its magnitude relative to the threshold.
Algorithm explaination created using ChatGPT on 2025-08-18 21:45. (Please note: No guarantee for the correctness of this explanation)
Last html export of this page out of FM database by TL: 2025-09-21