[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to use a float value with either GLYPH_DEBUG or NSTRACE
From: |
Keith David Bershatsky |
Subject: |
Re: How to use a float value with either GLYPH_DEBUG or NSTRACE |
Date: |
Mon, 21 Aug 2017 21:30:21 -0700 |
Thank you, Paul, for the suggestion to use dtoastr. I tried that and a few
variations, but got stuck because dtoastr returns an `int` and `%s` expects a
`char` value. Substituting `%s` for `%d` did not yield the correct results.
Keith
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
DATE: [08-21-2017 16:55:08] <21 Aug 2017 16:55:08 -0700>
FROM: Paul Eggert <address@hidden>
>
> * * *
>
> E.g., something like the following (untested) C code. Although this
> assumes CGFloat is 'double', and outputs excess precision on 32-bit
> platforms where CGFloat is 'float', it would be easy to fix that if you
> like the idea.
>
> #include <ftoastr.h>
>
> void
> example (CGFloat value)
> {
> char buf[DBL_BUFSIZE_BOUND];
> NSTRACE ("float: %s", dtoastr (buf, sizeof buf, 0, 0, value));
> }