241 of 286
227 SngClass Type Function returning Byte Invocation SngClass(arg) Parameter Method Type Description arg ByVal Single The value of which to determine the floating point classification. Discussion The IEEE 754 standard floating point format used by ZBasic specifies a set of classifications for floating point values. This function returns a numeric value indicating the class to which the passed Single value belongs. The table below enumerates the return values and describes the meaning of each. Floating Point Value Classes Class Value Description ClassNormal 1 Normalized - This class represents “normal” floating point values such as 1.537 but does not include 0.0. ClassZero 2 Zero - This class represents the zero value (positive and negative). ClassInfinity 3 Infinity - This class represents positive and negative infinity. Dividing a positive value by zero results in positive infinity. ClassDenormal 4 Denormalized - This class represents an internal form known as denormalized values. Such values should never be generated as a result of a floating point operation. However if you copy some random bytes into a floating point variable the result may be a denormalized value. ClassNaN 5 NaN - This class represents values that are “Not A Number”. Taking the square root of a negative value or the logarithm of zero results in a NaN. The names in the first column are available as built-in constants. Except for ClassNaN, the return value may include the flag &H80 to indicate a negative value. For example, SngClass(-1.0) returns the value &H81 to indicate a negative ClassNormal value. The built-in constant representing the negative flag is ClassNegative. The built-in constant ClassMask may be used to remove the negative flag from the return value, e.g. SngClass(fval) And ClassMask. Examples Dim class as Byte class = SngClass(1.0) ' result is 1 class = SngClass(-1.0) ' result is &H81 class = SngClass(-1.0) And ClassMask ' result is 1 class = SngClass(Sqr(-1.0)) ' result is 5 class = SngClass(1.0 / 0.0) ' result is 3 Compatibility This function is not available in BasicX compatibility mode.