Timeline for How to numerically compute $x \ln x$ and related functions near $0$?
Current License: CC BY-SA 4.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Feb 22, 2022 at 9:29 | comment | added | Brendan McKay | @rych It's complicated, see the glibc example at code.woboq.org/userspace/glibc/sysdeps/ieee754/dbl-64/… The implementers work hard to obtain the best accuracy for all possible arguments. | |
Feb 22, 2022 at 6:11 | comment | added | rych | Thanks, @Brendan. Perhaps we should dig out how $\log$ is actually implemented in various standard math C libraries, for small arguments perhaps even the method mentioned in Carlo's answer... and then modify accordingly to for the desired $x\log x$ avoiding uncertainty and errors | |
Feb 20, 2022 at 9:40 | vote | accept | FusRoDah | ||
Feb 20, 2022 at 2:11 | history | edited | Brendan McKay | CC BY-SA 4.0 |
buzzwords
|
Feb 20, 2022 at 1:38 | comment | added | Brendan McKay | I tried a few systems and some give ${+}NaN$ rather than ${-}NaN$. Some computers (not sure which) don't even have NaN values. All the more reason for the programmer to test for $x=0$ explicitly. | |
Feb 20, 2022 at 1:10 | comment | added | Brendan McKay | @rych For the most common combination of floating-point format and library, log(0.0) evaluates as ${-}\infty$, which is a special floating-point value. Then multiplying by 0.0 gives ${-}$NaN which is another special value that means "Not a Number". The moral is that the programmer should take responsibility for the case $x=0$ and provide 0.0 as the answer. | |
Feb 19, 2022 at 15:03 | comment | added | rych | What happens when we try to evaluate $x\log x$ at $x=0.0$ or do you have the if-case $x==0.0$ then output $0.0$? | |
Feb 19, 2022 at 5:07 | history | edited | Brendan McKay | CC BY-SA 4.0 |
added 94 characters in body
|
Feb 19, 2022 at 4:59 | history | answered | Brendan McKay | CC BY-SA 4.0 |