[Sablevm-bugs] [ sablevm-Bugs-753040 ] f2i with large integers
Brought to you by:
egagnon
From: SourceForge.net <no...@so...> - 2003-06-12 02:58:14
|
Bugs item #753040, was opened at 2003-06-11 22:58 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105523&aid=753040&group_id=5523 Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: David Bélanger (davidbelanger) Assigned to: Nobody/Anonymous (nobody) Summary: f2i with large integers Initial Comment: Converting a float that has a value larger than the largest int to an int does not always give the largest int as specified in the specification. public class BugF2I { public static int f2i(float v) { return (int) v; } public static void main(String[] args) { System.out.println(Integer.MAX_VALUE); System.out.println(f2i(Integer.MAX_VALUE + 1.0f)); System.out.println((int) 7777779123.32f); System.out.println(f2i(7777779123.32f)); } } Note: Compiled with jikes on ppc and with javac on x86. jikes / sablevm / ppc 2147483647 2147483647 -812155392 2147483647 jikes / sablevm / x86 2147483647 -2147483648 -812155392 -2147483648 jikes / java / x86 2147483647 2147483647 -812155392 2147483647 javac / java / x86 2147483647 2147483647 2147483647 2147483647 javac / sablevm / x86 2147483647 -2147483648 2147483647 -2147483648 javac / sablevm / ppc 2147483647 2147483647 2147483647 2147483647 David ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105523&aid=753040&group_id=5523 |