mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-11 18:00:34 +00:00
fixed lie_exp to use correct rules in solnih, and also avoid division by h[2] == 0
This commit is contained in:
parent
b9fd64e1d9
commit
69a82a8ce1
28
hypgraph.cpp
28
hypgraph.cpp
@ -2957,24 +2957,30 @@ EX hyperpoint lie_exp(hyperpoint h) {
|
|||||||
h[3] = 1;
|
h[3] = 1;
|
||||||
h[2] += h[0] * h[1] / 2;
|
h[2] += h[0] * h[1] / 2;
|
||||||
}
|
}
|
||||||
else if(sol) {
|
else if(sol && !nih) {
|
||||||
h[3] = 1;
|
h[3] = 1;
|
||||||
h[0] *= (exp(-h[2]) - 1) / -h[2];
|
if(abs(h[2]) > 1e-6) {
|
||||||
h[1] *= (exp(+h[2]) - 1) / h[2];
|
h[0] *= (exp(-h[2]) - 1) / -h[2];
|
||||||
|
h[1] *= (exp(+h[2]) - 1) / h[2];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if(sol && nih) {
|
else if(sol && nih) {
|
||||||
h[3] = 1;
|
h[3] = 1;
|
||||||
ld z = h[2] * log(2);
|
if(abs(h[2]) > 1e-6) {
|
||||||
h[0] *= (exp(-z) - 1) / -z;
|
ld z = h[2] * log(2);
|
||||||
z = h[2] * log(3);
|
h[0] *= (exp(-z) - 1) / -z;
|
||||||
h[1] *= (exp(+z) - 1) / z;
|
z = h[2] * log(3);
|
||||||
|
h[1] *= (exp(+z) - 1) / z;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if(nih) {
|
else if(nih) {
|
||||||
h[3] = 1;
|
h[3] = 1;
|
||||||
ld z = h[2] * log(2);
|
if(abs(h[2]) > 1e-6) {
|
||||||
h[0] *= (exp(+z) - 1) / z;
|
ld z = h[2] * log(2);
|
||||||
z = h[2] * log(3);
|
h[0] *= (exp(+z) - 1) / z;
|
||||||
h[1] *= (exp(+z) - 1) / z;
|
z = h[2] * log(3);
|
||||||
|
h[1] *= (exp(+z) - 1) / z;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* not implemented -- approximate for now */
|
/* not implemented -- approximate for now */
|
||||||
|
Loading…
Reference in New Issue
Block a user