delphi - Decimal rounding and printer selection -


I use with Delphi RAD Studio 2010 and DecimalRounding_JH1.pas.

This works fine, but I do not know why, in some old machines (Pentium IV with Windows XP SP3), the round fails after the use of the printer. Printersandx I have checked that this problem is not Windows XP because it works with this OS in other machines.

I have created a simple project, with an expanded value of DecimalRounding_JH1 (drHalfUp 1.11) with two decimal (1, 105 -> decimals) but if I teach the printer. Printersandx, then 1.105 rounds 1.10).

I thought it could be "FDIV bug", but does not resolve the compilation problem with "FDIV Safe".

Code:

  var d1, d2: extended; I: integer; Starting D1: = 1.105; D2: = DecimalRounding_JH1.DecimalRoundExt (d1,2, drHalfUp); Memo1.lines.add (FloatToStr (D2)); // -> Show 1.11 (OK) i: = Printer.printerindex; D2: = DecimalRounding_JH1.DecimalRoundExt (d1,2, drHalfUp); Memo1.lines.add (FloatToStr (D2)); // -> Show 1.10 (error !!!) ...  

I know that this is very strange, but I have tested it and as I said it. What can i do

Edit: If I printer.printerindex: = 1; (for example) i: Then this works fine. Reading the printer unit, whether to execute the difference "SetToDefaultPrinter":

  function TPrinter.GetPrinterIndex: integer; If FPrinterIndex = 1 then SetToDefaultPrinter; Results: = FPrinterIndex; End;  

Thanks in advance.

Parts of the system printers have a dirty habit of modifying 8087 control words with libraries

  Set8087CW (Default8087CW);  

Comments in my codebase suggest that you only have to do the VCL printer code after the first time it is started. So you can face it at the startup of your program. Read Printer.PrinterIndex and then set the control word immediately to your desired value.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -