Skip to content

Commit d14c681

Browse files
authored
tighten language for NaN to integer conversions (#1546)
1 parent 31ac208 commit d14c681

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

OpenCL_C.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1804,13 +1804,13 @@ specified by <<C99-spec,section 6.3 of the C99 Specification>>.
18041804
When converting from a floating-point type to integer type, the behavior is
18051805
implementation-defined.
18061806

1807-
Conversions to integer type may opt to convert using the optional saturated
1807+
Conversions to integer types may opt to convert using the optional saturated
18081808
mode by appending the `_sat` modifier to the conversion function name.
18091809
When in saturated mode, values that are outside the representable range
1810-
shall clamp to the nearest representable value in the destination format.
1811-
(NaN should be converted to 0).
1810+
are clamped to the nearest representable value in the destination format,
1811+
and NaN is converted to zero.
18121812

1813-
Conversions to floating-point type shall conform to IEEE-754 rounding rules.
1813+
Conversions to floating-point types conform to IEEE-754 rounding rules.
18141814
The `_sat` modifier may not be used for conversions to floating-point
18151815
formats.
18161816

@@ -1824,7 +1824,7 @@ Example 1:
18241824
----------
18251825
short4 s;
18261826

1827-
// negative values clamped to 0
1827+
// negative values clamped to zero
18281828
ushort4 u = convert_ushort4_sat( s );
18291829

18301830
// values > CHAR_MAX converted to CHAR_MAX
@@ -1843,7 +1843,7 @@ float4 f;
18431843
int4 i = convert_int4( f );
18441844

18451845
// values > INT_MAX clamp to INT_MAX, values < INT_MIN clamp
1846-
// to INT_MIN. NaN should produce 0.
1846+
// to INT_MIN, and NaN is converted to zero
18471847
// The _rtz_ rounding mode is used to produce the integer values.
18481848
int4 i2 = convert_int4_sat( f );
18491849

man/static/convert_T.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,13 @@ specified by <<C99-spec,section 6.3 of the C99 Specification>>.
139139
When converting from a floating-point type to integer type, the behavior is
140140
implementation-defined.
141141

142-
Conversions to integer type may opt to convert using the optional saturated
142+
Conversions to integer types may opt to convert using the optional saturated
143143
mode by appending the _sat modifier to the conversion function name.
144144
When in saturated mode, values that are outside the representable range
145-
shall clamp to the nearest representable value in the destination format.
146-
(NaN should be converted to 0).
145+
are clamped to the nearest representable value in the destination format,
146+
and NaN is converted to zero.
147147

148-
Conversions to floating-point type shall conform to IEEE-754 rounding rules.
148+
Conversions to floating-point types conform to IEEE-754 rounding rules.
149149
The `_sat` modifier may not be used for conversions to floating-point
150150
formats.
151151

@@ -159,7 +159,7 @@ Example 1:
159159
----------
160160
short4 s;
161161

162-
// negative values clamped to 0
162+
// negative values clamped to zero
163163
ushort4 u = convert_ushort4_sat( s );
164164

165165
// values > CHAR_MAX converted to CHAR_MAX
@@ -178,7 +178,7 @@ float4 f;
178178
int4 i = convert_int4( f );
179179

180180
// values > INT_MAX clamp to INT_MAX, values < INT_MIN clamp
181-
// to INT_MIN. NaN should produce 0.
181+
// to INT_MIN, and NaN is converted to zero
182182
// The _rtz_ rounding mode is used to produce the integer values.
183183
int4 i2 = convert_int4_sat( f );
184184

0 commit comments

Comments
 (0)