Example program - roots of a polynomial – HP Integrity NonStop H-Series User Manual
Page 239
Click on the banner to return to the user guide home page.
©Copyright 1996 Rogue Wave Software
Example Program - Roots of a Polynomial
Obtaining the Sample Program
The roots of a polynomial a x2 + b x + c = 0 are given by the formula:
x = (-b _ sqrt(b2 - 4ac))/2a
The following program takes as input three double precision numbers, and returns the complex
roots as a pair of values.
typedef complex
pair
(dcomplex a, dcomplex b, dcomplex c)
// return the roots of a quadratic equation
{
dcomplex root = sqrt(b * b - 4.0 * a * c);
a *= 2.0;
return make_pair(
(-b + root)/a,
(-b - root)/a);
}
This manual is related to the following products:
See also other documents in the category HP Computer hardware:
- xt1500 (58 pages)
- LaserJet 4700 (68 pages)
- ProLiant DL360 Server (16 pages)
- ProLiant BL460c Gen8 Server Blade (65 pages)
- ProLiant DL388p Gen8 Server (128 pages)
- ProLiant BL460c Gen8 Server Blade (67 pages)
- ProLiant BL40p Server series (73 pages)
- ProLiant BL465c Server Blade (87 pages)
- ProLiant DL388p Gen8 Server (47 pages)
- ProLiant ML115 Server (63 pages)
- ProLiant DL140 G2 Server (81 pages)
- Servidor HP ProLiant ML370 G4 (20 pages)
- Servidor HP ProLiant ML370 G4 (30 pages)
- Servidor HP ProLiant DL160 G5p (84 pages)
- Servidor HP ProLiant DL980 G7 (143 pages)
- Servidor HP ProLiant DL380 G5 (137 pages)
- Integrity rx2620 Servers (58 pages)
- Integrity rx2620 Servers (77 pages)
- Integrity rx2620 Servers (107 pages)
- Integrity rx2620 Servers (55 pages)
- 9000 rp3440 Servers (36 pages)
- Integrity rx2620 Servers (42 pages)
- Integrity rx2620 Servers (48 pages)
- Integrity rx2620 Servers (53 pages)
- Integrity rx2620 Servers (24 pages)
- Integrity rx2620 Servers (33 pages)
- Integrity rx2620 Servers (100 pages)
- Integrity rx2620 Servers (37 pages)
- Integrity Superdome sx1000 Server (53 pages)
- Integrity rx2620 Servers (37 pages)
- Servidor HP ProLiant DL360p Gen8 (129 pages)
- Servidor HP ProLiant DL120 G6 (133 pages)
- ProLiant DL580 Gen8 Server (91 pages)
- ProLiant MicroServer Gen8 (95 pages)
- ProLiant MicroServer (94 pages)
- ProLiant BL685c G5 Server Blade (99 pages)
- ProLiant Firmware Maintenance CD (87 pages)
- ProLiant BL10e Server Blade (232 pages)
- ProLiant BL40p Server series (30 pages)
- Serveur lame HP ProLiant BL680c G5 (90 pages)
- Serveur lame HP ProLiant BL465c Gen8 (578 pages)
- ProLiant DL320e Gen8 Server (96 pages)
- ProLiant ML110 G7 Server (113 pages)
- 9000 rp8420 Servers (38 pages)
- Integrity Superdome sx1000 Server (19 pages)