Author Topic: function CutTock(NonInteger:single; Cut:integer):double;  (Read 597 times)

0 Members and 1 Guest are viewing this topic.

Offline soldat-game

  • Camper
  • ***
  • Posts: 362
  • https://tryhackx.org/
    • TryHackX
function CutTock(NonInteger:single; Cut:integer):double;
« on: July 02, 2018, 04:12:08 pm »
Script Name: CutTock
Script Description: It does not round. It lets you cut off the number in uninteger without rounding. Example use CutTock(84.845567892773,2) return 84.84
100 000 x CutTock(84.845567892773); = 84.840000000000  00:00:01,156 (new fast CutTock function)
100 000 x RealDMG(84.845567892773); = 84.840000000000  00:00:03,355 (from me zitrofun)
100 000 x CutZero(84.845567892773); = 84.840000000000  00:00:03,647 (me other function)
Author: dominikkk26
Compile Test: Passed
Core Version: 2.8.1+

Code: [Select]
function CutTock(NonInteger:single; Cut:integer):double;
var real:integer; real2:double;
begin
real := round(int(NonInteger));
Real2 := (NonInteger-real);
Result := strtofloat(inttostr(real)+'.'+Copy(floattostr(Real2),3,Cut));
end;