NASHORN-389.js revision 877:cf4d2252d444
1171631Scognet/* 2171631Scognet * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 3171631Scognet * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4171631Scognet * 5171631Scognet * This code is free software; you can redistribute it and/or modify it 6171631Scognet * under the terms of the GNU General Public License version 2 only, as 7171631Scognet * published by the Free Software Foundation. 8171631Scognet * 9171631Scognet * This code is distributed in the hope that it will be useful, but WITHOUT 10171631Scognet * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11171631Scognet * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12171631Scognet * version 2 for more details (a copy is included in the LICENSE file that 13171631Scognet * accompanied this code). 14171631Scognet * 15171631Scognet * You should have received a copy of the GNU General Public License version 16171631Scognet * 2 along with this work; if not, write to the Free Software Foundation, 17171631Scognet * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18171631Scognet * 19171631Scognet * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20171631Scognet * or visit www.oracle.com if you need additional information or have any 21171631Scognet * questions. 22171631Scognet */ 23191954Skuriyama 24191954Skuriyama/* 25171631Scognet * NASHORN-389 : number to string conversion issues. 26191954Skuriyama * 27191954Skuriyama * @test 28171631Scognet * @run 29185478Ssam */ 30171631Scognet 31171631Scognetprint(1000000000000000000000); 32171631Scognetprint(0.000000000100000000000); 33191954Skuriyamaprint(1e-5); 34191954Skuriyamavar x = -1.23456789e+21; 35191954Skuriyamavar y = -1.23456789e+20; 36171631Scognetprint(x.toFixed(9)); 37171631Scognetprint(y.toFixed(9).indexOf(",") === -1); // no grouping 38171631Scognet//print(y.toFixed(9)); // FIXME expected: -123456788999999995904.000000000 39171631Scognet//print(1000000000000000128); // FIXME expected: 1000000000000000100 40171631Scognet//print((1000000000000000128).toFixed(0)); // FIXME expected: 1000000000000000128 41171631Scognet