In Python 3, I would
print_me = "Look at this significant figure formatted number: {:.2f}!".format(floating_point_number)
print(print_me)
or
print_me = f"Look at this significant figure formatted number: {floating_point_number:.2f}!"
print(print_me)
In Julia
print_me = "Look at this significant figure formatted number: $floating_point_number"
print(print_me)
but this would yield say
Look at this significant figure formatted number: 61.61616161616161
How do I get Julia to restrict the number of decimal places it displays? Note that the necessary storage of the string to be printed, to my knowledge, rules out using the @printf
macro.
This works, but does not seem stylistically correct.
floating_point_number = round(floating_point_number,2)
print_me = "Look at this significant figure formatted number: $floating_point_number"
print(print_me)