mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-05-15 05:34:08 +00:00
nicer print for cld
This commit is contained in:
parent
ee6b500822
commit
ea8a3ea7d2
16
hprint.cpp
16
hprint.cpp
@ -279,7 +279,21 @@ struct indenter_finish : indenter {
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
EX void print(hstream& hs, cld x) { print(hs, real(x)); if(kz(imag(x))) print(hs, "+", imag(x), "i"); }
|
EX void print(hstream& hs, cld x) {
|
||||||
|
int parts = 0;
|
||||||
|
if(kz(real(x))) {
|
||||||
|
print(hs, real(x));
|
||||||
|
parts++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(kz(imag(x))) {
|
||||||
|
if(parts && imag(x) > 0) print(hs, "+");
|
||||||
|
parts++;
|
||||||
|
print(hs, imag(x), "i");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!parts) print(hs, 0);
|
||||||
|
}
|
||||||
|
|
||||||
EX string fts_fixed(ld x, int prec IS(6)) {
|
EX string fts_fixed(ld x, int prec IS(6)) {
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user