Closed
Bug 226294
Opened 21 years ago
Closed 21 years ago
format-number() ignores the sign of its numerical argument
Categories
(Core :: XSLT, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: jahqueel, Assigned: peterv)
References
()
Details
(Keywords: fixed1.6)
Attachments
(1 file, 5 obsolete files)
3.45 KB,
text/xml
|
Details |
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5a) Gecko/20031113 Mozilla Firebird/0.6.1
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5a) Gecko/20031113 Mozilla Firebird/0.6.1
The format-number() function is only displaying the abs() value of its numerical
argument. It never displays the minus sign before the number, and will never use
the "negative" format after the ; in the format string.
Reproducible: Always
Steps to Reproduce:
1. Copy the XSLT document on the MSDN site into a file named decimalformat.xsl
2. Open the file in Mozilla
Actual Results:
I see a version of the table matching the example provided by Microsoft, except
that the sign of the number is not preserved. The negative numbers are shown as
being positive.
Expected Results:
The table should match the example provided by Microsoft, with the sign of the
number being preserved, and the negative format being used on negative numbers.
Confirmed. I see the same problem.
Ashley Winters and I tried a number of tricks to get around this. We tried
specifying the following to no avail:
<xml:decimal-format minus-sign="-" />
format-number(-123.45, '0.00;-0.00')
format-number(-123.45, '0.00;(0.00)')
Note that the last one wouldn't actually yeild a minus sign, but it should put
parentheses around negative numbers. It had no effect, however.
I finally used a conditional and <xml:text>-$</xml:text> to get the minus sign.
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5a) Gecko/20030912 Mozilla
Firebird/0.6.1
Comment 2•21 years ago
|
||
I cannot reproduce this on windows 1.4 and trunk.
Somebody should try a linux build, though I don't expect a platform issue
within intel cpus here.
Reporter | ||
Comment 3•21 years ago
|
||
I tried the decimalformat.xsl example on my
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5b) Gecko/20030820 Mozilla
Firebird/0.6.1+
and it works as expected. I can only replicate the problem on a Linux build.
Comment 4•21 years ago
|
||
We copied the Double::isNeg code from jsnum.h, which since then got a check-in
to handle some gcc 3 alias optim issue, see bug 83388, and diff
http://bonsai.mozilla.org/cvsview2.cgi?diff_mode=context&whitespace_mode=show&root=/cvsroot&subdir=mozilla/js/src&command=DIFF_FRAMESET&file=jsnum.h&rev2=3.7&rev1=3.6
We should port the current state of jsnum.h to Double.cpp and be hopefully done
with it.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Attachment #135978 -
Attachment is obsolete: true
Comment 6•21 years ago
|
||
In Mozilla 1.4 (Linux) a format-number xpath always resulted in a negative number.
I noted the problem was "fixed" in Mozilla 1.5.
However, I now see that the problem remains in {} expressions. For instance:
<form>
<input name="total" value="{format-number(total, '###0.0')}"/>
</form>
I've tacked this report onto this issue because it sounds related.
Comment on attachment 138210 [details] [diff] [review]
patch v1
[Checked in: Comment 16]
This patch has been tested on gcc 3.2.2 and is verified to fix the problem.
It'd be great if i could get reviews by monday so that we could get this into
1.6. Sorry for the late patch :(
Attachment #138210 -
Flags: superreview?(peterv)
Attachment #138210 -
Flags: review?(axel)
Assignee | ||
Comment 9•21 years ago
|
||
As long as we're syncing with jsnum, could you please use the latest version of
the code? Seems like that also has ARM and Os/2 changes, though I'm not sure if
we need the SET_FPU/RESTORE_FPU changes.
Comment 10•21 years ago
|
||
Comment on attachment 138210 [details] [diff] [review]
patch v1
[Checked in: Comment 16]
I don't have anything even loosely resembling a tree for yet another week.
Reading what peter said, I should have that to do the review.
Attachment #138210 -
Flags: review?(axel) → review?
Comment on attachment 138210 [details] [diff] [review]
patch v1
[Checked in: Comment 16]
could we please try to get at least this in for 1.6? There might be other
things that should be ported too, but this fixes a known bug. I most likly
won't have time to do the rest before 1.6 is released since that will happen
any day now and i'm out of town. I'll look into porting the other things as
soon as i get back though.
Attachment #138210 -
Flags: review? → review?(axel)
Comment 12•21 years ago
|
||
Comment on attachment 138210 [details] [diff] [review]
patch v1
[Checked in: Comment 16]
r/sr=bryner
Attachment #138210 -
Flags: review?(axel) → review+
![]() |
||
Comment 13•21 years ago
|
||
Comment on attachment 138210 [details] [diff] [review]
patch v1
[Checked in: Comment 16]
sr=bzbarsky
Attachment #138210 -
Flags: superreview?(peterv) → superreview+
Attachment #138210 -
Flags: approval1.6?
Comment on attachment 138210 [details] [diff] [review]
patch v1
[Checked in: Comment 16]
This patch is pretty safe since the same code has been well tested in the
js-library on the trunk for a while now. Also it only affects XSLT/XPath.
Comment 15•21 years ago
|
||
Comment on attachment 138210 [details] [diff] [review]
patch v1
[Checked in: Comment 16]
a=mkaply for 1.6
Attachment #138210 -
Flags: approval1.6? → approval1.6+
checked in to the 1.6 branch. I'm keeping this open to investigate syncronizing
other changes to jsnum.h
Keywords: fixed1.6
Assignee | ||
Comment 17•21 years ago
|
||
Nice, no XSLT peers reviewed.
I didn't think that was needed since this code isn't xslt specific. It was also
an xslt peer that created the patch. I had to choose between leaving the tree in
a known broken state for 1.6 or doing it this way, i thought the latter was better.
Comment 19•21 years ago
|
||
lets mark fixed and reopen another bug for addtional work. that is the only way
to get items on the testing, release note, and change tracking for releases...
The problem isn't fixed on the trunk yet so i'd rather not close this bug as is.
OTOH peterv doesn't seem happy about the landing that happend on the branch so
i'm not really sure what to do?
I'll try to write up a patch that compleatly syncs us to jsnum.h, possibly I can
have something sometime tomorrow.
Status: NEW → ASSIGNED
Assignee | ||
Comment 21•21 years ago
|
||
Well, get a better fix for the trunk. I was unhappy about this patch because it
copies code from jsnum.h that has been modified on the trunk already. Water
under the bridge.
Comment 22•21 years ago
|
||
follow up work for trunk in http://bugzilla.mozilla.org/show_bug.cgi?id=230528
Ok, closing as fixed
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Comment 24•21 years ago
|
||
I stumbled over this bug when trying to compile Mozilla 1.6 for OS/2 from CVS
checkout yesterday morning using --with-extensions=all. I got several compile
errors in Double.cpp starting with:
G:/MozCompile/mozilla16/extensions/transformiix/source/base/Double.cpp:78: '
u_int32_t' is used as a type, but is not defined as a type.
G:/MozCompile/mozilla16/extensions/transformiix/source/base/Double.cpp:79: '
u_int32_t' is used as a type, but is not defined as a type.
All other errors were just resulting from this one. I fixed this by adding
#include <sys/types.h>
to Double.cpp, and Mozilla compiled for me. Not sure though, if that header has
the correct definition of that type. If this is not cross platform bracketing it
with #ifdef OS2 could be an option.
Comment 25•21 years ago
|
||
Comment on attachment 138210 [details] [diff] [review]
patch v1
[Checked in: Comment 16]
Re comment 24:
Comment 16 says that this patch was checked in in v1.6branch
but
<http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/extensions/transformiix/so
urce/base/Double.cpp>
says that the Trunk is still at { 1.20 axel%pike.org Jan 30 2003 }.
Odd !? May be not ?? see Comment 22...
Assignee | ||
Comment 26•21 years ago
|
||
Please stop making a mess. This is the bug that contains the branch work, bug
230528 is for the equivalent work on the trunk. Resetting the target milestone
is the privilege of the bug owner. I'll leave it to sicking to decide how he
wants to handle the build bustage (reopening this or filing a new bug).
No longer blocks: 230528
Target Milestone: mozilla1.7alpha → ---
Comment 27•21 years ago
|
||
Forgot to upload this trivial patch to make in compile on OS/2 yesterday.
Comment on attachment 138863 [details] [diff] [review]
Double.cpp patch to include sys/types.h on OS/2
r=me for landing on the branch, no need to do this on the trunk yet since the
patch isn't landed there
Attachment #138863 -
Flags: review+
Comment 29•21 years ago
|
||
Comment on attachment 138863 [details] [diff] [review]
Double.cpp patch to include sys/types.h on OS/2
As this is my bug, I guess I have to set "superreview?" and "approval?"?
But when granted somebody else has to check it in because I don't have
permission to do so...
Attachment #138863 -
Flags: superreview?(peterv)
Attachment #138863 -
Flags: approval1.6?
Comment 30•21 years ago
|
||
Argh, I meant _my_ _patch_. Sorry for the extra bugspam...
Updated•21 years ago
|
Attachment #138210 -
Attachment description: patch v1 → patch v1
[Checked in: Comment 16]
Attachment #138210 -
Attachment is obsolete: true
Comment 31•21 years ago
|
||
Using "uint32" instead of "u_int32_t", which should work since it's used for
all platforms on jsnum.h.
Updated•21 years ago
|
Attachment #138904 -
Flags: review?(bugmail)
Attachment #138904 -
Flags: review?(bugmail) → review+
Updated•21 years ago
|
Attachment #138863 -
Attachment is obsolete: true
Attachment #138863 -
Flags: superreview?(peterv)
Attachment #138863 -
Flags: review+
Attachment #138863 -
Flags: approval1.6?
Comment 32•21 years ago
|
||
Scratch that. Let's use NSPR type instead (PRUint32). Weeeeeee!
Updated•21 years ago
|
Attachment #138904 -
Attachment is obsolete: true
Comment on attachment 138906 [details] [diff] [review]
better better os/2 patch
[Checked in: Comment 37]
Thanks! Sorry for being flaky about which datatype to use. Discussed with tor
and we decided that PRUint32 would probably be the safest one to use.
Attachment #138906 -
Flags: review+
Comment on attachment 138906 [details] [diff] [review]
better better os/2 patch
[Checked in: Comment 37]
got sr=tor
Attachment #138906 -
Flags: superreview+
Comment on attachment 138906 [details] [diff] [review]
better better os/2 patch
[Checked in: Comment 37]
requesting approval. This should fix buildbustage on a few platforms where
u_int32_t doesn't exist. The patch should be safe since there are no functional
changes, only bustagefix by using standard NSPR datatypes
Attachment #138906 -
Flags: approval1.6?
Comment on attachment 138906 [details] [diff] [review]
better better os/2 patch
[Checked in: Comment 37]
check in really soon, though.
Attachment #138906 -
Flags: approval1.6? → approval1.6+
Comment on attachment 138906 [details] [diff] [review]
better better os/2 patch
[Checked in: Comment 37]
checked in
Updated•21 years ago
|
Attachment #138906 -
Attachment description: better better os/2 patch → better better os/2 patch
[Checked in: Comment 37]
Attachment #138906 -
Attachment is obsolete: true
You need to log in
before you can comment on or make changes to this bug.
Description
•