Another update from ingydotnet^djgoku
This commit is contained in:
parent
91df62d461
commit
948b86eafa
7604 changed files with 108452 additions and 22726 deletions
|
|
@ -0,0 +1,14 @@
|
|||
n = 7.125
|
||||
:io.fwrite "~f~n", [n]
|
||||
:io.fwrite "~.3f~n", [n]
|
||||
:io.fwrite "~9f~n", [n]
|
||||
:io.fwrite "~9.3f~n", [n]
|
||||
:io.fwrite "~9..0f~n", [n]
|
||||
:io.fwrite "~9.3.0f~n", [n]
|
||||
:io.fwrite "~9.3._f~n", [n]
|
||||
:io.fwrite "~f~n", [-n]
|
||||
:io.fwrite "~9.3f~n", [-n]
|
||||
:io.fwrite "~9.3.0f~n", [-n]
|
||||
:io.fwrite "~e~n", [n]
|
||||
:io.fwrite "~12.4e~n", [n]
|
||||
:io.fwrite "~12.4.0e~n", [n]
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
INTEGER IV
|
||||
REAL V
|
||||
DATA V/7.125/ !A positive number.
|
||||
IV = V !Grab the integer part.
|
||||
WRITE (6,1) V,IV
|
||||
1 FORMAT (F9.3,T1,I5.5)
|
||||
END
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
test = [7.125, [rand()*10^rand(0:4) for i in 1:9]]
|
||||
|
||||
println("Formatting some numbers with the @sprintf macro (using \"%09.3f\"):")
|
||||
for i in test
|
||||
println(@sprintf " %09.3f" i)
|
||||
end
|
||||
|
||||
using Formatting
|
||||
println()
|
||||
println("The same thing using the Formatting package:")
|
||||
fe = FormatExpr(" {1:09.3f}")
|
||||
for i in test
|
||||
printfmtln(fe, i)
|
||||
end
|
||||
|
|
@ -1 +1,9 @@
|
|||
printf " %09.3f\n", 7.125
|
||||
r = 7.125
|
||||
printf " %9.3f\n", r #=> 7.125
|
||||
printf " %09.3f\n", r #=> 00007.125
|
||||
printf " %09.3f\n", -r #=> -0007.125
|
||||
printf " %+09.3f\n", r #=> +0007.125
|
||||
puts " %9.3f" % r #=> 7.125
|
||||
puts " %09.3f" % r #=> 00007.125
|
||||
puts " %09.3f" % -r #=> -0007.125
|
||||
puts " %+09.3f" % r #=> +0007.125
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue