2 var $ = require('../internals/export');
3 var fails = require('../internals/fails');
4 var thisNumberValue = require('../internals/this-number-value');
6 var nativeToPrecision = 1.0.toPrecision;
8 var FORCED = fails(function () {
10 return nativeToPrecision.call(1, undefined) !== '1';
11 }) || !fails(function () {
13 nativeToPrecision.call({});
16 // `Number.prototype.toPrecision` method
17 // https://tc39.es/ecma262/#sec-number.prototype.toprecision
18 $({ target: 'Number', proto: true, forced: FORCED }, {
19 toPrecision: function toPrecision(precision) {
20 return precision === undefined
21 ? nativeToPrecision.call(thisNumberValue(this))
22 : nativeToPrecision.call(thisNumberValue(this), precision);