Log On
Embarcadero Home
Watch, Follow, &
Connect with Us
Share This
QualityCentral
Communities
Articles
Blogs
Resources
Downloads
Help
QualityCentral
Delphi-BCB
RTL
Delphi
Arithmetic
ConvUtils
Date - Time
DateUtils
File Management
Format + Float
Input/Output
Math Unit
Memory, Pointer, Address
Null-terminated strings
Other Classes
Other RTL
Pascal Strings
Regular Expressions
RTL Exceptions
Text Files
Thread support
Typed/Untyped Files
WinAPI
You are not logged in.
Help
Print
Public Report
Report From:
Delphi-BCB/RTL/Delphi/Math Unit
[ Add a report in this area ]
Report #:
81203
Status:
Closed
RoundTo clear fpu exception mask
Project:
Delphi
Build #:
14.0.3593.25826
Version:
14.0
Submitted By:
Roman Kolesnikov
Report Type:
Crash / Data loss / Total failure
Date Reported:
1/15/2010 1:41:24 AM
Severity:
Commonly encountered problem
Last Updated:
3/20/2012 2:24:39 AM
Platform:
All platforms
Internal Tracking #:
274504
Resolution:
Fixed
(Resolution Comments)
Resolved in Build:
:
16.0.4256.43595
Duplicate of:
None
Voting and Rating
Overall Rating:
(1 Total Rating)
3.00 out of 5
Total Votes:
2
Description
Bug in RoundTo function
it crashes if FPU exceptions are disabled by Set8087CW($133F);
error is in line
fldcw word ptr [CW8087X] - it clears fpu exception mask flags
to set fpu controls flags you shoud use code like that in function Trunc in system.pas
FNSTCW [ESP].Word // save
FNSTCW [ESP+2].Word // scratch
FWAIT
OR [ESP+2].Word, $0F00 // trunc toward zero, full precision
FLDCW [ESP+2].Word
Steps to Reproduce:
var
x, y: Double;
begin
Set8087CW($133F);
x := 0.0;
y := 5 / x;
if y <> -100 then
RoundTo(1.23, -1);
end;
Workarounds
None
Attachment
None
Comments
Tomohiro Takahashi at 1/17/2010 5:56:23 PM
-
Could you please attach sample project to understand your issue about RoundTo?
With you code block, this line causes EZeroDevide execption...
> y := 5 / x;
Alexander Alexeev at 1/18/2010 12:29:19 AM
-
>>> With you code block, this line causes EZeroDevide execption...
This line do not generate exception, as exceptions are disabled by the above call to Set8087CW!
Create a new empty VCL application and insert this code into Button1.OnClick event handler.
Tomohiro Takahashi at 1/18/2010 5:14:24 AM
-
Indeed, RoundTo has the problem at least Delphi 2009, 2010 ...
Alexander Alexeev at 1/18/2010 12:26:36 AM
-
Possible related report: 79714
Roman Kolesnikov at 9/21/2011 12:38:33 AM
-
Fixed in XE2
Tomohiro Takahashi at 9/21/2011 8:15:42 AM
-
Thanks for the confirmation. I will check the internal status of this report.
View Your Reports
Search
Server Response from: ETNACODE01
Developer Tools
Blackfish SQL
C++Builder
Delphi
FireMonkey
Prism
InterBase
JBuilder
J Optimizer
HTML5 Builder
3rdRail & TurboRuby
Database Tools
Change Manager
DBArtisan
DB Optimizer
ER/Studio
Performance Center
Rapid SQL
Technical Articles
Tutorials
White Papers
Press Releases
Newsletters
Add Content (GetPublished)
Audio
Audio & Video
Video
Bugs & Suggestions (QualityCentral)
Discussion Forums
Examples (CodeCentral)
Tags
Technology Partners
Downloads
Free Trials
Registered User Downloads
Beta Programs
Add Content (GetPublished)
Articles
Blogs
Bugs & Suggestions (QualityCentral)
Discussion Forums
Examples (CodeCentral)
Member Services
About
Connect with Us