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
@ -2957,25 +2957,31 @@ EX hyperpoint lie_exp(hyperpoint h) {
|
||||
h[3] = 1;
|
||||
h[2] += h[0] * h[1] / 2;
|
||||
}
|
||||
else if(sol) {
|
||||
else if(sol && !nih) {
|
||||
h[3] = 1;
|
||||
if(abs(h[2]) > 1e-6) {
|
||||
h[0] *= (exp(-h[2]) - 1) / -h[2];
|
||||
h[1] *= (exp(+h[2]) - 1) / h[2];
|
||||
}
|
||||
}
|
||||
else if(sol && nih) {
|
||||
h[3] = 1;
|
||||
if(abs(h[2]) > 1e-6) {
|
||||
ld z = h[2] * log(2);
|
||||
h[0] *= (exp(-z) - 1) / -z;
|
||||
z = h[2] * log(3);
|
||||
h[1] *= (exp(+z) - 1) / z;
|
||||
}
|
||||
}
|
||||
else if(nih) {
|
||||
h[3] = 1;
|
||||
if(abs(h[2]) > 1e-6) {
|
||||
ld z = h[2] * log(2);
|
||||
h[0] *= (exp(+z) - 1) / z;
|
||||
z = h[2] * log(3);
|
||||
h[1] *= (exp(+z) - 1) / z;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* not implemented -- approximate for now */
|
||||
const int steps = 16;
|
||||
|
Loading…
Reference in New Issue
Block a user