Skip to content

Commit 69c438b

Browse files
committed
add factory methods
1 parent 61faa87 commit 69c438b

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/main/java/net/jamu/complex/Zd.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2018, 2021 Stefan Zobel
2+
* Copyright 2018, 2025 Stefan Zobel
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -133,4 +133,10 @@ public interface Zd {
133133
* @since 1.3
134134
*/
135135
String toString(String format);
136+
137+
static Zd NaN() {return new ZdImpl(Double.NaN, Double.NaN);}
138+
static Zd Inf() {return new ZdImpl(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY);}
139+
static Zd Zero() {return new ZdImpl(0.0, 0.0);}
140+
static Zd One() {return new ZdImpl(1.0, 0.0);}
141+
static Zd I() {return new ZdImpl(0.0, 1.0);}
136142
}

src/main/java/net/jamu/complex/Zf.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2018, 2021 Stefan Zobel
2+
* Copyright 2018, 2025 Stefan Zobel
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -133,4 +133,10 @@ public interface Zf {
133133
* @since 1.3
134134
*/
135135
String toString(String format);
136+
137+
static Zf NaN() {return new ZfImpl(Float.NaN, Float.NaN);}
138+
static Zf Inf() {return new ZfImpl(Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY);}
139+
static Zf Zero(){return new ZfImpl(0.0f, 0.0f);}
140+
static Zf One() {return new ZfImpl(1.0f, 0.0f);}
141+
static Zf I() {return new ZfImpl(0.0f, 1.0f);}
136142
}

0 commit comments

Comments
 (0)