1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-06-16 10:19:58 +00:00

fixed a NAN in rots::formula_exp

This commit is contained in:
Zeno Rogue 2020-08-10 20:20:55 +02:00
parent 6a4d6358fb
commit 0822625cf8

View File

@ -2229,7 +2229,7 @@ EX namespace rots {
if(vel[2] < 0) len = -len;
ld z_part = vel[2]/len;
ld x_part = sqrt(1 - z_part * z_part);
ld x_part = sqrt(max<ld>(1 - z_part * z_part, 0));
ld SV = stretch::not_squared();
@ -2242,6 +2242,8 @@ EX namespace rots {
ld cr = 1 / sqrt(rparam*rparam - 1); // *i
ld sr = rparam * cr; // *i
if(z_part == 0) cr = 0, sr = 1;
ld z = cr * (K - 1/SV/SV); // *i
ld a = len / hypot(sr, cr/SV); // /i