xref: /PHP-7.2/ext/intl/tests/bug53735.phpt (revision 2a0ed8a2)
1--TEST--
2Bug #53735 NumberFormatter returns NaN when converting float point
3--SKIPIF--
4<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
5<?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0) die('skip for ICU >= 51.2'); ?>
6--FILE--
7<?php
8
9$fmt = numfmt_create("da_DK", \NumberFormatter::CURRENCY);
10
11var_dump(numfmt_format($fmt, 5.5));
12setlocale(LC_ALL, "da_DK.UTF-8");
13
14var_dump(numfmt_format($fmt, 5.5));
15var_dump(numfmt_format($fmt, "5,5"));
16
17
18$fmt = new \NumberFormatter("de_DE", \NumberFormatter::DECIMAL);
19var_dump($fmt->format(23.25));
20
21$f = new NumberFormatter('hu_HU', NumberFormatter::PERCENT, '#,##0%');
22var_dump($f->format(0.26));
23
24?>
25==DONE==
26--EXPECTF--
27string(%d) "5,50 kr%A"
28string(%d) "5,50 kr%A"
29string(%d) "5,00 kr%A"
30string(5) "23,25"
31string(3) "26%"
32==DONE==
33