15,742,011 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View Javascript questions
View C++ questions
View Python questions
View Java questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by federico.strati (Top 5 by date)
federico.strati
16-Nov-10 3:45am
View
Deleted
the solving method is not correct for large values of b, that is why I presented the correct algorithm in another alternate... see Numerical Recipees in C or Wolfram site
federico.strati
10-Nov-10 5:07am
View
Deleted
Oh well, thanks Alain, I didn't know the standard evoluted to include the machine epsilon in the constants, I will include it in the solution... :-)
federico.strati
9-Nov-10 10:38am
View
Deleted
Oh well, the machine epsilon is around 3x10-8 for single precision and around somethingx10-16 for double precision... but to effectively state the tolerance for each machine you need a list of define's as in the GSL (GNU Scientific Library). It's not given in <limits.h> or other standard includes. Hence the used value 1x10-15 is a good choice for portable programs... It is up to the programmer and left as an exercise for the reader here to implement machine epsilons define's appropriate for its programs. Remember this is just a Tip, not a full bloated library... Cheers
federico.strati
9-Nov-10 4:23am
View
Deleted
The inputs "y" and "z" serve the only purpose of finding a root in the given [y,z] interval. I needed it in my work so I left it in the function presented here. But, as you say, you may just eliminate those two inputs and use "x1=q/a; x2=c/q;" in the body of the function.
federico.strati
19-Oct-10 6:30am
View
Deleted
Yes, it is more complex in the base class stated, but it is very simple to use it:
you just derive a class, say CSimpleConsumer, from CConsumer and implement the virtual method
"Execute" to do whatever you need taking into account the m_bStop boolean to exit cleanly.
You start the thread with base method "Start", you abort with "Abort", you stop with "Stop", etc...
in this way you have embedded a thread completely in a class per itself.
You instantiate the derived class and you have a new thread available, etc... .
Maybe you may interested in this simple way to embed a thread in a class. This is achieved
just by passing "this" to the argument of CreateThread and having the member "LocalThreadFunc"
reinterpret it and calling the pure virtual method of the class "Execute".