changeset 1685:3b8c12927f45 draft

insert Math::Round in regex_mas/time.pl
author Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
date Sat, 10 Aug 2013 13:52:13 +0900
parents eb3daec80cbb
children 9492711de6b3
files example/regex_mas/time.pl
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/example/regex_mas/time.pl	Thu Aug 08 12:35:26 2013 +0900
+++ b/example/regex_mas/time.pl	Sat Aug 10 13:52:13 2013 +0900
@@ -7,6 +7,7 @@
 
 use strict;
 use warnings;
+use Math::Round; #有効数字以下四捨五入
 
 my $loop_counter = 0;
 my $exec_result = 0;
@@ -46,8 +47,8 @@
     ++$loop_counter;
 }
 
-$ave_time = $total_time / $loop_num;
+$ave_time = nearest(.001,$total_time / $loop_num); #小数点第4位未満四捨五入 (Math::Round)
 
 print "max:$max_time\n";
 print "min:$min_time\n";
-print "ave:$ave_time\n"; #有効数字3桁なので、平均も有効数字3桁にする???
+print "ave:$ave_time\n";