Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

ceil
julia
communitycreator

What is the ceil method in Julia?

Programming Bytes

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Overview

The ceil(x) method in Julia returns the nearest integral value of x that is greater than or equal to x.

Syntax

ceil(x)
The ceil method in Julia

Parameter

x: This is the value for which we have to calculate the ceil.

Return value

The nearest integral value greater than or equal to the specified value will be returned.

Example

## find ceil of 3.01
println( "ceil(3.01) => $(ceil(3.01))")

## find ceil of 5.1
println( "ceil(5.1) => $(ceil(5.1))")

## find ceil of 7.8
println( "ceil(7.8) => $(ceil(7.8))")

## find ceil of -1.4
println( "ceil(-1.4) => $(ceil(-1.4))")
Using the ceil method

Explanation

  • Line 2: We print the ceil method's return value using 3.01 as the parameter. 4.0 is printed to the console.
  • Line 5: We print the ceil method's return value using 5.1 as the parameter. 6.0 is printed to the console.
  • Line 8: We print the ceil method's return value using 7.8 as the parameter. 8.0 is printed to the console.
  • Line 11: We print the ceil method's return value using -1.4 as the parameter. -1.0 is printed to the console.

RELATED TAGS

ceil
julia
communitycreator

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring