You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 7174 Reporter: MonsieurPi Status: resolved (set by @xavierleroy on 2017-02-17T15:13:18Z) Resolution: fixed Priority: normal Severity: minor Version: 4.02.3 Target version: 4.05.0 +dev/beta1/beta2/beta3/rc1 Fixed in version: 4.05.0 +dev/beta1/beta2/beta3/rc1 Category: documentation
Bug description
I found a "bug" in the Graphics library in OCaml :
If you write
let () =
let open Graphics in
open_graph " 800x800";
draw_segments [|200,0,200,33567|];
ignore (read_key ())
No problem.
But if you write
let () =
let open Graphics in
open_graph " 800x800";
draw_segments [|200,0,200,33568|];
ignore (read_key ())
(I just changed 33567 to 33568.)
You have no line.
Strange, no ?
Well, actually, no. The coordinates are coded on 16 bits signed integers which corresponds to a range between [-32768, 32767] and if you add to it the size of my graph (here, 800) + 1 it goes out (which corresponds to 33568)
shouldn't Graphics be fixed to use ints? Physical displays are not even one magnitue below the limit for int16 and virtual displays can easily be larger than int16 allows.
Yes, exactly. That's why I think it would be better to document it in the Graphics documentation since Graphics functions use int64 (or int32) and this can lead to errors hardly understandable.
Original bug ID: 7174
Reporter: MonsieurPi
Status: resolved (set by @xavierleroy on 2017-02-17T15:13:18Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 4.02.3
Target version: 4.05.0 +dev/beta1/beta2/beta3/rc1
Fixed in version: 4.05.0 +dev/beta1/beta2/beta3/rc1
Category: documentation
Bug description
I found a "bug" in the Graphics library in OCaml :
If you write
let () =
let open Graphics in
open_graph " 800x800";
draw_segments [|200,0,200,33567|];
ignore (read_key ())
No problem.
But if you write
let () =
let open Graphics in
open_graph " 800x800";
draw_segments [|200,0,200,33568|];
ignore (read_key ())
(I just changed 33567 to 33568.)
You have no line.
Strange, no ?
Well, actually, no. The coordinates are coded on 16 bits signed integers which corresponds to a range between [-32768, 32767] and if you add to it the size of my graph (here, 800) + 1 it goes out (which corresponds to 33568)
This behaviour is normal but the documentation of Graphics should add a remark about it because in the OCaml manual (http://caml.inria.fr/pub/docs/manual-ocaml-4.00/manual040.html) it's specified that "Drawing is clipped to the screen."
Regards
Steps to reproduce
let () =
let open Graphics in
open_graph " 800x800";
draw_segments [|200,0,200,33568|];
ignore (read_key ())
The text was updated successfully, but these errors were encountered: