Logo ROOT  
Reference Guide
Quad.cxx
Go to the documentation of this file.
1 #include <math.h>
2 #include "Riostream.h"
3 #include "Quad.h"
4 
6 {
7  fA = a;
8  fB = b;
9  fC = c;
10 }
11 
13 {
14  std::cout << "deleting object with coeffts: "
15  << fA << "," << fB << "," << fC << std::endl;
16 }
17 
18 void Quad::Solve() const
19 {
20  Float_t temp = fB*fB -4*fA*fC;
21  if (temp > 0) {
22  temp = sqrt(temp);
23  std::cout << "There are two roots: "
24  << ( -fB - temp ) / (2.*fA)
25  << " and "
26  << ( -fB + temp ) / (2.*fA)
27  << std::endl;
28  } else {
29  if (temp == 0) {
30  std::cout << "There are two equal roots: "
31  << -fB / (2.*fA) << std::endl;
32  } else {
33  std::cout << "There are no roots" << std::endl;
34  }
35  }
36 }
37 
39 {
40  return fA*x*x + fB*x + fC;
41  return 0;
42 }
Quad::~Quad
~Quad()
Definition: Quad.cxx:12
c
#define c(i)
Definition: RSha256.hxx:119
Quad.h
Quad::fB
Float_t fB
Definition: Quad.h:13
Quad::Solve
void Solve() const
Definition: Quad.cxx:18
Float_t
float Float_t
Definition: RtypesCore.h:57
Quad::fA
Float_t fA
Definition: Quad.h:12
x
Double_t x[n]
Definition: legend1.C:17
b
#define b(i)
Definition: RSha256.hxx:118
a
auto * a
Definition: textangle.C:12
Quad::fC
Float_t fC
Definition: Quad.h:14
Quad::Quad
Quad(Float_t a, Float_t b, Float_t c)
Definition: Quad.cxx:5
sqrt
double sqrt(double)
Quad::Evaluate
Float_t Evaluate(Float_t x) const
Definition: Quad.cxx:38
Riostream.h