From bb05e58135243559ae656bc601e5fdbfc7489bc0 Mon Sep 17 00:00:00 2001 From: Markus Winter Date: Thu, 4 Jun 2020 23:53:34 +0200 Subject: [PATCH] Fix isNormal on quaternion --- Sources/QuaternionModule/Quaternion.swift | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Sources/QuaternionModule/Quaternion.swift b/Sources/QuaternionModule/Quaternion.swift index 2452c3a..7fdefe1 100644 --- a/Sources/QuaternionModule/Quaternion.swift +++ b/Sources/QuaternionModule/Quaternion.swift @@ -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.