Number.isSafeInteger Function in JavaScript

Samual Sam
Updated on 25-Jun-2020 12:49:17

98 Views

The isSafeInteger() function of the Number object accepts a number and determines if it is safe integer. If the given number is a safe integer it returns true else, it returns false.SyntaxIts Syntax is as followsNumber.isSafeInteger(90071991);Example Live Demo    JavaScript Example           var result = Number.isSafeInteger(90071991);       if(result) {          document.write("Given number is a safe integer");       }else {          document.write("Given number is not a safe integer");       }     OutputGiven number is a safe integerExamplePassing Decimal value, negative value ... Read More

Number.parseFloat Function in JavaScript

karthikeya Boyini
Updated on 25-Jun-2020 12:48:30

77 Views

The parseFloat() function of the Number object accepts a string, parses and returns floating point number represented by it.SyntaxIts Syntax is as followsNumber.parseFloat("32.01");Example Live Demo    JavaScript Example           var result = Number.parseFloat("32.01");       document.write(result);     Output32.01

Number.parseInt Function in JavaScript

Samual Sam
Updated on 25-Jun-2020 12:48:02

76 Views

The parseInt() function of the Number object accepts a string, parses and returns an integer of the specified radix or base.SyntaxIts Syntax is as followsNumber.parseInt('0xF', 16);Example Live Demo    JavaScript Example           var result = Number.parseInt('0xF', 16);       document.write(result);     Output15

Divisors of Factorials of a Number in Java

Chandu yadav
Updated on 25-Jun-2020 12:47:39

225 Views

Following is a Java program to find the divisors of factorials of a number.Programimport java.util.Scanner; public class DivisorsOfFactorial {    public static long fact(int i) {       if(i

Legendre's Formula in Java

George John
Updated on 25-Jun-2020 12:46:49

273 Views

You can calculate the exponent of the largest power of a PrimeNumber that divides the factorial n! using Legendre's formula.Programimport java.util.Scanner; public class LegendresFormula {    static int Largestpower(int n, int p) {       int ans = 0;       while (n > 0) {          n /= p;          ans += n;       }       return ans;    }    public static void main (String[] args) {       Scanner sc = new Scanner(System.in);       System.out.println("Enter the n value :");     ... Read More

Use Reflection to Create, Fill and Display an Array in Java

Chandu yadav
Updated on 25-Jun-2020 12:44:15

255 Views

An array is created using the java.lang.reflect.Array.newInstance() method. This method basically creates a new array with the required component type as well as length.The array is filled using the java.lang.reflect.Array.setInt() method. This method sets the required integer value at the index specified for the array.The array displayed using the for loop. A program that demonstrates this is given as follows −Example Live Demoimport java.lang.reflect.Array; public class Demo {    public static void main (String args[]) {       int arr[] = (int[])Array.newInstance(int.class, 10);       int size = Array.getLength(arr);       for (int i = 0; iRead More

Math Tanh Function in JavaScript

Samual Sam
Updated on 25-Jun-2020 12:44:07

66 Views

The tanh() function of the Math object accepts an angle (in radians) and returns its hyperbolic tangent value.SyntaxIts Syntax is as followsMath.tanh(90)Example Live Demo    JavaScript Example           var result = Math.tanh(90);       document.write("Hyperbolic tangent value of the given angle: "+result);     OutputHyperbolic tangent value of the given angle: 1

Number Epsilon Property in JavaScript

karthikeya Boyini
Updated on 25-Jun-2020 12:43:46

171 Views

The Number.EPSILON property of the Number object represents the difference between 1 and the smallest floating point number greater than 1.SyntaxIts Syntax is as followsNumber.EPSILONExample Live Demo    JavaScript Example           var result = Number.EPSILON;       document.write("Value of the epsilon : " + result);     OutputValue of the epsilon: 2.220446049250313e-16

Number.MAX_SAFE_INTEGER Property in JavaScript

Samual Sam
Updated on 25-Jun-2020 12:43:22

144 Views

The Number.MAX_SAFE_INTEGER property of the Number object represents the maximum safe integer in JavaScript (i.e. 253 - 1).SyntaxIts Syntax is as followsNumber.MAX_SAFE_INTEGERExample Live Demo    JavaScript Example           var result = Number.MAX_SAFE_INTEGER;       document.write("Maximum safe integer: " + result);     OutputMaximum safe integer: 9007199254740991

Number.MIN_SAFE_INTEGER Property in JavaScript

Samual Sam
Updated on 25-Jun-2020 12:42:30

108 Views

The Number.MIN_SAFE_INTEGER property of the Number object represents the minimum safe integer in JavaScript (i.e. –(253 – 1)).SyntaxIts Syntax is as followsNumber.MIN_SAFE_INTEGERExample Live Demo    JavaScript Example           var result = Number.MIN_SAFE_INTEGER;       document.write("Minimum safe integer: " + result);     OutputMinimum safe integer: -9007199254740991

Advertisements