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)

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?


2022-09-30 11:03

1 Answers

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.

Printf-The Julia Language


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


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

© 2023 OneMinuteCode. All rights reserved.