[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-gsl] problems w/ gsl_poly_solve_quadratic

From: Jon Drews
Subject: [Help-gsl] problems w/ gsl_poly_solve_quadratic
Date: Tue, 13 Jul 2004 00:27:03 -0500

FreeBSD 5.2-CURRENT #0: Sat Jul 10 17:19:21 CDT 2004

Configured with: FreeBSD/i386 system compiler
Thread model: posix
gcc version 3.3.3 [FreeBSD] 20031106

GSL ver. 1.5 


 When I run the following program:
/* Finds the roots to Quadratic Eqn. (a*x^2 + b*x + c = 0) */

#include <stdio.h>
#include <gsl/gsl_poly.h>

int main()

  double a, b, c, *x0,*x1;

  printf("Enter the coefficients a, b, c of ax^2 + b*x + c = 0\n");
  scanf("%lf %lf %lf", &a, &b, &c);
  gsl_poly_solve_quadratic(a, b, c, x0, x1);

  printf("The roots are: %lf, %lf\n", *x0, *x1);

  return 0;

I get a core dump. I have compiled it and run it like so:

bash-2.05b$ gcc -g -c  -Wall -I/usr/local/include quadratic.c
bash-2.05b$ gcc -o QUAD -L/usr/local/lib quadratic.o -lgsl -lgslcblas
bash-2.05b$ ./QUAD
Enter the coefficients a, b, c of ax^2 + b*x + c = 0
1 2 1
Bus error (core dumped)

I get this output from ddd:

Copyright © 1995-1999 Technische Universität Braunschweig, Germany.
Copyright © 1999-2001 Universität Passau, Germany.
Copyright © 2001 Universität des Saarlandes, Germany.
Copyright © 2003 Free Software Fundation, Inc.
(gdb) file /usr/home/xfce/programs/gsl/QUAD
(gdb) run
Enter the coefficients a, b, c of ax^2 + b*x + c = 0
1 2 1

Program received signal SIGBUS, Bus error.
0x281235a9 in gsl_poly_solve_quadratic () from /usr/local/lib/
(gdb) bt
#0  0x281235a9 in gsl_poly_solve_quadratic () from /usr/local/lib/
#1  0x080485da in main () at quadratic.c:15

I also get the same error with gsl_poly_solve_cubic. What might I have
done wrong here?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]