Our new official repo is on github
LCD Smartie version 5.6 is released!
Download it now: https://github.com/LCD-Smartie/LCDSmartie/releases

Round off numbers (I need help!!)

Discuss anything to do with plugins

Moderators: _X7JAY7X_, caesar, IFR, mattcro, limbo

Post Reply
whizz
Posts: 28
Joined: March 29th, 2005, 1:51 pm

Round off numbers (I need help!!)

Post by whizz »

I think this is a really stupid question :oops: , but: is there a way to round off numers?

For example:
I get (from an rss feed) 5.24512435
I want it to show 5.25

Anyone knows how to do that?

limbo
Plugin Author
Posts: 1604
Joined: February 13th, 2005, 7:38 pm
Location: Athens - Greece
Contact:

Post by limbo »

There no supporting function for this...

But its a good idea for plugin request!

IAMNOTAMODDER
Posts: 4
Joined: April 25th, 2005, 6:37 pm

Post by IAMNOTAMODDER »

Write a little dll somethig like $dll(mydll.dll,1,<value>,<sigfigs>).
to do this have a string input as param1, and a integer (unsigned to be pedantic) for param 2. then do this:

live:string;
live := value;

If live[sigfigs+1] >= 5 then
live[sigfigs] := live[sigfigs] +1;

setlength(live,sigfigs+1)

result := Pchar(live);

this is only basic code, i thought of 2 bugs(deecimal point probs) whilst writing it here, but you get the gyst!
sorry if you dont know delphi that this is a little irrelevant!

limbo
Plugin Author
Posts: 1604
Joined: February 13th, 2005, 7:38 pm
Location: Athens - Greece
Contact:

Post by limbo »

There is a plugin available for rounding numbers
see here: http://www.lansley.co.uk/forum/phpBB2/v ... c.php?t=89

Post Reply