| 420 | struct Log10Checked { |
| 421 | template <typename T, typename Arg> |
| 422 | static enable_if_floating_value<Arg, T> Call(KernelContext*, Arg arg, Status* st) { |
| 423 | static_assert(std::is_same<T, Arg>::value, ""); |
| 424 | if (arg == 0) { |
| 425 | *st = Status::Invalid("logarithm of zero"); |
| 426 | return arg; |
| 427 | } else if (arg < 0) { |
| 428 | *st = Status::Invalid("logarithm of negative number"); |
| 429 | return arg; |
| 430 | } |
| 431 | return std::log10(arg); |
| 432 | } |
| 433 | }; |
| 434 | |
| 435 | struct Log2 { |