changeset 36283:ebbd9730a8c6

Increase precision of calculation by using constants of type double.
author ib
date Tue, 30 Jul 2013 13:16:49 +0000
parents 872298702c15
children 5b86e5b99b6a
files gui/ui/main.c gui/ui/playbar.c
diffstat 2 files changed, 10 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/gui/ui/main.c	Tue Jul 30 13:07:43 2013 +0000
+++ b/gui/ui/main.c	Tue Jul 30 13:16:49 2013 +0000
@@ -148,12 +148,12 @@
            {
             case itPotmeter:
             case itHPotmeter:
-                 btnModify( item->message,(float)( X - item->x ) / item->width * 100.0f );
+                 btnModify( item->message,(float)( X - item->x ) / item->width * 100.0 );
 		 uiEvent( item->message,item->value );
                  value=item->value;
                  break;
 	    case itVPotmeter:
-                 btnModify( item->message, ( 1.0 - (float)( Y - item->y ) / item->height) * 100.0f );
+                 btnModify( item->message, ( 1.0 - (float)( Y - item->y ) / item->height) * 100.0 );
 		 uiEvent( item->message,item->value );
                  value=item->value;
                  break;
@@ -194,13 +194,13 @@
                  if (guiApp.menuIsPresent) guiApp.menuWindow.MouseHandler( 0,RX,RY,0,0 );
                  break;
             case itPotmeter:
-                 item->value=(float)( X - item->x ) / item->width * 100.0f;
+                 item->value=(float)( X - item->x ) / item->width * 100.0;
                  goto potihandled;
             case itVPotmeter:
-                 item->value=(1.0 - (float)( Y - item->y ) / item->height) * 100.0f;
+                 item->value=(1.0 - (float)( Y - item->y ) / item->height) * 100.0;
                  goto potihandled;
             case itHPotmeter:
-                 item->value=(float)( X - item->x ) / item->width * 100.0f;
+                 item->value=(float)( X - item->x ) / item->width * 100.0;
 potihandled:
                  if ( item->value > 100.0f ) item->value=100.0f;
                  if ( item->value < 0.0f ) item->value=0.0f;
--- a/gui/ui/playbar.c	Tue Jul 30 13:07:43 2013 +0000
+++ b/gui/ui/playbar.c	Tue Jul 30 13:16:49 2013 +0000
@@ -177,12 +177,12 @@
 	 {
 	  case itPotmeter:
 	  case itHPotmeter:
-	       btnModify( item->message,(float)( X - item->x ) / item->width * 100.0f );
+	       btnModify( item->message,(float)( X - item->x ) / item->width * 100.0 );
 	       uiEvent( item->message,item->value );
 	       value=item->value;
 	       break;
 	  case itVPotmeter:
-	       btnModify( item->message, ( 1.0 - (float)( Y - item->y ) / item->height) * 100.0f );
+	       btnModify( item->message, ( 1.0 - (float)( Y - item->y ) / item->height) * 100.0 );
 	       uiEvent( item->message,item->value );
 	       value=item->value;
 	       break;
@@ -215,13 +215,13 @@
 	       if (guiApp.menuIsPresent) guiApp.menuWindow.MouseHandler( 0,RX,RY,0,0 );
 	       break;
 	  case itPotmeter:
-	       item->value=(float)( X - item->x ) / item->width * 100.0f;
+	       item->value=(float)( X - item->x ) / item->width * 100.0;
 	       goto potihandled;
 	  case itVPotmeter:
-	       item->value=(1.0 - (float)( Y - item->y ) / item->height) * 100.0f;
+	       item->value=(1.0 - (float)( Y - item->y ) / item->height) * 100.0;
 	       goto potihandled;
 	  case itHPotmeter:
-	       item->value=(float)( X - item->x ) / item->width * 100.0f;
+	       item->value=(float)( X - item->x ) / item->width * 100.0;
 potihandled:
 	       if ( item->value > 100.0f ) item->value=100.0f;
 	       if ( item->value < 0.0f ) item->value=0.0f;