HMC5883L compass

I'm using HMC5883L
the below test program outputs negative values for the angle and does not seem to match with the expected (0 to 360) range.
Has any one used a program for HMC5883L that simply outputs the angle from north direction ?

#include <Wire.h>
#include <HMC.h>
//#include <ArduinoRobot.h>
int a;

void setup()
{
Serial.begin(9600);
}

void loop()
{
int x,y,z;
delay(100); // There will be new values every 100ms
HMC.getValues(&x,&y,&z);
Serial.print("x:");
Serial.print(x);
Serial.print(" y:");
Serial.print(y);
Serial.print(" z:");
Serial.println(z);

HMC.getAngle(&a);
Serial.println(a);
}

the below test program outputs negative values for the angle

In what range?

from 0 to 250

You probably need to calibrate the compass, which involves at minimum, determining offset and gain values for each axis. Here is my favorite procedure: Sailboat Instruments: Improved magnetometer calibration (Part 1)