Float64

Float64(x [, mode::RoundingMode])

Create a Float64 from x. If x is not exactly representable then mode determines how x is rounded.

julia> Float64(pi, RoundDown)
3.141592653589793

julia> Float64(pi, RoundUp)
3.1415926535897936

See get_rounding for available rounding modes.

Examples

The Float64 function in Julia is used to create a Float64 value from a given input x. If x cannot be exactly represented as a Float64, the mode argument can be used to specify the rounding mode.

julia> Float64(pi, RoundDown)
3.141592653589793

julia> Float64(pi, RoundUp)
3.1415926535897936

In the first example, Float64(pi, RoundDown) creates a Float64 value that represents π (pi) with rounding towards negative infinity.

In the second example, Float64(pi, RoundUp) creates a Float64 value that represents π with rounding towards positive infinity.

Note: The RoundDown and RoundUp rounding modes are just examples. There are several other rounding modes available in Julia which can be explored using the get_rounding function.

Please let me know if there's anything else I can assist you with!

See Also

BigFloat, BigInt, Dict, eltype, fieldtype, Float32, Float64, IntSet, isa, isalnum, isalpha, isascii, iseltype, isequal, isgraph, isimmutable, isinteractive, isleaftype, isnull, ispunct, isspace, issubtype, keytype, Nullable, NullException, promote_type, typeintersect, typejoin, typemax, typemin, typeof, Val, valtype,

User Contributed Notes

Add a Note

The format of note supported is markdown, use triple backtick to start and end a code block.

*Required Field
Details

Checking you are not a robot: