c语言 函数的参数传递示例_isunordered()函数与C ++中的示例
c语言 函数的参数传递示例
C ++ isunordered()函数 (C++ isunordered() function)
isunordered() function is a library function of cmath header, it is used to check whether the given values are unordered (if one or both values are Not-A-Number (NaN)), then they are unordered values). It accepts two values (float, double or long double) and returns 1 if the given values are unordered; 0, otherwise.
isunordered()函数是cmath标头的库函数,用于检查给定值是否无序(如果一个或两个值均为非数字(NaN),则它们为无序值)。 它接受两个值( float , double或long double ),如果给定的值是无序的,则返回1;否则,返回1。 0,否则。
Syntax of isunordered() function:
isunordered()函数的语法:
In C99, it has been implemented as a macro,
在C99中,它已实现为宏,
macro isunordered(x, y)
In C++11, it has been implemented as a function,
在C ++ 11中,它已作为函数实现,
bool isunordered (float x, float y);
bool isunordered (double x, double y);
bool isunordered (long double x, long double y);
Parameter(s):
参数:
x, y – represent the values to be checked as unordered.
x,y –表示要检查的值是否为无序。
Return value:
返回值:
The returns type of this function is bool, it returns 1 if one or both arguments are NaN; 0, otherwise.
该函数的返回类型为bool ,如果一个或两个参数均为NaN,则返回1;否则返回0。 0,否则。
Example:
例:
Input:
float x = sqrt(-1.0f);
float y = 10.0f;
Function call:
isunordered(x, y);
Output:
1
Input:
float x = 1.0f;
float y = 10.0f;
Function call:
isunordered(x, y);
Output:
0
C ++代码演示isunordered()函数的示例 (C++ code to demonstrate the example of isunordered() function)
// C++ code to demonstrate the example of
// isunordered() function
#include <iostream>
#include <cmath>
using namespace std;
int main()
{cout << "isunordered(-5.0f, -2.0f): " << isunordered(-5.0f, -2.0f) << endl;
cout << "isunordered(sqrt(-1.0f), sqrt(-2.0f)): " << isunordered(sqrt(-1.0f), sqrt(-2.0f)) << endl;
cout << "isunordered(10.0f, sqrt(-1.0f)): " << isunordered(10.0f, sqrt(-1.0f)) << endl;
cout << "isunordered(sqrt(-1.0f), 1.0f): " << isunordered(sqrt(-1.0f), 1.0f) << endl;
float x = 10.0f;
float y = 5.0f;
// checking using the condition
if (isunordered(x, y)) {cout << x << "," << y << " are unordered." << endl;
}
else {cout << x << "," << y << " are not unordered." << endl;
}
x = 10.0f;
y = sqrt(-1.0f);
if (isunordered(x, y)) {cout << x << "," << y << " are unordered." << endl;
}
else {cout << x << "," << y << " are unordered." << endl;
}
return 0;
}
Output
输出量
isunordered(-5.0f, -2.0f): 0
isunordered(sqrt(-1.0f), sqrt(-2.0f)): 1
isunordered(10.0f, sqrt(-1.0f)): 1
isunordered(sqrt(-1.0f), 1.0f): 1
10,5 are not unordered.
10,-nan are unordered.
Reference: C++ isunordered() function
参考: C ++ isunordered()函数
翻译自: https://www.includehelp.com/cpp-tutorial/isunordered-function-with-example.aspx
c语言 函数的参数传递示例
c语言 函数的参数传递示例_isunordered()函数与C ++中的示例相关推荐
- 函数指针(函数作为参数传递给其他函数)
函数也有地址,函数的地址是存储其机器码的内存的开始的地址,并且函数的地址就是其函数名.因此我们可以将函数作为参数传递给其他函数.正如python中可以将函数轻易的传递给其他函数一样,但是C++中形式上 ...
- 【Groovy】Groovy 方法调用 ( Groovy 构造函数中为成员赋值 | Groovy 函数的参数传递与键值对参数 | 完整代码示例 )
文章目录 一.Groovy 构造函数中为成员赋值 二.Groovy 函数的参数传递与键值对参数 三.完整代码示例 一.Groovy 构造函数中为成员赋值 Groovy 类没有定义构造函数 , 但是可以 ...
- 20 Python函数、定义一个函数、参数传递、匿名函数、return语句、变量作用域、
20Python函数 函数是组织好的,可重复使用的,用来实现单一,或相关联功能的代码段. 函数能提高应用的模块性,和代码的重复利用率.你已经知道Python提供了许多内建函数,比如print().但你 ...
- C++中函数作为参数传递给其他函数
简单的说,如果有函数的参数声明为函数指针类型的.则可以给函数传入另一个函数作为它的参数,在函数的内部可以调用传入的函数: 例如下面给一些例子: int add(int x, int y) // 定义函 ...
- python函数关键字参数传递_Python给函数传递不定关键字的参数
转载请注明来自公众号『数据挖掘机养成记』 前言 在上一篇文章『[Python]给函数传递不定个数的参数』中,我们主要讲解了*在函数定义和函数调用阶段的不同作用,并留了一个小问题: 我们用*定义了add ...
- scala语言示例_var关键字与Scala中的示例
scala语言示例 Scala var关键字 (Scala var keyword) The var Keyword in scala is used to declare variables. As ...
- R语言笔记7:functions——编写函数所需的基础知识
上一讲通过三个简单的例子体验了一下如何在R中写函数,下面来详细学习有关R语言中函数的知识. Functions in R 主要分三个部分来讲解函数: 编写函数所需的基础知识 相关语法作用域 R语言作用 ...
- python函数定义及调用-python函数的定义和调用 | 酷python
python函数的定义与调用 在python中 ,函数是一个组织好的 ,可以重复使用的代码段 ,函数可以提高代码的重复利用率 ,原则上一个函数只实现一个单一的功能 ,这样能增强程序的模块性, pyth ...
- 阻塞式回调函数和延迟式回调函数
首先,有三种函数: 起始函数:大致可以等同于主函数 中间函数:中间函数把回调函数作为参数传递执行 回调函数:一个有独立功能的函数 怎么理解: 你到一个商店买东西,刚好你要的东西没有货,于是你在店员那里 ...
最新文章
- 复习计算机网络day1-计算机网络的初步了解
- AI战“疫”!人工智能在疫情中的重要作用
- SQL 根据身份证号码获取年龄的函数
- readyboost提升明显吗_iphone12promax参数对比11ProMax区别 性能提升多少
- Vue基础之Vue条件渲染
- 1281. 整数的各位积和之差
- indexOf 和 lastIndexOf 使用
- 深海迷航坐标传送代码_《深海迷航》秘籍代码怎么用及深海迷航代码大全
- 学python多长时间、才能做点东西_如果只有1小时学Python,看这篇就够了
- thinkphp5项目--个人博客(五)
- 弹性云服务器是什么意思?弹性体现在哪里
- 机器视觉系统不同检测场景的光源选择技巧
- C#获取网页的HTML码、下载网站图片
- 机器翻译中的古汉语现代汉语句子对齐研究
- 家用pc游戏菜单_为什么仍然必须登录到家用PC?
- 鸿蒙开源第三方组件——ANR异常监测组件 ANR-WatchDog-ohos
- 批量加密pdf方法(完全免费)
- Python车牌的正则表达式
- vue-cli中css引入图片打包路径问题
- Android之解压缩ramdisk文件系统
热门文章
- hdu1962Corporative Network带权回路
- 输入分钟输出小时python_输出键,值对如何使1小时内的时间在使用Python的MapReduce中的reducer中结束?...
- pyspark sparksession_PySpark 处理数据和数据建模
- ad电阻原理图_【雕爷学编程】Arduino动手做(2)---光敏电阻模块
- Linux 修改用户名的主目录 家目录
- @SpringBootApplication揭秘
- 前端错误日志收集方案
- AOE网与关键路径简介
- 五阿哥钢铁电商平台Docker容器云平台建设实践——你想知道的都在这里!
- 小程序 - swiper除了左右切换还有上下滚动超出屏幕的内容