On Jan 29, 2013, at 5:02 PM, Orion Poplawski wrote: > On 01/29/2013 03:21 AM, Jerry wrote: >> >> Hi Orion, >> >> This is puzzling. I can't see what could possibly be causing this. (By >> "this" I mean the x02.adb example, as I haven't looked any of the others.) I >> have not set ranges for any of the entities involved. (In Ada, you can >> specify an allowed range for a variable. For instance, one could specify >> that r1 is constrained between 0.0 and 1.0 and any attempt to assign a value >> outside that range would raise an overflow (I think) exception.) So I don't >> see where there is an opportunity to overflow either r1, a 64-bit float or >> r( ), a 32-bit integer. >> >> FWIW, GNAT does something a little controversial--it defaults to disabling >> overflow checking. The controversy is that this compiler is then, by >> default, not an Ada compiler. But I don't see how that is apropos to this >> situation. >> >> Can you try running this program and report the results? >> >> >> with Ada.Text_IO; use Ada.Text_IO; >> procedure Test_Overflow is >> r : Integer; >> r1 : Long_Float := 0.3; >> begin >> Put_Line("Running...."); >> r := Integer((r1 * 255.001) - 0.499999999999999); >> end Test_Overflow; >> >> >> Compile and run: >> >> $ gnatmake Test_Overflow.adb >> $./test_overflow >> >> I also tried it with overflow checking turned on: >> >> $ gnatmake -gnato Test_Overflow.adb >> $./test_overflow >> >> It works either way on my system. > > > [orion@vmrawhide ~]$ gnatmake Test_Overflow.adb > gcc -c Test_Overflow.adb > Test_Overflow.adb:2:11: warning: file name does not match unit name, should > be "test_overflow.adb" > gnatbind -x Test_Overflow.ali > gnatlink Test_Overflow.ali > > [orion@vmrawhide ~]$ ./Test_Overflow > Running.... > > raised CONSTRAINT_ERROR : Test_Overflow.adb:7 overflow check failed > [[orion@vmrawhide ~]$ rm Test_Overflow Test_Overflow.o Test_Overflow.ali > [orion@vmrawhide ~]$ gnatmake -gnato Test_Overflow.adb > gcc -c -gnato Test_Overflow.adb > Test_Overflow.adb:2:11: warning: file name does not match unit name, should > be "test_overflow.adb" > gnatbind -x Test_Overflow.ali > gnatlink Test_Overflow.ali > [orion@vmrawhide ~]$ ./Test_Overflow > Running.... > > raised CONSTRAINT_ERROR : Test_Overflow.adb:7 overflow check failed > > > -- > Orion Poplawski > Technical Manager 303-415-9701 x222 > NWRA, Boulder Office FAX: 303-415-9702 > 3380 Mitchell Lane or...@nwra.com > Boulder, CO 80301 http://www.nwra.com
Orion: I've queried the oracle (comp.lang.ada). Jerry ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_jan _______________________________________________ Plplot-devel mailing list Plplot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-devel