Clarify conversions: floating, and out-of-range AbstractInt - #2773
Merged
Merged
Conversation
Conversion Rank table:
* Last column is now "Description", not "Notes". So it's more clearly normative.
* AbstractInt to scalar integral conversions says it's identity when value is in
range of the target type, and shader-creation error otherwise.
* Reference floating point conversion section where needed.
Floating point conversion
* Rewrite the "out of taget range" clauses as a procedure.
This allows us to cleanly handle:
- optional truncation of mantissa bits
- the case where the source type is integral. This can occur now
with i32 or u32 as source type and f16 as target type (whose max
normal value is 65504).
Fixes: gpuweb#2769
Contributor
Contributor
WGSL meeting minutes 2022-04-26
|
Contributor
Author
|
Ping @kdashg :-) |
We don't want one of the adjacent value to be an infinity. For example, twice the max finite value of the destination type should be converted to the infinity of the destination type.
Contributor
WGSL meeting minutes 2022-05-10
|
kdashg
approved these changes
May 13, 2022
jdarpinian
pushed a commit
to jdarpinian/gpuweb
that referenced
this pull request
Aug 12, 2022
) * Clarify conversions: floating, and out-of-range AbstractInt Conversion Rank table: * Last column is now "Description", not "Notes". So it's more clearly normative. * AbstractInt to scalar integral conversions says it's identity when value is in range of the target type, and shader-creation error otherwise. * Reference floating point conversion section where needed. Floating point conversion * Rewrite the "out of taget range" clauses as a procedure. This allows us to cleanly handle: - optional truncation of mantissa bits - the case where the source type is integral. This can occur now with i32 or u32 as source type and f16 as target type (whose max normal value is 65504). Fixes: gpuweb#2769 * The adjacent-value rule only applies when both are finite We don't want one of the adjacent value to be an infinity. For example, twice the max finite value of the destination type should be converted to the infinity of the destination type.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Conversion Rank table:
range of the target type, and shader-creation error otherwise.
Floating point conversion
This allows us to cleanly handle:
with i32 or u32 as source type and f16 as target type (whose max
normal value is 65504).
Fixes: #2769