2017-05-28 00:38:50 +02:00
|
|
|
'use strict';
|
2017-08-14 05:01:11 +02:00
|
|
|
var $export = require('./_export');
|
|
|
|
var $fails = require('./_fails');
|
|
|
|
var aNumberValue = require('./_a-number-value');
|
|
|
|
var $toPrecision = 1.0.toPrecision;
|
2017-05-28 00:38:50 +02:00
|
|
|
|
2017-08-14 05:01:11 +02:00
|
|
|
$export($export.P + $export.F * ($fails(function () {
|
2017-05-28 00:38:50 +02:00
|
|
|
// IE7-
|
|
|
|
return $toPrecision.call(1, undefined) !== '1';
|
2017-08-14 05:01:11 +02:00
|
|
|
}) || !$fails(function () {
|
2017-05-28 00:38:50 +02:00
|
|
|
// V8 ~ Android 4.3-
|
|
|
|
$toPrecision.call({});
|
|
|
|
})), 'Number', {
|
2017-08-14 05:01:11 +02:00
|
|
|
toPrecision: function toPrecision(precision) {
|
2017-05-28 00:38:50 +02:00
|
|
|
var that = aNumberValue(this, 'Number#toPrecision: incorrect invocation!');
|
2017-08-14 05:01:11 +02:00
|
|
|
return precision === undefined ? $toPrecision.call(that) : $toPrecision.call(that, precision);
|
2017-05-28 00:38:50 +02:00
|
|
|
}
|
2017-08-14 05:01:11 +02:00
|
|
|
});
|