Skip to content

Commit 77cebb1

Browse files
committed
Conversion from double to float. Resolves #27.
1 parent 6a12780 commit 77cebb1

22 files changed

+372
-373
lines changed

source/arc.tex

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
The class \tcode{arc} describes a path item that adds an arc path segment to a path.
99

1010
\pnum
11-
It has a \term{radius} of type \tcode{vector_2d}, a \term{rotation} of type \tcode{double}, and a \term{start angle} of type \tcode{double}.
11+
It has a \term{radius} of type \tcode{vector_2d}, a \term{rotation} of type \tcode{float}, and a \term{start angle} of type \tcode{float}.
1212

1313
\pnum
1414
The rotation and start angle are in radians. The arc begins at its start angle and ends at the angle that is rotation radians from the start angle.
@@ -34,17 +34,17 @@
3434
// \ref{\iotwod.arc.cons}, construct/copy/move/destroy:
3535
constexpr arc() noexcept;
3636
constexpr arc(const vector_2d& rad,
37-
double rot, double sang) noexcept;
37+
float rot, float sang) noexcept;
3838

3939
// \ref{\iotwod.arc.modifiers}, modifiers:
4040
constexpr void radius(const vector_2d& rad) noexcept;
41-
constexpr void rotation(double rot) noexcept;
42-
constexpr void start_angle(double radians) noexcept;
41+
constexpr void rotation(float rot) noexcept;
42+
constexpr void start_angle(float radians) noexcept;
4343

4444
// \ref{\iotwod.arc.observers}, observers:
4545
constexpr vector_2d radius() const noexcept;
46-
constexpr double rotation() const noexcept;
47-
constexpr double start_angle() const noexcept;
46+
constexpr float rotation() const noexcept;
47+
constexpr float start_angle() const noexcept;
4848
vector_2d center(const vector_2d& cpt, const matrix_2d& m = matrix_2d{})
4949
const noexcept;
5050
vector_2d end_pt(const vector_2d& cpt, const matrix_2d& m = matrix_2d{})
@@ -67,13 +67,13 @@
6767
\begin{itemdescr}
6868
\pnum
6969
\effects
70-
Equivalent to: \tcode{arc\{ vector_2d(10.0, 10.0), pi<double>, pi<double> \};}.
70+
Equivalent to: \tcode{arc\{ vector_2d(10.0f, 10.0f), pi<float>, pi<float> \};}.
7171
\end{itemdescr}
7272

7373
\indexlibrary{\idxcode{arc}!constructor}%
7474
\begin{itemdecl}
75-
constexpr arc(const vector_2d& rad, double rot,
76-
double start_angle = pi<double>) noexcept;
75+
constexpr arc(const vector_2d& rad, float rot,
76+
float start_angle = pi<float>) noexcept;
7777
\end{itemdecl}
7878
\begin{itemdescr}
7979
\pnum
@@ -104,7 +104,7 @@
104104

105105
\indexlibrarymember{rotation}{arc}%
106106
\begin{itemdecl}
107-
constexpr void rotation(double rot) noexcept;
107+
constexpr void rotation(float rot) noexcept;
108108
\end{itemdecl}
109109
\begin{itemdescr}
110110
\pnum
@@ -114,7 +114,7 @@
114114

115115
\indexlibrarymember{start_angle}{arc}%
116116
\begin{itemdecl}
117-
constexpr void start_angle(double sang) noexcept;
117+
constexpr void start_angle(float sang) noexcept;
118118
\end{itemdecl}
119119
\begin{itemdescr}
120120
\pnum
@@ -136,7 +136,7 @@
136136

137137
\indexlibrarymember{rotation}{arc}%
138138
\begin{itemdecl}
139-
constexpr double rotation() const noexcept;
139+
constexpr float rotation() const noexcept;
140140
\end{itemdecl}
141141
\begin{itemdescr}
142142
\pnum
@@ -146,7 +146,7 @@
146146

147147
\indexlibrarymember{start_angle}{arc}%
148148
\begin{itemdecl}
149-
constexpr double start_angle() const noexcept;
149+
constexpr float start_angle() const noexcept;
150150
\end{itemdecl}
151151
\begin{itemdescr}
152152
\pnum
@@ -165,8 +165,8 @@
165165
As-if:
166166
\begin{codeblock}
167167
auto lmtx = m;
168-
lmtx.m20(0.0); lmtx.m21(0.0); // Eliminate translation.
169-
auto centerOffset = point_for_angle(two_pi<double> - _Start_angle, _Radius);
168+
lmtx.m20(0.0f); lmtx.m21(0.0f); // Eliminate translation.
169+
auto centerOffset = point_for_angle(two_pi<float> - _Start_angle, _Radius);
170170
centerOffset.y(-centerOffset.y());
171171
return cpt - centerOffset * lmtx;
172172
\end{codeblock}
@@ -184,7 +184,7 @@
184184
\begin{codeblock}
185185
auto lmtx = m;
186186
auto tfrm = matrix_2d::init_rotate(_Start_angle + _Rotation);
187-
lmtx.m20(0.0); lmtx.m21(0.0); // Eliminate translation.
187+
lmtx.m20(0.0f); lmtx.m21(0.0f); // Eliminate translation.
188188
auto pt = (_Radius * tfrm);
189189
pt.y(-pt.y());
190190
return cpt + pt * lmtx;

source/brush.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
\pnum
2323
\begin{example}
24-
Several graphics and rendering technologies that are currently widely used typically store individual color and alpha channel data as 8-bit unsigned normalized integer values while the \tcode{double} type that is used by the \tcode{rgba_color} class for individual color and alpha is often a 64-bit value. As such, it is possible for a loss of precision when transforming the 64-bit channel data of an \tcode{rgba_color} object to the 8-bit channel data that is commonly used internally in such graphics and rendering technologies.
24+
Several graphics and rendering technologies that are currently widely used typically store individual color and alpha channel data as 8-bit unsigned normalized integer values while the \tcode{float} type that is used by the \tcode{rgba_color} class for individual color and alpha is often a 64-bit value. As such, it is possible for a loss of precision when transforming the 64-bit channel data of an \tcode{rgba_color} object to the 8-bit channel data that is commonly used internally in such graphics and rendering technologies.
2525
\end{example}
2626

2727
\rSec1 [\iotwod.brush.synopsis] {\tcode{brush} synopsis}

source/circle.tex

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
The class \tcode{circle} describes a circle.
99

1010
\pnum
11-
It has a Center of type \tcode{vector_2d} and a Radius of type \tcode{double}.
11+
It has a Center of type \tcode{vector_2d} and a Radius of type \tcode{float}.
1212

1313
\rSec1 [\iotwod.circle.synopsis] {\tcode{circle} synopsis}
1414

@@ -18,15 +18,15 @@
1818
public:
1919
// \ref{\iotwod.circle.cons}, construct/copy/move/destroy:
2020
constexpr circle() noexcept;
21-
contexpr circle(const vector_2d& ctr, double rad) noexcept;
21+
contexpr circle(const vector_2d& ctr, float rad) noexcept;
2222

2323
// \ref{\iotwod.circle.modifiers}, modifiers:
2424
constexpr void center(const vector_2d& ctr) noexcept;
25-
constexpr void radius(double r) noexcept;
25+
constexpr void radius(float r) noexcept;
2626

2727
// \ref{\iotwod.circle.observers}, observers:
2828
constexpr vector_2d center() const noexcept;
29-
constexpr double radius() const noexcept;
29+
constexpr float radius() const noexcept;
3030
};
3131
}
3232
\end{codeblock}
@@ -43,19 +43,19 @@
4343
Constructs an object of type \tcode{circle}.
4444

4545
\pnum
46-
The value of Center is \tcode{vector_2d\{0,0, 0.0\}}.
46+
The value of Center is \tcode{vector_2d\{0,0, 0.0f\}}.
4747

4848
\pnum
49-
The value of Radius is \tcode{0.0}.
49+
The value of Radius is \tcode{0.0f}.
5050
\end{itemdescr}
5151

5252
\indexlibrary{\idxcode{circle}!constructor}%
5353
\begin{itemdecl}
54-
constexpr circle(const vector_2d& ctr, double r) noexcept;
54+
constexpr circle(const vector_2d& ctr, float r) noexcept;
5555
\end{itemdecl}
5656
\begin{itemdescr}
5757
\requires
58-
\tcode{r >= 0.0}.
58+
\tcode{r >= 0.0f}.
5959

6060
\pnum
6161
\effects
@@ -83,11 +83,11 @@
8383

8484
\indexlibrary{\idxcode{circle}!\idxcode{radius}}%
8585
\begin{itemdecl}
86-
constexpr void radius(double r) noexcept;
86+
constexpr void radius(float r) noexcept;
8787
\end{itemdecl}
8888
\begin{itemdescr}
8989
\requires
90-
\tcode{r >= 0.0}.
90+
\tcode{r >= 0.0f}.
9191

9292
\pnum
9393
\effects
@@ -98,7 +98,7 @@
9898

9999
\indexlibrary{\idxcode{circle}!\idxcode{center}}%
100100
\begin{itemdecl}
101-
constexpr double center() const noexcept;
101+
constexpr float center() const noexcept;
102102
\end{itemdecl}
103103
\begin{itemdescr}
104104
\pnum
@@ -108,7 +108,7 @@
108108

109109
\indexlibrary{\idxcode{circle}!\idxcode{radius}}%
110110
\begin{itemdecl}
111-
constexpr double radius() const noexcept;
111+
constexpr float radius() const noexcept;
112112
\end{itemdecl}
113113
\begin{itemdescr}
114114
\pnum

source/color-stop.tex

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
The class \tcode{color_stop} describes a color stop that is used by gradient brushes.
99

1010
\pnum
11-
It has an offset of type \tcode{double} and a color of type \tcode{rgba_color}.
11+
It has an offset of type \tcode{float} and a color of type \tcode{rgba_color}.
1212

1313
\rSec2 [\iotwod.colorstops.colorstop.synopsis] {\tcode{color_stop} Synopsis}
1414

@@ -17,14 +17,14 @@
1717
class color_stop {
1818
public:
1919
// \ref{\iotwod.colorstops.colorstop.cons}, construct:
20-
constexpr color_stop(double o, const rgba_color& c);
20+
constexpr color_stop(float o, const rgba_color& c);
2121

2222
// \ref{\iotwod.colorstops.colorstop.modifiers}, modifiers:
23-
constexpr void offset(double val) noexcept;
23+
constexpr void offset(float val) noexcept;
2424
constexpr void color(const rgba_color& val) noexcept;
2525

2626
// \ref{\iotwod.colorstops.colorstop.observers}, observers:
27-
constexpr double offset() const noexcept;
27+
constexpr float offset() const noexcept;
2828
constexpr rgba_color color() const noexcept;
2929
};
3030
}
@@ -34,7 +34,7 @@
3434

3535
\indexlibrary{\idxcode{color_stop}!constructor}%
3636
\begin{itemdecl}
37-
constexpr color_stop(double o, const rgba_color& c) noexcept;
37+
constexpr color_stop(float o, const rgba_color& c) noexcept;
3838
\end{itemdecl}
3939
\begin{itemdescr}
4040
\pnum
@@ -52,7 +52,7 @@
5252

5353
\indexlibrarymember{offset}{color_stop}%
5454
\begin{itemdecl}
55-
constexpr void offset(double val) noexcept;
55+
constexpr void offset(float val) noexcept;
5656
\end{itemdecl}
5757
\begin{itemdescr}
5858
\pnum
@@ -62,7 +62,7 @@
6262

6363
\indexlibrarymember{color}{color_stop}%
6464
\begin{itemdecl}
65-
constexpr void color(double val) noexcept;
65+
constexpr void color(float val) noexcept;
6666
\end{itemdecl}
6767
\begin{itemdescr}
6868
\pnum
@@ -75,7 +75,7 @@
7575
\indexlibrary{\idxcode{color_stop}!\idxcode{offset}}
7676
\indexlibrary{\idxcode{offset}!\idxcode{color_stop}}
7777
\begin{itemdecl}
78-
constexpr double offset() const noexcept;
78+
constexpr float offset() const noexcept;
7979
\end{itemdecl}
8080
\begin{itemdescr}
8181
\pnum

source/compositing-op.tex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@
304304
would normally occur. Implementations shall not throw an exception nor
305305
otherwise produce any observable error condition if the result color's alpha
306306
channel is zero. Instead, implementations shall bypass the division by zero and
307-
produce the result color (0.0, 0.0, 0.0, 0.0), i.e. \defnx{transparent
307+
produce the result color (0, 0, 0, 0), i.e. \defnx{transparent
308308
black}{color!transparent black}, if the result color alpha channel formula
309309
evaluates to zero.
310310
\begin{note}
@@ -348,7 +348,7 @@
348348
& $f(Sc, Dc) = Sc + Dc - Sc \times Dc$
349349
\\
350350
\tcode{overlay}
351-
& $if (Dc \le 0.5)~\{\br
351+
& $if (Dc \le 0.5f)~\{\br
352352
\hspace*{1em}f(Sc, Dc) = 2 \times Sc \times Dc\br
353353
\}\br
354354
else~\{\br
@@ -385,7 +385,7 @@
385385
\}$
386386
\\
387387
\tcode{hard_light}
388-
& $if~(Sc \le 0.5)~\{\br
388+
& $if~(Sc \le 0.5f)~\{\br
389389
\hspace*{1em}f(Sc, Dc) = 2 \times Sc \times Dc\br
390390
\}\br
391391
else~\{\br

0 commit comments

Comments
 (0)