mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8187362: Nashorn unsigned right shift operator unexpectedly returns floating-point
Reviewed-by: sundar, hannesw
This commit is contained in:
parent
f22dd8323b
commit
ea3a3f20d5
2 changed files with 54 additions and 1 deletions
|
@ -804,7 +804,11 @@ public enum JSType {
|
|||
* @return the value converted to Integer or Double
|
||||
*/
|
||||
public static Number toNarrowestNumber(final long l) {
|
||||
return isRepresentableAsInt(l) ? Integer.valueOf((int) l) : Double.valueOf(l);
|
||||
if (isRepresentableAsInt(l)) {
|
||||
return Integer.valueOf((int) l);
|
||||
} else {
|
||||
return Double.valueOf(l);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue