I am very confused about how decimal numbers work in perl. I'm having trouble multiplying an int with a double. Here's what I have:
sub timeEstimate(){
$number = shift;
print "Number: $number\n";
$stuff = sprintf("%d", $number * $number * $number) * .2045;
print "stuff: $stuff\n";
$totalDownloads = $stuff + ($number * $number) + $number;
print "totalDownloads: $totalDownloads\n";
$secondPerFile = .4464;
print "secondPerFile: $secondPerFile\n";
$totalSeconds = ($totalDownloads * $secondPerFile);
print "totalSeconds: $totalSeconds\n";
$totalHours = ($totalSeconds / 3600);
print "totalHours: $totalHours\n";
return $totalHours;
}
But no matter what I try, even sprintf, I still can't get $stuff to be anything but 0. Could someone explain how the system works?
UPDATE-Solved: Due to stupid self-inflicted mistake. I had
use integer;
in the code. headdesk