瀏覽代碼

Add a sign() function for real numbers.

wip/image-kernel
Sam Hocevar 4 年之前
父節點
當前提交
37d6d2f18a
共有 2 個檔案被更改,包括 6 行新增0 行删除
  1. +1
    -0
      include/lol/private/types/real.h
  2. +5
    -0
      include/lol/private/types/real.ipp

+ 1
- 0
include/lol/private/types/real.h 查看文件

@@ -157,6 +157,7 @@ public:
template<typename U> friend real_t<U> fract(real_t<U> const &x);
template<typename U> friend real_t<U> degrees(real_t<U> const &x);
template<typename U> friend real_t<U> radians(real_t<U> const &x);
template<typename U> friend int sign(real_t<U> const &x);

// Additional functions
template<typename U> friend real_t<U> franke(real_t<U> const &x,


+ 5
- 0
include/lol/private/types/real.ipp 查看文件

@@ -1007,6 +1007,11 @@ template<typename T> real_t<T> radians(real_t<T> const &x)
return x * mul;
}

template<typename T> int sign(real_t<T> const &x)
{
return x.is_zero() ? 0 : x.is_negative() ? -1 : 1;
}

template<typename T> real_t<T> fast_log(real_t<T> const &x)
{
/* This fast log method is tuned to work on the [1..2] range and


Loading…
取消
儲存