summaryrefslogtreecommitdiff
path: root/test/data/parse/makefixed.pl
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2009-01-17 07:27:25 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2009-01-17 07:27:25 +0000
commit715f2617dffdcede45af45e5e849cb83f67745b4 (patch)
tree53e36520f98150d4e6ca3e4e2f44f5837827cf34 /test/data/parse/makefixed.pl
parentbe1ec90210885935d3b6b9d6ccc36bdc12717192 (diff)
downloadlibcss-715f2617dffdcede45af45e5e849cb83f67745b4.tar.gz
libcss-715f2617dffdcede45af45e5e849cb83f67745b4.tar.bz2
Make makefixed.pl round to nearest integer, rather than truncating towards zero.
Add a test for negative fractions to properties.dat svn path=/trunk/libcss/; revision=6110
Diffstat (limited to 'test/data/parse/makefixed.pl')
-rwxr-xr-xtest/data/parse/makefixed.pl12
1 files changed, 11 insertions, 1 deletions
diff --git a/test/data/parse/makefixed.pl b/test/data/parse/makefixed.pl
index 712784f..1a9306f 100755
--- a/test/data/parse/makefixed.pl
+++ b/test/data/parse/makefixed.pl
@@ -7,5 +7,15 @@ die "Usage: makefixed.pl <value>\n" if (@ARGV != 1);
my $val = shift @ARGV;
-printf("0x%.8x\n", $val * (1 << 10));
+$val *= (1 << 10);
+
+# Round away from zero
+if ($val < 0) {
+ $val -= 0.5;
+} else {
+ $val += 0.5;
+}
+
+# Truncates back towards zero
+printf("0x%.8x\n", $val);