Closed Bug 120690 Opened 24 years ago Closed 22 years ago

NSToCoordCeil() is buggy

Categories

(Core :: Layout, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 118117

People

(Reporter: bryner, Unassigned)

References

Details

Reproduced this on Linux and Windows: Calling NSToCoordCeil(0.0) returns 1! The reason seems to be that CEIL_CONST_FLOAT at the top of nsUnitConversion.h has too many digits, and the compiler rounds the number to 1.0.
Depends on: 118117
blames to peterl. Peter can you look at this?
Assignee: dougt → peterl
This isn't me, but the "peterl" before me. My CVS account is "peterlubczynski". -->back to default owner
Assignee: peterl → dougt
Over to layout team. This file should probably move there anyway.
Assignee: dougt → attinasi
Component: XPCOM → Layout
QA Contact: scc → petersen
Target Milestone: --- → mozilla1.0
The only active component in layout that uses this is mathml. -->mathml
Assignee: attinasi → rbs
Component: Layout → MathML
QA Contact: petersen → ian
Uh, I'm going to put this back. This function is used extensively by nsRect in gfx, so it affects nearly everyone who uses nsRect's.
Component: MathML → Layout
This functionalty should be moved out of XPCOM.
It was in rev 3.3 that peterl replaced the standard C functions with these: http://bonsai.mozilla.org/cvslog.cgi?file=mozilla/xpcom/ds/nsUnitConversion.h I suspect the change may have been for speed reasons since reliable versions aren't that cheap. For example, JS uses the following one (s/-inf/+inf/, BTW): http://lxr.mozilla.org/seamonkey/source/js/src/fdlibm/s_ceil.c#48 There could be similar problems with NSToCoordFloor which is used even more than NSToCoordCeil. Looks like a premature optimzation since the other side of the coin is that having such functions around for that long means people may have built on the behavior.
Blocks: 134942
So can we switch to just using ceil() and floor() instead?
Possibly. Just need a good testing window (e.g. 1.5). -> re-assigning to default, so that it gets triaged properly.
Assignee: rbs → misc
Component: Layout → Layout: Misc Code
QA Contact: ian → nobody
Target Milestone: mozilla1.0 → ---
Ultimately I'd like to have only integer arithmetic in layout.
Isn't this a dup of bug 118117?
*** This bug has been marked as a duplicate of 118117 ***
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → DUPLICATE
Product: Core → Core Graveyard
Component: Layout: Misc Code → Layout
Product: Core Graveyard → Core
You need to log in before you can comment on or make changes to this bug.