当前位置: 首页 > news >正文

dreamweaver做网站教程百度应用商店下载安装

dreamweaver做网站教程,百度应用商店下载安装,河南企业网络推广方法,排版设计技巧常用数学函数 对给定的浮点值分类 std::fpclassify 定义于头文件 <math.h> #define fpclassify(arg) /* implementation defined */ (C99 起) 归类浮点值 arg 到下列类别中&#xff1a;零、非正规、正规、无穷大、 NaN 或实现定义类别。该宏返回整数值。 忽略 FLT_EV…

常用数学函数

对给定的浮点值分类

std::fpclassify

定义于头文件 <math.h>

#define fpclassify(arg) /* implementation defined */

(C99 起)

归类浮点值 arg 到下列类别中:零、非正规、正规、无穷大、 NaN 或实现定义类别。该宏返回整数值。

忽略 FLT_EVAL_METHOD :即使以多于参数类型的范围和精度对它求值,首先仍将它转换到其语义类型,然后分类基于该类型:正规的 long double 值可能在转换到 double 时变为非正规,而在转换到 float 时变为零。

参数

arg-浮点值

返回值

指明 arg 类别的 FP_INFINITE 、 FP_NAN 、 FP_NORMAL 、 FP_SUBNORMAL 、 FP_ZERO 或实现定义类型之一。

#define FP_NAN		0x0100
#define FP_NORMAL	0x0400
#define FP_INFINITE	(FP_NAN | FP_NORMAL)
#define FP_ZERO		0x4000
#define FP_SUBNORMAL	(FP_NORMAL | FP_ZERO)

可能实现

namespace GGX
{
using namespace std;
constexpr int
fpclassify(float __x)
{return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,FP_SUBNORMAL, FP_ZERO, __x);
}constexpr int
fpclassify(double __x)
{return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,FP_SUBNORMAL, FP_ZERO, __x);
}constexpr int
fpclassify(long double __x)
{return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,FP_SUBNORMAL, FP_ZERO, __x);
}template<typename _Tp>
constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,int>::__typefpclassify(_Tp __x)
{return __x != 0 ? FP_NORMAL : FP_ZERO;
}
}

调用示例

#include <iostream>
#include <cstdlib>
#include <typeinfo>
#include <cinttypes>
#include <cmath>
#include <math.h>
#include <tgmath.h>
#include <stdio.h>
#include <math.h>
#include <float.h>const char *show_classification(double x)
{//归类浮点值 arg 到下列类别中:零、非正规、正规、无穷大、 NaN 或实现定义类别。switch (std::fpclassify(x)){case FP_INFINITE:return "Inf";case FP_NAN:return "NaN";case FP_NORMAL:return "normal";case FP_SUBNORMAL:return "subnormal";case FP_ZERO:return "zero";default:return "unknown";}
}int main(void)
{std::cout << "show_classification(1.0/0.0) is " << show_classification(1 / 0.0) << std::endl;std::cout << "show_classification(0.0/0.0) is is " << show_classification(0.0 / 0.0) << std::endl;std::cout << "show_classification(DBL_MIN/2) is is " << show_classification(DBL_MIN / 2) << std::endl;std::cout << "show_classification(-0.0 is is) " << show_classification(-0.0) << std::endl;std::cout << "show_classification(1.0 is is) " << show_classification(1.0) << std::endl;std::cout << std::endl;std::cout << "std::fpclassify(1.0/0.0) is " << std::fpclassify(1 / 0.0) << std::endl;std::cout << "std::fpclassify(0.0/0.0) is is " << std::fpclassify(0.0 / 0.0) << std::endl;std::cout << "std::fpclassify(DBL_MIN/2) is is " << std::fpclassify(DBL_MIN / 2) << std::endl;std::cout << "std::fpclassify(-0.0) is " << std::fpclassify(-0.0) << std::endl;std::cout << "std::fpclassify(1.0) is " << std::fpclassify(1.0) << std::endl;std::cout << std::endl;std::cout << std::hex;std::cout << "std::fpclassify(1.0/0.0) is " << std::fpclassify(1 / 0.0) << std::endl;std::cout << "std::fpclassify(0.0/0.0) is is " << std::fpclassify(0.0 / 0.0) << std::endl;std::cout << "std::fpclassify(DBL_MIN/2) is is " << std::fpclassify(DBL_MIN / 2) << std::endl;std::cout << "std::fpclassify(-0.0) is " << std::fpclassify(-0.0) << std::endl;std::cout << "std::fpclassify(1.0) is " << std::fpclassify(1.0) << std::endl;std::cout << std::endl;printf("show_classification(1.0/0.0) is %s\n", show_classification(1 / 0.0));printf("show_classification(0.0/0.0) is %s\n", show_classification(0.0 / 0.0));printf("show_classification(DBL_MIN/2) is %s\n", show_classification(DBL_MIN / 2));printf("show_classification(-0.0) is %s\n", show_classification(-0.0));printf("show_classification(1.0) is %s\n", show_classification(1.0));std::cout << std::endl;return 0;
}

输出

show_classification(1.0/0.0) is Inf
show_classification(0.0/0.0) is is NaN
show_classification(DBL_MIN/2) is is subnormal
show_classification(-0.0 is is) zero
show_classification(1.0 is is) normalstd::fpclassify(1.0/0.0) is 1280
std::fpclassify(0.0/0.0) is is 256
std::fpclassify(DBL_MIN/2) is is 17408
std::fpclassify(-0.0) is 16384
std::fpclassify(1.0) is 1024std::fpclassify(1.0/0.0) is 500
std::fpclassify(0.0/0.0) is is 100
std::fpclassify(DBL_MIN/2) is is 4400
std::fpclassify(-0.0) is 4000
std::fpclassify(1.0) is 400show_classification(1.0/0.0) is Inf
show_classification(0.0/0.0) is NaN
show_classification(DBL_MIN/2) is subnormal
show_classification(-0.0) is zero
show_classification(1.0) is normal

http://www.hrbkazy.com/news/50409.html

相关文章:

  • 帝国cms灵动标签做网站地图网站推广在线
  • 淘宝客怎么做自己的网站怎么搞自己的网站
  • 做移动网站优化软件南京最新消息今天
  • 阜南网站建设神马网站快速排名案例
  • o元做网站销售管理软件
  • 长春做网站选长春万网第三方网络营销平台有哪些
  • 做外卖网站网站seo的主要优化内容
  • 邀人做任务比较好的发布网站东莞百度seo在哪里
  • 直销模式和分销模式关键词优化排名第一
  • 杭州做网站好的公司在线友情链接
  • wordpress下载环境合肥seo管理
  • 佛山微信网站建设多少钱爱用建站官网
  • 程序员开源网站引擎搜索大全
  • 网站编辑工作内容网络营销的方法
  • wordpress主题 百度云seo网站推广首页排名
  • 用电脑做网站服务器百度电商平台app
  • 网站推广意识薄弱图片seo优化是什么意思
  • 网站建设合同图片海口关键词优化报价
  • 丽水专业网站建设哪家好商城小程序
  • 北京网站备案要求吗seo推广培训资料
  • 做网站java步骤百度网站流量查询
  • 郑州网站制作营销推广赚钱的软件
  • 自己做鞋子网站市场调研报告总结
  • 怎么做网站规划书百度客户端电脑版
  • 武汉网站建设的公司哪家好什么是淘宝seo
  • 网站开发html文件规范百度搜索引擎seo
  • 优秀企业网站设计要点友情链接交易购买
  • 江门城乡建设局官方网站做seo排名好的公司
  • 软件工程最吃香的三个专业win7优化工具
  • 什么网站专门做境外当地游seo网站培训班