Skip to content

Commit 0c22b2e

Browse files
committed
Handle more syntax
1 parent af236bd commit 0c22b2e

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

code_snippets/chapter12/chapter12_07-001_derivative.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ constexpr auto derivative(ValueType x,
4545
return ((fifteen_m1 - six_m2) + m3) / ten_dx1;
4646
}
4747

48-
constexpr float x { static_cast<float>(std::numbers::pi_v<float> / static_cast<float>(3.0L)) };
48+
constexpr float xval { static_cast<float>(std::numbers::pi_v<float> / static_cast<float>(3.0L)) };
4949

5050
// Should be very near 0.5.
5151
const auto y =
52-
derivative(x,
52+
derivative(xval,
5353
0.01F,
5454
[](float x) -> float
5555
{

code_snippets/chapter12/chapter12_07-002_deriv_quadratic.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ class quadratic
5959
}
6060
};
6161

62-
constexpr float x { 0.5F };
62+
constexpr float xval { 0.5F };
6363

6464
// Should be very near 4.6.
6565
constexpr float y =
66-
derivative(x,
66+
derivative(xval,
6767
0.01F,
6868
quadratic(1.2F, 3.4F, 5.6F));
6969

@@ -73,7 +73,7 @@ auto main() -> int
7373
{
7474
std::stringstream strm { };
7575

76-
// 4.6
76+
// 4.600001
7777
strm << std::setprecision(std::numeric_limits<float>::digits10) << std::fixed << y << '\n';
7878

7979
using std::fabs;

0 commit comments

Comments
 (0)