Skip to content

Commit 1542126

Browse files
committed
Number to string formatting fixed.
1 parent b01c5cc commit 1542126

File tree

3 files changed

+24
-22
lines changed

3 files changed

+24
-22
lines changed

src/base/math/normalizednumber.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ class NormalizedNumber
1515
NormalizedNumber(double value, double base);
1616
double value() const;
1717
void setValue(double value);
18+
double sign() const { return positive ? 1.0 : -1.0; }
19+
double signedCoef() const { return positive ? coefficient : -coefficient; }
1820
private:
1921
};
2022

src/base/text/smartstring.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ std::string SmartString::humanReadable(double value, int maxFractionDigits,
177177
{
178178
Math::EngineeringNumber num(value);
179179

180-
std::string res = fromNumber(num.coefficient,
180+
std::string res = fromNumber(num.signedCoef(),
181181
NumberFormat::none, maxFractionDigits);
182182

183183
if (num.exponent >= 0 && num.exponent < (int)prefixes.size())

test/integration/test_cases/test_cases.json

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,27 @@
33
"test": {
44
"basic_animations/anim_order/circle_without_2_carte_horizontal": {
55
"refs": [
6-
"2a25d02"
6+
"8a9398c"
77
]
88
},
99
"basic_animations/anim_order/circle_without_2_carte_vertical": {
1010
"refs": [
11-
"757b412"
11+
"3626148"
1212
]
1313
},
1414
"basic_animations/anim_order/rectangle_without_2_carte_bar": {
1515
"refs": [
16-
"64fcdaf"
16+
"ead9cbb"
1717
]
1818
},
1919
"basic_animations/anim_order/rectangle_without_2_carte_column": {
2020
"refs": [
21-
"527b112"
21+
"83196e4"
2222
]
2323
},
2424
"basic_animations/anim_order/rectangle_without_2_polar_bar": {
2525
"refs": [
26-
"acc3ac7"
26+
"4fc0bca"
2727
]
2828
},
2929
"basic_animations/anim_order/rectangle_without_2_polar_column": {
@@ -63,17 +63,17 @@
6363
},
6464
"basic_animations/labels/marker/area_2dis_3con": {
6565
"refs": [
66-
"b7e6453"
66+
"8d35d0b"
6767
]
6868
},
6969
"basic_animations/labels/marker/circle_negative_2dis_3con": {
7070
"refs": [
71-
"43eef8b"
71+
"3f828e1"
7272
]
7373
},
7474
"basic_animations/labels/marker/line_2dis_3con": {
7575
"refs": [
76-
"e9a70db"
76+
"2c4a581"
7777
]
7878
},
7979
"basic_animations/labels/marker/rectangle_negative_2dis_3con": {
@@ -93,17 +93,17 @@
9393
},
9494
"basic_animations/legend_transitions/color_conti_anim": {
9595
"refs": [
96-
"9575252"
96+
"b9fd2c3"
9797
]
9898
},
9999
"basic_animations/legend_transitions/color_conti_changes_anim": {
100100
"refs": [
101-
"9cefd69"
101+
"6fc24eb"
102102
]
103103
},
104104
"basic_animations/legend_transitions/color_conti_discrete_anim": {
105105
"refs": [
106-
"4fed463"
106+
"4f5222f"
107107
]
108108
},
109109
"basic_animations/legend_transitions/color_discrete_anim": {
@@ -113,7 +113,7 @@
113113
},
114114
"basic_animations/legend_transitions/color_discrete_changes_anim": {
115115
"refs": [
116-
"d5b38ea"
116+
"70039a7"
117117
]
118118
},
119119
"basic_animations/legend_transitions/color_off_on_anim": {
@@ -123,7 +123,7 @@
123123
},
124124
"basic_animations/legend_transitions/color_off_on_series_anim": {
125125
"refs": [
126-
"21ee98f"
126+
"acb8355"
127127
]
128128
},
129129
"basic_animations/legend_transitions/lightness_2discrete_anim": {
@@ -133,12 +133,12 @@
133133
},
134134
"basic_animations/legend_transitions/lightness_conti_anim": {
135135
"refs": [
136-
"57aba57"
136+
"0d2b26d"
137137
]
138138
},
139139
"basic_animations/legend_transitions/lightness_conti_discrete_anim": {
140140
"refs": [
141-
"4cb646f"
141+
"8f7b083"
142142
]
143143
},
144144
"basic_animations/legend_transitions/lightness_discrete_anim": {
@@ -153,17 +153,17 @@
153153
},
154154
"basic_animations/legend_transitions/size_2discrete_anim": {
155155
"refs": [
156-
"a0bcab6"
156+
"021e038"
157157
]
158158
},
159159
"basic_animations/legend_transitions/size_conti_anim": {
160160
"refs": [
161-
"ce73788"
161+
"29cbb5c"
162162
]
163163
},
164164
"basic_animations/legend_transitions/size_conti_discrete_anim": {
165165
"refs": [
166-
"3c18159"
166+
"177a7e1"
167167
]
168168
},
169169
"basic_animations/legend_transitions/size_discrete_anim": {
@@ -173,7 +173,7 @@
173173
},
174174
"basic_animations/legend_transitions/size_on_off_anim": {
175175
"refs": [
176-
"41262c7"
176+
"59497c1"
177177
]
178178
},
179179
"basic_animations/markers_morph/marker_trans_neg_1dis_1con": {
@@ -368,7 +368,7 @@
368368
},
369369
"operations/drilldown_aggregate_tutorial_data/circle_drilldown_aggregate": {
370370
"refs": [
371-
"98d8b4d"
371+
"ee5f5f5"
372372
]
373373
},
374374
"operations/drilldown_aggregate_tutorial_data/circle_drilldown_aggregate_bubble": {
@@ -423,7 +423,7 @@
423423
},
424424
"operations/filter_tutorial_data/filter_off_anim": {
425425
"refs": [
426-
"6a8c927"
426+
"1d3f986"
427427
]
428428
},
429429
"operations/filter_tutorial_data/line_filter_x": {

0 commit comments

Comments
 (0)