mirror of
https://github.com/apple/swift-numerics
synced 2026-11-26 04:57:53 +00:00
Fix isNormal on quaternion
This commit is contained in:
1 parent
5e1de5d8e0
commit
bb05e58135
1 file changed
+8
-5
@@ -155,8 +155,8 @@ extension Quaternion {
|
||||
|
||||
/// True if this value is normal.
|
||||
///
|
||||
/// A quaternion is normal if it is finite and *either* the real or *all* of the imaginary
|
||||
/// components are normal. A floating-point number representing one of the components is normal
|
||||
/// A quaternion is normal if it is finite and *any* of its real or imaginary components
|
||||
/// are normal. A floating-point number representing one of the components is normal
|
||||
/// if its exponent allows a full-precision representation.
|
||||
///
|
||||
/// See also:
|
||||
@@ -167,9 +167,12 @@ extension Quaternion {
|
||||
/// - `.isPure`
|
||||
@_transparent
|
||||
public var isNormal: Bool {
|
||||
let realIsNormal = components.x.isNormal
|
||||
let imaginaryIsNormal = components.y.isNormal && components.z.isNormal && components.w.isNormal
|
||||
return isFinite && (realIsNormal || imaginaryIsNormal)
|
||||
return isFinite && (
|
||||
components.x.isNormal ||
|
||||
components.y.isNormal ||
|
||||
components.z.isNormal ||
|
||||
components.w.isNormal
|
||||
)
|
||||
}
|
||||
|
||||
/// True if this value is subnormal.
|
||||
|
||||
Reference in new issue
Block a user