GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing www.geeksforgeeks.org — JavaScript Number isSafeInteger() Method - GeeksforGeeks JavaScript Number isSafeInteger() MethodLast Updated : 8 Aug, 2023 What is a Safe Integer?
What is an IEEE-754 double-precision number? The IEEE 754 standard specifies a binary64 as having:
isSafeInteger() Method In JavaScript: The isSafeInteger() method in JavaScript is used to check whether a number is a safe integer or not. Syntax: Number.isSafeInteger(Value) Parameters:
Return Value: The toExponential() method in JavaScript returns true if the value is a safe integer Number, else it returns false. Below are examples of the Number isSafeInteger() Method. Example 1: This example uses the safeinteger() method to check if 4 is a safe integer or not.
Output Output : true Example 2: Passing a positive number as an argument in the isSafeInteger() method.
Output Output : true Example 3: Passing a negative number as an argument in the isSafeInteger() method.
Output Output : true Example 4: Passing a number(with decimals) as an argument in the isSafeInteger() method.
Output Output : false Example 5: Passing an equation( which equates to an infinite value) as an argument in the isSafeInteger() method.
Output Output : false Code Explanation: JavaScript uses double-precision floating-point format numbers as specified in IEEE 754 and can only safely represent numbers between -(253 - 1) and 253 - 1. If the parameter passed lies in this specified range then the number.isSafeInteger() method returns true else false. We have a complete list of Javascript Number Methods, to check those please go through the Javascript Number Complete Reference article. Supported Browsers:
Comment Explore |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |