cairo-fsm: Honor displaying footnote markers as subscripts.
[pspp] / src / output / charts / spreadlevel-plot.c
index 8fcc0bdeebfa8856accf15ae6e1e3e7974526084..e4fed6178666fdfe4fbe9fc161d697fc50c17d65 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPP - a program for statistical analysis.
-   Copyright (C) 2012 Free Software Foundation, Inc.
+   Copyright (C) 2012, 2020 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -26,6 +26,7 @@
 
 #include <math.h>
 #include <float.h>
+#include <stdlib.h>
 
 struct chart_item *
 spreadlevel_plot_create (const char *label, double tx_pwr)
@@ -43,19 +44,20 @@ spreadlevel_plot_create (const char *label, double tx_pwr)
 
   sl->n_data = 0;
   sl->data = NULL;
-  
+
   return &sl->chart_item;
 }
 
-void 
+void
 spreadlevel_plot_add (struct chart_item *ci, double spread, double level)
 {
   struct spreadlevel_plot_chart *sl = to_spreadlevel_plot_chart (ci);
 
-  if ( sl->tx_pwr == 0)
+  /* Zero has a special meaning, in this implementation.  */
+  if (sl->tx_pwr == 0)
     {
-      spread = log (spread);
-      level = log (level);
+      spread = log (fabs (spread));
+      level = log (fabs (level));
     }
   else
     {