Search
 
SCRIPT & CODE EXAMPLE
 

PERL

perl format decimal 2 places not rounding

my $places = 2;
my $factor = 10**$places;
int(1.555 * $factor) / $factor;  # 1.55
Comment

PREVIOUS NEXT
Code Example
Perl :: perl mechanize infinite scroll with attempt count 
Perl :: what happened to perl 6 
Perl :: how to initialize an array 
Pascal :: pascal pause until key is pressed 
Pascal :: pascal input format check 
Pascal :: begin in pascal 
Pascal :: turbo pascal online compiler 
Powershell :: takeown /f 
Powershell :: change increase windows scroll bar slider width 
Gdscript :: godot make string all lowercase 
Clojure :: clojure def 
Lisp :: lisp input 
Assembly :: Cannot open self /usr/local/bin/docker-compose 
Assembly :: include code in latex 
Assembly :: dd utility explained examples 
Assembly :: smt32f429 timer free running 
Javascript :: jquery vslidation remove spaces from input 
Javascript :: map range of numbers to another range 
Javascript :: jest cache clear 
Javascript :: javascript replace spaces with dashes 
Javascript :: import redux thunk 
Javascript :: jquery refresh page 
Javascript :: delete session javascript 
Javascript :: get week day name in javascript 
Javascript :: how to remove checked attribute of checkbox in jquery 
Javascript :: loop array backwards javascript 
Javascript :: generate random whole numbers within a range javascript 
Javascript :: jquery remove and add class 
Javascript :: how to use another port in angular 
Javascript :: How to get current URL with Javascript or React 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =