Trusted answers to developer questions

Programming Bytes

The

method can be used to check if the given value is a finite number or not.**isfinite()**

isfinite(f) -> Bool

Julia isfinite function Syntax

This method takes the parameter

which represents the value that is to be checked.** f**

This method returns `true`

if the provided value is finite. Otherwise, `false`

is returned.

The code below demonstrates how to use the `isfinite`

method.

## find isfinite of 10 / 0 println( "isfinite(10 / 0) => $(isfinite(10 / 0))") ## find isfinite of 10 println( "isfinite(10) => $(isfinite(10))") ## find isfinite of 0 println( "isfinite(0) => $(isfinite(0))")

Using the isfinite method

In the code above, we do the following:

- Line 2
**:**We use the`isfinite`

method with`(10/0)`

as an argument. Any non-zero value divided by`0`

will produce an infinite value. So the`isfinite(10/0)`

will return`false`

.

- Line 5
**:**We use the`isfinite`

method with`10`

as an argument. The`isfinite(10)`

will return`true`

because`10`

is a finite value.

- Line 8
**:**We use the`isfinite`

method with`0`

as an argument. The`isfinite(0)`

will return`true`

because`0`

is a finite value.

RELATED TAGS

julia

communitycreator

CONTRIBUTOR

Programming Bytes

RELATED COURSES

View all Courses

Keep Exploring

Related Courses