std:: fmin, std:: fminf, std:: fminl
|
定义于头文件
<cmath>
|
||
| (1) | ||
|
float
fmin
(
float
x,
float
y
)
;
double
fmin
(
double
x,
double
y
)
;
|
(C++23 前) | |
|
constexpr
/*floating-point-type*/
fmin
(
/*floating-point-type*/
x,
|
(C++23 起) | |
|
float
fminf
(
float
x,
float
y
)
;
|
(2) |
(C++11 起)
(C++23 起为 constexpr) |
|
long
double
fminl
(
long
double
x,
long
double
y
)
;
|
(3) |
(C++11 起)
(C++23 起为 constexpr) |
|
SIMD 重载
(C++26 起)
|
||
|
定义于头文件
<simd>
|
||
|
template
<
class
V0,
class
V1
>
constexpr
/*math-common-simd-t*/
<
V0, V1
>
|
(S) | (C++26 起) |
|
附加重载
(C++11 起)
|
||
|
定义于头文件
<cmath>
|
||
|
template
<
class
Integer
>
double fmin ( Integer x, Integer y ) ; |
(A) | (C++23 起为 constexpr) |
std::fmin
的重载作为参数类型。
(since C++23)
|
S)
SIMD 重载对
v_x
和
v_y
执行逐元素的
std::fmin
运算。
|
(since C++26) |
|
A)
为所有整数类型提供了额外的重载,这些类型被视为
double
。
|
(since C++11) |
内容参数
返回值如果成功,返回两个浮点值中的较小值。返回值是精确的,且不依赖于任何舍入模式。 错误处理此函数不受 math_errhandling 中指定的任何错误条件约束。 如果实现支持 IEEE 浮点算术 (IEC 60559),
注释此函数不要求对零的符号敏感,尽管某些实现额外规定:如果一个参数是 + 0 而另一个是 - 0 ,则返回 - 0 。 额外的重载并不需要完全按照 (A) 的形式提供。只需确保对于它们的第一个参数 num1 和第二个参数 num2 满足以下条件:
示例
运行此代码
可能的输出: fmin(2,1) = 1 fmin(-Inf,0) = -inf fmin(NaN,-1) = -1 另见
| |||||||||||||||||||||||||