Re: [PATCH v2.11.1] High-resolution PS plotting

Ilya Zakharevich <[email protected]>
Newsgroups gmane.comp.mathematics.pari.devel
Message-ID <[email protected]>
On Mon, Nov 11, 2019 at 11:35:42PM -0800, Ilya Zakharevich wrote:
> It looks like the low-precision problem is avoided with SVG, due to (≈l.2088)
> 
>     gen_draw(&pl, w, x, y, SVG_SCALE, SVG_SCALE);
> 
> (Only 1/SVG_SCALE = 2⁻¹⁰ is later rounded by "%.2f"; I see no reason
> for such a strange code…)

A bit more clarification on the strangeness of the code:
  • The coordinates are initially stored (inside the “rectangles”) as
    floating point;
  • Then SVG code in rect2svg() asks to scale it up 1024 times (still
    to floats);
  • Then gen_draw() converts it to integers to pass to the low-level
    (format-specific) engine;
  • Then every low-level entry point (such as svg_lines()) scales
    these coordinates DOWN 1024 times (to floats);
  • Then these coordinates are str_printf()ed with "%.2f").

Seems like whoever wrote SVG engine realized the problem with
low-level entry points taking integer values — but instead of
converting the API to behave sensibly they put in this mess with
scaling up/down (with the coefficient incompatible with the
printf-format!).

    (This mess with integer coefficients is most probably MY fault!
     Myself, I wanted to convert all the low-level API to “double”s
     for more than a decade! — These functions are statics anyway!)

Hope this helps,
Ilya
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.