diff --git a/adoc/chapters/programming_interface.adoc b/adoc/chapters/programming_interface.adoc index 6a00a8de5..e8db1969a 100644 --- a/adoc/chapters/programming_interface.adoc +++ b/adoc/chapters/programming_interface.adoc @@ -24931,12 +24931,22 @@ The return type is [code]#NonScalar# unless [code]#NonScalar# is the .[apidef]#nan# [source,role=synopsis,id=api:nan] ---- -float nan(std::uint32_t nancode) (1) -double nan(std::uint64_t nancode) (2) -half nan(std::uint16_t nancode) (3) +float nan(std::uint32_t nancode) (1) +double nan(std::uint64_t nancode) (2) +half nan(std::uint16_t nancode) (3) -template (4) +template (4) /*return-type*/ nan(NonScalar nancode) + +float nan(const char* nancode) (5) +double nan(const char* nancode) (6) +half nan(const char* nancode) (7) + +template (8) +vec nan(std::array nancode) + +template (9) +marray nan(std::array nancode) ---- *Overloads (1) - (3):* @@ -24978,6 +24988,42 @@ The return type depends on [code]#NonScalar#: @[code]#vec# |==== +*Overloads (5) - (7):* + +_Returns:_ A quiet NaN. +The [code]#nancode# is used in an implementation-defined manner to populate the +significand of the resulting NaN, as with [code]#std::nanf#, [code]#std::nan#, +or the equivalent for [code]#half# precision respectively. + +*Overloads (8) - (9):* + +_Constraints:_ Available only if [code]#T# is [code]#float#, [code]#double#, or +[code]#half#. + +_Returns:_ A quiet NaN for each element. +Each [code]#nancode[i]# is used in an implementation-defined manner to populate +the significand of the resulting NaN for that element, as with [code]#std::nanf# +or [code]#std::nan# for the corresponding element type. + +[NOTE] +==== +Overloads (5) - (9) align [code]#sycl::nan# with [code]#std::nan#, +[code]#std::nanf#, and [code]#std::nanl#, which take a [code]#const char*# +argument. +Unlike overloads (1) - (4), which allow placing a specific bit pattern in the +NaN significand, overloads (5) - (9) produce a NaN whose significand is +populated in an implementation-defined manner based on the string argument. +For overloads (8) - (9), the template parameter [code]#T# must be specified +explicitly since it cannot be deduced from the [code]#std::array# argument alone. +For example: +[source,c++] +---- +auto v = sycl::nan(std::array{"", "", "", ""}); +auto m = sycl::nan(std::array{"", "", "", ""}); +---- +==== + ''' .[apidef]#nextafter#