| 392 | struct LogNaturalChecked { |
| 393 | template <typename T, typename Arg> |
| 394 | static enable_if_floating_value<Arg, T> Call(KernelContext*, Arg arg, Status* st) { |
| 395 | static_assert(std::is_same<T, Arg>::value, ""); |
| 396 | if (arg == 0.0) { |
| 397 | *st = Status::Invalid("logarithm of zero"); |
| 398 | return arg; |
| 399 | } else if (arg < 0.0) { |
| 400 | *st = Status::Invalid("logarithm of negative number"); |
| 401 | return arg; |
| 402 | } |
| 403 | return std::log(arg); |
| 404 | } |
| 405 | }; |
| 406 | |
| 407 | struct Log10 { |