mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-11 18:00:34 +00:00
arcm:: no longer crashes with divby0 on some incorrect strings
This commit is contained in:
parent
2958564622
commit
1fe234fe75
@ -1177,12 +1177,14 @@ string archimedean_tiling::world_size() {
|
|||||||
}
|
}
|
||||||
anom *= 2 * denom, adenom *= nom;
|
anom *= 2 * denom, adenom *= nom;
|
||||||
int g = gcd(anom, adenom);
|
int g = gcd(anom, adenom);
|
||||||
|
if(g != 0) {
|
||||||
anom /= g; adenom /= g;
|
anom /= g; adenom /= g;
|
||||||
|
}
|
||||||
if(adenom < 0) anom = -anom, adenom = -adenom;
|
if(adenom < 0) anom = -anom, adenom = -adenom;
|
||||||
string s;
|
string s;
|
||||||
bool hyp = (anom < 0);
|
bool hyp = (anom < 0);
|
||||||
if(hyp) anom = -anom;
|
if(hyp) anom = -anom;
|
||||||
if(adenom > 1)
|
if(adenom != 1)
|
||||||
s += its(anom) + "/" + its(adenom);
|
s += its(anom) + "/" + its(adenom);
|
||||||
else
|
else
|
||||||
s += its(anom);
|
s += its(anom);
|
||||||
|
Loading…
Reference in New Issue
Block a user