# Output of valid decimal places in Julia language

Asked 5 months ago, Updated 5 months ago, 16 views

I'd like to print a valid number of 5 digits in Julia's language, but how should I print it?
The following will not work.

round (0.0625, digits=6)
#0.0625

In this case, the desired value is 0.062500.
If there is no number greater than or equal to 0 for the specified valid number, it will be supplemented by 0.
Do these tool functions exist?

julia

2022-09-30 11:03

As with other common programming languages, you can specify the number of digits in printf.

If I were to apply it to the example question, it would be @printf"%.6f"0.0625.

reference:
Printf-The Julia Language

Usage

@printf([io::IO], "%Fmt", args...)

Example

julia>@printf "Decimal two digits %.2f "1.23456
Decimal two digits 1.23

2022-09-30 11:03

## If you have any answers or tips

Popular Tags
python x 4627
android x 1593
java x 1492
javascript x 1425
c x 924
c++ x 877
ruby-on-rails x 696
php x 692
python3 x 683
html x 656