Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
2e8bc73c
Commit
2e8bc73c
authored
Sep 17, 2019
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix float-equal warning
parent
a50df471
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
examples/message_passing/divider.cpp
examples/message_passing/divider.cpp
+5
-5
No files found.
examples/message_passing/divider.cpp
View file @
2e8bc73c
...
@@ -5,13 +5,13 @@
...
@@ -5,13 +5,13 @@
// Manual refs: 19-25, 35-48, 68-77 (MessagePassing);
// Manual refs: 19-25, 35-48, 68-77 (MessagePassing);
// 19-34, 50-58 (Error)
// 19-34, 50-58 (Error)
#include <cmath>
#include <iostream>
#include <iostream>
#include "caf/all.hpp"
#include "caf/all.hpp"
using
std
::
cout
;
using
std
::
cout
;
using
std
::
endl
;
using
std
::
endl
;
using
std
::
flush
;
using
namespace
caf
;
using
namespace
caf
;
namespace
{
namespace
{
...
@@ -40,10 +40,10 @@ using divider = typed_actor<replies_to<div_atom, double, double>::with<double>>;
...
@@ -40,10 +40,10 @@ using divider = typed_actor<replies_to<div_atom, double, double>::with<double>>;
divider
::
behavior_type
divider_impl
()
{
divider
::
behavior_type
divider_impl
()
{
return
{
return
{
[](
div_atom
,
double
x
,
double
y
)
->
result
<
double
>
{
[](
div_atom
,
double
x
,
double
y
)
->
result
<
double
>
{
if
(
y
==
0.0
)
if
(
std
::
fpclassify
(
y
)
==
FP_ZERO
)
return
math_error
::
division_by_zero
;
return
math_error
::
division_by_zero
;
return
x
/
y
;
return
x
/
y
;
}
}
,
};
};
}
}
...
@@ -60,9 +60,9 @@ public:
...
@@ -60,9 +60,9 @@ public:
void
caf_main
(
actor_system
&
system
,
const
config
&
)
{
void
caf_main
(
actor_system
&
system
,
const
config
&
)
{
double
x
;
double
x
;
double
y
;
double
y
;
cout
<<
"x: "
<<
flush
;
cout
<<
"x: "
<<
std
::
flush
;
std
::
cin
>>
x
;
std
::
cin
>>
x
;
cout
<<
"y: "
<<
flush
;
cout
<<
"y: "
<<
std
::
flush
;
std
::
cin
>>
y
;
std
::
cin
>>
y
;
auto
div
=
system
.
spawn
(
divider_impl
);
auto
div
=
system
.
spawn
(
divider_impl
);
scoped_actor
self
{
system
};
scoped_actor
self
{
system
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment