Skip to content

Commit

Permalink
Return -REAL_MAX + PI*i as the volume_complex_log of 0.
Browse files Browse the repository at this point in the history
  • Loading branch information
culler committed Dec 11, 2023
1 parent ca04552 commit e4eb0fa
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions kernel/addl_code/dilog.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,8 +438,14 @@ Complex complex_volume_log(Complex z)
{
Complex result;
if (z.real == 0.0 && z.imag == 0.0) {
result.real = -INFINITY;
result.imag = NAN;
/*
* We return the value returned by complex_log when passed 0 + 0i.
* When complex_volume_log is used to find the volume of a degenerate
* orthoscheme the return value will be multiplied by 0. So any
* legitimate real values can be used, but they cannot be NAN.
*/
result.real = -REAL_MAX;
result.imag = PI;
return result;
}
result.real = 0.5 * log(z.real * z.real + z.imag * z.imag);
Expand Down

0 comments on commit e4eb0fa

Please sign in to comment.