Rules:
Four homes six into five considerations,
After five, non-zero in one,
After five, all zero look at the odd Couple,
I should give up five ago,
Five ago for the odd to enter one.
C#:
<textarea name="code" class="c#">Math.Round (new Decimal (1.2050), 2) 1.2math.round (new Decimal (1.2150), 2) 1.22math.round (New decimal (1.2250 ), 2) 1.22math.round (new Decimal (1.2350), 2) 1.24math.round (new Decimal (1.2450), 2) 1.24math.round (new D Ecimal (1.2550), 2) 1.26math.round (new Decimal (1.2650), 2) 1.26math.round (new Decimal (1.2750), 2) 1.28Mat H.round (New Decimal (1.2850), 2) 1.28math.round (new Decimal (1.2950), 2) 1.3</textarea>
Oracle
<textarea name="code" class="sql">CREATE OR REPLACE FUNCTION ROUND2 (P1 in number, P2 in number) RETURN Numberasbegin IF TRUNC (p1,p2+1) <>p1 OR SU BSTR (P1*power (10,p2+1), -1) <> ' 5 ' OR MOD (SUBSTR (P1*power (10,p2+1), -2,1), 2) =1 then RETURN ROUND (P1,P2); ELSE RETURN TRUNC (P1,P2); END IF; end;--Repair Constitution then/* Four six into the five considerations,//Five after the non-zero into one,//five after all zero look at parity,//five ago for I should shed,//five before the odd to enter one. */</textarea>
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Quad Loft Six into 50% pairs (quad six into parity) banker algorithm