Skip to content

Commit 6164266

Browse files
committed
Add more signed infinity checks for various types
1 parent e6b3bc0 commit 6164266

File tree

9 files changed

+840
-0
lines changed

9 files changed

+840
-0
lines changed

src/Aardvark.Base.FSharp/Prelude/Math.fs

+8
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,15 @@ module FSharpMath =
804804
let a : bool = isPositiveInfinity 0.0
805805
let a : bool = isPositiveInfinity 0.0f
806806
let a : bool = isPositiveInfinity (float16 0.0f)
807+
let a : bool = isPositiveInfinity ComplexD.Zero
808+
let a : bool = isPositiveInfinity C3d.Black
809+
let a : bool = isPositiveInfinity V3d.Zero
810+
let a : bool = isPositiveInfinity M33d.Zero
807811
let a : bool = isNegativeInfinity 0.0
808812
let a : bool = isNegativeInfinity 0.0f
809813
let a : bool = isNegativeInfinity (float16 0.0f)
814+
let a : bool = isNegativeInfinity ComplexD.Zero
815+
let a : bool = isNegativeInfinity C3d.Black
816+
let a : bool = isNegativeInfinity V3d.Zero
817+
let a : bool = isNegativeInfinity M33d.Zero
810818
()

src/Aardvark.Base/Math/Base/Complex_auto.cs

+64
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,24 @@ public bool IsInfinity
250250
get { return (float.IsInfinity(Real) || float.IsInfinity(Imag)); }
251251
}
252252

253+
/// <summary>
254+
/// Returns whether the complex number has a part that is infinite and positive.
255+
/// </summary>
256+
public bool IsPositiveInfinity
257+
{
258+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
259+
get { return (float.IsPositiveInfinity(Real) || float.IsPositiveInfinity(Imag)); }
260+
}
261+
262+
/// <summary>
263+
/// Returns whether the complex number has a part that is infinite and negative.
264+
/// </summary>
265+
public bool IsNegativeInfinity
266+
{
267+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
268+
get { return (float.IsNegativeInfinity(Real) || float.IsNegativeInfinity(Imag)); }
269+
}
270+
253271
/// <summary>
254272
/// Returns whether the complex number is finite (i.e. not NaN and not infinity).
255273
/// </summary>
@@ -1002,6 +1020,20 @@ public static bool IsNaN(ComplexF v)
10021020
public static bool IsInfinity(ComplexF v)
10031021
=> v.IsInfinity;
10041022

1023+
/// <summary>
1024+
/// Returns whether the given <see cref="ComplexF"/> is positive infinity.
1025+
/// </summary>
1026+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1027+
public static bool IsPositiveInfinity(ComplexF v)
1028+
=> v.IsPositiveInfinity;
1029+
1030+
/// <summary>
1031+
/// Returns whether the given <see cref="ComplexF"/> is negative infinity.
1032+
/// </summary>
1033+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1034+
public static bool IsNegativeInfinity(ComplexF v)
1035+
=> v.IsNegativeInfinity;
1036+
10051037
/// <summary>
10061038
/// Returns whether the given <see cref="ComplexF"/> is finite (i.e. not NaN and not infinity).
10071039
/// </summary>
@@ -1253,6 +1285,24 @@ public bool IsInfinity
12531285
get { return (double.IsInfinity(Real) || double.IsInfinity(Imag)); }
12541286
}
12551287

1288+
/// <summary>
1289+
/// Returns whether the complex number has a part that is infinite and positive.
1290+
/// </summary>
1291+
public bool IsPositiveInfinity
1292+
{
1293+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1294+
get { return (double.IsPositiveInfinity(Real) || double.IsPositiveInfinity(Imag)); }
1295+
}
1296+
1297+
/// <summary>
1298+
/// Returns whether the complex number has a part that is infinite and negative.
1299+
/// </summary>
1300+
public bool IsNegativeInfinity
1301+
{
1302+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1303+
get { return (double.IsNegativeInfinity(Real) || double.IsNegativeInfinity(Imag)); }
1304+
}
1305+
12561306
/// <summary>
12571307
/// Returns whether the complex number is finite (i.e. not NaN and not infinity).
12581308
/// </summary>
@@ -2066,6 +2116,20 @@ public static bool IsNaN(ComplexD v)
20662116
public static bool IsInfinity(ComplexD v)
20672117
=> v.IsInfinity;
20682118

2119+
/// <summary>
2120+
/// Returns whether the given <see cref="ComplexD"/> is positive infinity.
2121+
/// </summary>
2122+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
2123+
public static bool IsPositiveInfinity(ComplexD v)
2124+
=> v.IsPositiveInfinity;
2125+
2126+
/// <summary>
2127+
/// Returns whether the given <see cref="ComplexD"/> is negative infinity.
2128+
/// </summary>
2129+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
2130+
public static bool IsNegativeInfinity(ComplexD v)
2131+
=> v.IsNegativeInfinity;
2132+
20692133
/// <summary>
20702134
/// Returns whether the given <see cref="ComplexD"/> is finite (i.e. not NaN and not infinity).
20712135
/// </summary>

src/Aardvark.Base/Math/Base/Complex_template.cs

+32
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,24 @@ public bool IsInfinity
262262
get { return (__ft__.IsInfinity(Real) || __ft__.IsInfinity(Imag)); }
263263
}
264264

265+
/// <summary>
266+
/// Returns whether the complex number has a part that is infinite and positive.
267+
/// </summary>
268+
public bool IsPositiveInfinity
269+
{
270+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
271+
get { return (__ft__.IsPositiveInfinity(Real) || __ft__.IsPositiveInfinity(Imag)); }
272+
}
273+
274+
/// <summary>
275+
/// Returns whether the complex number has a part that is infinite and negative.
276+
/// </summary>
277+
public bool IsNegativeInfinity
278+
{
279+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
280+
get { return (__ft__.IsNegativeInfinity(Real) || __ft__.IsNegativeInfinity(Imag)); }
281+
}
282+
265283
/// <summary>
266284
/// Returns whether the complex number is finite (i.e. not NaN and not infinity).
267285
/// </summary>
@@ -1020,6 +1038,20 @@ public static bool IsNaN(__ct__ v)
10201038
public static bool IsInfinity(__ct__ v)
10211039
=> v.IsInfinity;
10221040

1041+
/// <summary>
1042+
/// Returns whether the given <see cref="__ct__"/> is positive infinity.
1043+
/// </summary>
1044+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1045+
public static bool IsPositiveInfinity(__ct__ v)
1046+
=> v.IsPositiveInfinity;
1047+
1048+
/// <summary>
1049+
/// Returns whether the given <see cref="__ct__"/> is negative infinity.
1050+
/// </summary>
1051+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1052+
public static bool IsNegativeInfinity(__ct__ v)
1053+
=> v.IsNegativeInfinity;
1054+
10231055
/// <summary>
10241056
/// Returns whether the given <see cref="__ct__"/> is finite (i.e. not NaN and not infinity).
10251057
/// </summary>

src/Aardvark.Base/Math/Colors/Color_auto.cs

+128
Original file line numberDiff line numberDiff line change
@@ -6954,6 +6954,24 @@ public bool IsInfinity
69546954
get => AnyInfinity;
69556955
}
69566956

6957+
/// <summary>
6958+
/// Returns true if any component of the color is infinite and positive, false otherwise.
6959+
/// </summary>
6960+
public bool IsPositiveInfinity
6961+
{
6962+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
6963+
get => AnyPositiveInfinity;
6964+
}
6965+
6966+
/// <summary>
6967+
/// Returns true if any component of the color is infinite and negative, false otherwise.
6968+
/// </summary>
6969+
public bool IsNegativeInfinity
6970+
{
6971+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
6972+
get => AnyNegativeInfinity;
6973+
}
6974+
69576975
/// <summary>
69586976
/// Returns whether all components of the color are finite (i.e. not NaN and not infinity).
69596977
/// </summary>
@@ -8020,6 +8038,20 @@ public static bool IsNaN(C3f c)
80208038
public static bool IsInfinity(C3f c)
80218039
=> c.IsInfinity;
80228040

8041+
/// <summary>
8042+
/// Returns whether any component of the the given <see cref="C3f"/> is positive infinity.
8043+
/// </summary>
8044+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
8045+
public static bool IsPositiveInfinity(C3f c)
8046+
=> c.IsPositiveInfinity;
8047+
8048+
/// <summary>
8049+
/// Returns whether any component of the the given <see cref="C3f"/> is negative infinity.
8050+
/// </summary>
8051+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
8052+
public static bool IsNegativeInfinity(C3f c)
8053+
=> c.IsNegativeInfinity;
8054+
80238055
/// <summary>
80248056
/// Returns whether all components of the the given <see cref="C3f"/> are finite (i.e. not NaN and not infinity).
80258057
/// </summary>
@@ -8949,6 +8981,24 @@ public bool IsInfinity
89498981
get => AnyInfinity;
89508982
}
89518983

8984+
/// <summary>
8985+
/// Returns true if any component of the color is infinite and positive, false otherwise.
8986+
/// </summary>
8987+
public bool IsPositiveInfinity
8988+
{
8989+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
8990+
get => AnyPositiveInfinity;
8991+
}
8992+
8993+
/// <summary>
8994+
/// Returns true if any component of the color is infinite and negative, false otherwise.
8995+
/// </summary>
8996+
public bool IsNegativeInfinity
8997+
{
8998+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
8999+
get => AnyNegativeInfinity;
9000+
}
9001+
89529002
/// <summary>
89539003
/// Returns whether all components of the color are finite (i.e. not NaN and not infinity).
89549004
/// </summary>
@@ -10015,6 +10065,20 @@ public static bool IsNaN(C3d c)
1001510065
public static bool IsInfinity(C3d c)
1001610066
=> c.IsInfinity;
1001710067

10068+
/// <summary>
10069+
/// Returns whether any component of the the given <see cref="C3d"/> is positive infinity.
10070+
/// </summary>
10071+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
10072+
public static bool IsPositiveInfinity(C3d c)
10073+
=> c.IsPositiveInfinity;
10074+
10075+
/// <summary>
10076+
/// Returns whether any component of the the given <see cref="C3d"/> is negative infinity.
10077+
/// </summary>
10078+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
10079+
public static bool IsNegativeInfinity(C3d c)
10080+
=> c.IsNegativeInfinity;
10081+
1001810082
/// <summary>
1001910083
/// Returns whether all components of the the given <see cref="C3d"/> are finite (i.e. not NaN and not infinity).
1002010084
/// </summary>
@@ -18472,6 +18536,24 @@ public bool IsInfinity
1847218536
get => AnyInfinity;
1847318537
}
1847418538

18539+
/// <summary>
18540+
/// Returns true if any component of the color is infinite and positive, false otherwise.
18541+
/// </summary>
18542+
public bool IsPositiveInfinity
18543+
{
18544+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
18545+
get => AnyPositiveInfinity;
18546+
}
18547+
18548+
/// <summary>
18549+
/// Returns true if any component of the color is infinite and negative, false otherwise.
18550+
/// </summary>
18551+
public bool IsNegativeInfinity
18552+
{
18553+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
18554+
get => AnyNegativeInfinity;
18555+
}
18556+
1847518557
/// <summary>
1847618558
/// Returns whether all components of the color are finite (i.e. not NaN and not infinity).
1847718559
/// </summary>
@@ -19574,6 +19656,20 @@ public static bool IsNaN(C4f c)
1957419656
public static bool IsInfinity(C4f c)
1957519657
=> c.IsInfinity;
1957619658

19659+
/// <summary>
19660+
/// Returns whether any component of the the given <see cref="C4f"/> is positive infinity.
19661+
/// </summary>
19662+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
19663+
public static bool IsPositiveInfinity(C4f c)
19664+
=> c.IsPositiveInfinity;
19665+
19666+
/// <summary>
19667+
/// Returns whether any component of the the given <see cref="C4f"/> is negative infinity.
19668+
/// </summary>
19669+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
19670+
public static bool IsNegativeInfinity(C4f c)
19671+
=> c.IsNegativeInfinity;
19672+
1957719673
/// <summary>
1957819674
/// Returns whether all components of the the given <see cref="C4f"/> are finite (i.e. not NaN and not infinity).
1957919675
/// </summary>
@@ -20652,6 +20748,24 @@ public bool IsInfinity
2065220748
get => AnyInfinity;
2065320749
}
2065420750

20751+
/// <summary>
20752+
/// Returns true if any component of the color is infinite and positive, false otherwise.
20753+
/// </summary>
20754+
public bool IsPositiveInfinity
20755+
{
20756+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
20757+
get => AnyPositiveInfinity;
20758+
}
20759+
20760+
/// <summary>
20761+
/// Returns true if any component of the color is infinite and negative, false otherwise.
20762+
/// </summary>
20763+
public bool IsNegativeInfinity
20764+
{
20765+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
20766+
get => AnyNegativeInfinity;
20767+
}
20768+
2065520769
/// <summary>
2065620770
/// Returns whether all components of the color are finite (i.e. not NaN and not infinity).
2065720771
/// </summary>
@@ -21754,6 +21868,20 @@ public static bool IsNaN(C4d c)
2175421868
public static bool IsInfinity(C4d c)
2175521869
=> c.IsInfinity;
2175621870

21871+
/// <summary>
21872+
/// Returns whether any component of the the given <see cref="C4d"/> is positive infinity.
21873+
/// </summary>
21874+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
21875+
public static bool IsPositiveInfinity(C4d c)
21876+
=> c.IsPositiveInfinity;
21877+
21878+
/// <summary>
21879+
/// Returns whether any component of the the given <see cref="C4d"/> is negative infinity.
21880+
/// </summary>
21881+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
21882+
public static bool IsNegativeInfinity(C4d c)
21883+
=> c.IsNegativeInfinity;
21884+
2175721885
/// <summary>
2175821886
/// Returns whether all components of the the given <see cref="C4d"/> are finite (i.e. not NaN and not infinity).
2175921887
/// </summary>

src/Aardvark.Base/Math/Colors/Color_template.cs

+32
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,24 @@ public bool IsInfinity
635635
get => AnyInfinity;
636636
}
637637

638+
/// <summary>
639+
/// Returns true if any component of the color is infinite and positive, false otherwise.
640+
/// </summary>
641+
public bool IsPositiveInfinity
642+
{
643+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
644+
get => AnyPositiveInfinity;
645+
}
646+
647+
/// <summary>
648+
/// Returns true if any component of the color is infinite and negative, false otherwise.
649+
/// </summary>
650+
public bool IsNegativeInfinity
651+
{
652+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
653+
get => AnyNegativeInfinity;
654+
}
655+
638656
/// <summary>
639657
/// Returns whether all components of the color are finite (i.e. not NaN and not infinity).
640658
/// </summary>
@@ -1291,6 +1309,20 @@ public static bool IsNaN(__type__ c)
12911309
public static bool IsInfinity(__type__ c)
12921310
=> c.IsInfinity;
12931311

1312+
/// <summary>
1313+
/// Returns whether any component of the the given <see cref="__type__"/> is positive infinity.
1314+
/// </summary>
1315+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1316+
public static bool IsPositiveInfinity(__type__ c)
1317+
=> c.IsPositiveInfinity;
1318+
1319+
/// <summary>
1320+
/// Returns whether any component of the the given <see cref="__type__"/> is negative infinity.
1321+
/// </summary>
1322+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1323+
public static bool IsNegativeInfinity(__type__ c)
1324+
=> c.IsNegativeInfinity;
1325+
12941326
/// <summary>
12951327
/// Returns whether all components of the the given <see cref="__type__"/> are finite (i.e. not NaN and not infinity).
12961328
/// </summary>

0 commit comments

Comments
 (0)