---
spec: JLS
title: "The Java Language Specification"
edition: "Java SE 13 Edition"
java_version: 13
chapter: "Chapter 5. Conversions and Contexts"
section: "5.1.13"
heading: "5.1.13. Value Set Conversion"
parent: "5.1. Kinds of Conversion"
source: https://docs.oracle.com/javase/specs/jls/se13/html/jls-5.html#jls-5.1.13
id: "5.1.13"
url: https://jvm.obfuscated.software/jls/se13/5.1.13.html
raw: https://jvm.obfuscated.software/jls/se13/5.1.13.md
---

# 5.1.13. Value Set Conversion

*Value set conversion* is the process of mapping a floating-point value from one value set to another without changing its type.

Within an expression that is not FP-strict ([§15.4](15.4.md)), value set conversion provides choices to an implementation of the Java programming language:

- If the value is an element of the float-extended-exponent value set, then the implementation may, at its option, map the value to the nearest element of the float value set. This conversion may result in overflow (in which case the value is replaced by an infinity of the same sign) or underflow (in which case the value may lose precision because it is replaced by a denormalized number or zero of the same sign).
- If the value is an element of the double-extended-exponent value set, then the implementation may, at its option, map the value to the nearest element of the double value set. This conversion may result in overflow (in which case the value is replaced by an infinity of the same sign) or underflow (in which case the value may lose precision because it is replaced by a denormalized number or zero of the same sign).

Within an FP-strict expression ([§15.4](15.4.md)), value set conversion does not provide any choices; every implementation must behave in the same way:

- If the value is of type `float` and is not an element of the float value set, then the implementation must map the value to the nearest element of the float value set. This conversion may result in overflow or underflow.
- If the value is of type `double` and is not an element of the double value set, then the implementation must map the value to the nearest element of the double value set. This conversion may result in overflow or underflow.

Within an FP-strict expression, mapping values from the float-extended-exponent value set or double-extended-exponent value set is necessary only when a method is invoked whose declaration is not FP-strict and the implementation has chosen to represent the result of the method invocation as an element of an extended-exponent value set.

Whether in FP-strict code or code that is not FP-strict, value set conversion always leaves unchanged any value whose type is neither `float` nor `double`.
