For formatting just one number into a string (instead of multi-arg sprintf)
you can use sprintf1 in https://github.com/tonyhffong/NumFormat.jl. It's
somewhat close to standard macro speed.
On Friday, April 18, 2014 12:58:08 AM UTC+7, Dominique Orban wrote:
Here are some timings comparing
I think the question is how to time a proposed sprintf() function vs. the
existing @sprintf macro.
-- John
On Apr 17, 2014, at 7:27 AM, Stefan Karpinski ste...@karpinski.org wrote:
I'm not sure what you mean, but doing things in a loop and timing it is the
normal way. The lack of
Here are some timings comparing @printf with the proposed @eval option. I
also wanted to try a variant that calls libc's printf directly. I came up
with this implementation: https://gist.github.com/11000433. Its advantage
is that you can print an array's address using %p (for what it's worth).
Note that to match the functionality of our @printf macro, it has to handle
different types of arguments correctly, which is non-trivial. Not saying
it's impossible, but it isn't easy.
On Sat, Apr 12, 2014 at 6:08 PM, Kevin Squire kevin.squ...@gmail.comwrote:
I have a port of a BSD printf
Sorry if this is a RTFM, but I can't find the answer in the documentation
or on the web. I may have missed it. I come from Python where I can build
strings with formatted data using a syntax like
s = pi=%7.1e % acos(-1)
How do I accomplish that in Julia? @printf doesn't do the job because it
@sprintf
On Apr 11, 2014, at 11:18 PM, Dominique Orban dominique.or...@gmail.com wrote:
Sorry if this is a RTFM, but I can't find the answer in the documentation or
on the web. I may have missed it. I come from Python where I can build
strings with formatted data using a syntax like
s =
Thank you! Such a basic operation could feature a bit more prominently in
the documentation.
On Friday, April 11, 2014 11:21:28 PM UTC-7, John Myles White wrote:
@sprintf
On Apr 11, 2014, at 11:18 PM, Dominique Orban
dominiq...@gmail.comjavascript:
wrote:
Sorry if this is a RTFM, but
As a follow-up question, why is the following not allowed?
julia fmt = %8.1e;
julia @sprintf(fmt, 3.1415)
ERROR: first or second argument must be a format string
I don't see how it's different from
julia @sprintf(%8.1e, 3.1415)
What's the appropriate syntax?
Thanks.
On Friday, April 11,
@sprintf is a macro, not a function. It doesn't evaluate its inputs: it just
rewrites the inputs into something else (usually less readable) that carries
out the actual computation. You can see what it does using the macroexpand
function:
julia macroexpand(quote @sprintf(%8.1e, 3.1415) end)
That @sprintf is a macro sort of explains why using a run-time value
doesn't work in the same way, but it isn't really *the* reason since
@sprintf(fmt,
val) could work in principle – it would just have to delegate to a function
if its argument isn't a compile-time string.
If using a run-time
Le samedi 12 avril 2014 à 04:11 -0700, Mike Innes a écrit :
That @sprintf is a macro sort of explains why using a run-time value
doesn't work in the same way, but it isn't really the reason since
@sprintf(fmt, val) could work in principle – it would just have to
delegate to a function if its
I have a port of a BSD printf function which works at about half the speed
of the @printf macro. I was hoping to make it more functional/less ugly,
but I'll see if I can't get it into a pull request, at least, or in a
package if it's not accepted.
I'll also point out Dahua's Formatting.jl
12 matches
Mail list logo