1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-22 08:10:40 +00:00

utilities:: kz

This commit is contained in:
Zeno Rogue 2019-07-28 11:13:04 +02:00
parent 7ba8b2d680
commit 0054dbc118

View File

@ -283,4 +283,25 @@ string parser_help() {
}
logger hlog;
// kz: utility for printing
// if it is close to 0, assume it is floating errors
ld kz(ld x) {
if(abs(x) < 1e-6) return 0;
return x;
}
hyperpoint kz(hyperpoint h) {
for(int d=0; d<MAXMDIM; d++) h[d] = kz(h[d]);
return h;
}
transmatrix kz(transmatrix h) {
for(int d=0; d<MAXMDIM; d++)
for(int e=0; e<MAXMDIM; e++)
h[d][e] = kz(h[d][e]);
return h;
}
}