fnmath.hpp

来自「浮点数基本运算 浮点数的基本运算主要有四则运算、符号处理、大小比较」· HPP 代码 · 共 52 行

HPP
52
字号
// Float number math implementation -*- C++ -*-

// Copyright (C) 2005 Ben T. Bear
//
// This file is published under GNU GPL 2.0. See more in "copy.hpp".

// #include "copy.hpp"

#ifndef __bt2il_fn_math_hpp
#define __bt2il_fn_math_hpp

#include "fn.hpp"
#include "fnexp.hpp"

namespace btil
{
  namespace fn
  {
    template <int n>
    struct factorial;

    template <typename a, typename q, int n>
    struct geometric;


    
    
    template <int n>
    struct factorial
    {
      struct value
      {
	static const double f_val = __factorial<n>::f_val;
      };
    };



    template <typename a, typename q, int n>
    struct geometric
    {
      struct value
      {
	static const double f_val = (a::f_val * (1 - pow_n<q, n>::value::f_val)
				     / (1 - q::f_val));
      };
    };
  }
}

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?