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

Math plugin

Announcements of new plugins or updates.

Moderators: _X7JAY7X_, caesar, IFR, mattcro, limbo

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

Math plugin

Post by limbo »

New Plugin! math functions. This plugin makes most of the math functions you 'll need!

Get it on my site www.eserver.gr
Last edited by limbo on September 24th, 2006, 4:10 pm, edited 1 time in total.
lazybones
Posts: 16
Joined: September 21st, 2006, 7:56 am

Post by lazybones »

Nice... Some other features that would be useful.

1. A parameter that allows you to apply rounding/precision directly to the output so you don't have to double wrap values.

2. Convert common computer values IE Bytes, Bits, Mbytes, Mbits etc. Also have these conversion functions directly part of the call so when a value has math done on it the output can be put out in the format that best fits display.
limbo
Plugin Author
Posts: 1604
Joined: February 13th, 2005, 7:38 pm
Location: Athens - Greece
Contact:

Post by limbo »

lazybones wrote:Nice... Some other features that would be useful.

1. A parameter that allows you to apply rounding/precision directly to the output so you don't have to double wrap values.

2. Convert common computer values IE Bytes, Bits, Mbytes, Mbits etc. Also have these conversion functions directly part of the call so when a value has math done on it the output can be put out in the format that best fits display.

maybe I'll come back with a new version soon.
FormatC:

need help with coding yet again

Post by FormatC: »

first of all what do I need to run this plugin? Dotnet 1-3 or a VB library file?. so I'm trying to convert Temperature C>F and for the NVtemp plugin and I don't know what to type in the screen boxes so far I've tried

Code: Select all

$dll(math,19,C>F$dll(nvtemp,1,1,145,) and $dll(math $dll(nvtemp,1,1,145),100,C>F,) 
and I get errors on both the first one I tried says "No Conversion Type Error" and the second one says cannot load plugin Thanks to all that help
FormatC:

Post by FormatC: »

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

Re: need help with coding yet again

Post by limbo »

FormatC: wrote:so far I've tried

Code: Select all

$dll(math,19,C>F$dll(nvtemp,1,1,145,) and $dll(math $dll(nvtemp,1,1,145),100,C>F,) 
I know you found the solution but this post is a notification for any other user.
Both lines above are wrong!
$dll(math,19,C>F$dll(nvtemp,1,1,145,) = missing one comma seperator after the "C>F" which is in wrong place (it must be on the last parameter)
Correct is $dll(math,19,$dll(nvtemp,1,1,145,),C>F)
$dll(math $dll(nvtemp,1,1,145),100,C>F,) = missing the function number (19) with a comma seperator after the math keyword and the nvtemp plugin calling must be placed on the 100 position which is a not needed value. One last error is the last comma seperator
Correct is $dll(math,19,$dll(nvtemp,1,1,145,),C>F)
MORA
Posts: 14
Joined: March 7th, 2007, 5:21 pm

Post by MORA »

seems like it dont like double/float values ?

$dll(math,3,10,0.1) = 10 :(
$dll(math,3,10,1) = 10
limbo
Plugin Author
Posts: 1604
Joined: February 13th, 2005, 7:38 pm
Location: Athens - Greece
Contact:

Post by limbo »

MORA wrote:seems like it dont like double/float values ?

$dll(math,3,10,0.1) = 10 :(
$dll(math,3,10,1) = 10
Oops we have a bug there... I'll look on the source code ASAP
MORA
Posts: 14
Joined: March 7th, 2007, 5:21 pm

Post by MORA »

seems its the decimalseperator thats , in my region, this little snip I found handles it.

Code: Select all

        public static double StringToDouble(string stringNum) {
            string decimalCharacter = System.Globalization.CultureInfo.InstalledUICulture.NumberFormat.NumberDecimalSeparator;
            stringNum = stringNum.Replace(".", decimalCharacter);
            stringNum = stringNum.Replace(",", decimalCharacter);
            try {
                return double.Parse(stringNum);
            }
            catch (Exception ex){
                throw ex;
            }
        }

riffraff
Posts: 18
Joined: April 8th, 2007, 1:48 pm
Location: Fife, Scotland

Post by riffraff »

works great But is there any way to limit the accuracy of this plugin when doing division?

you example shows "parameters 2 and 3 will give a result of 0.666666666666666667"
how can i change this to give 0.67?
mattcro
Forum Supporter
Posts: 590
Joined: March 8th, 2006, 1:58 pm
Location: Scotland

Post by mattcro »

This is where things get complicated...

You can feed the result of one plugin into another plugin, or the same plugin again.

You can use the math plugins to to the divide, and place that division operation inside a call to the math plugin to round the result to 2 decimal places (for example)

IIRC function 4 is division and function 11 is round, so something like this would turn a perf plugin result in MB into the nearest whole GB value (thinking back to the total free disk space question!):

Code: Select all

$dll(math,11,$dll(math,4,$dll(perf,....),1024),0)
You'll need to insert the entire perf plugin string where I've put "perf,..."

So you'll end up with perhaps 3 plugin calls "nested" together! I don't know if there's a more compact way of doing it...
Post Reply