diff options
author | reinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f> | 2005-04-05 04:46:06 +0000 |
---|---|---|
committer | reinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f> | 2005-04-05 04:46:06 +0000 |
commit | add33a2a7f689611d2b76029a0d5597281f684bc (patch) | |
tree | 81f45c145885e757343d8d9b460ba350f35a6bfc /plugin_math.c | |
parent | c49672b6b89a02dd5ed9c5203b534f8bd6e07509 (diff) | |
download | lcd4linux-add33a2a7f689611d2b76029a0d5597281f684bc.tar.gz |
[lcd4linux @ 2005-04-05 04:46:06 by reinelt]
ceil/floor patch from Maxime
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@526 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to 'plugin_math.c')
-rw-r--r-- | plugin_math.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/plugin_math.c b/plugin_math.c index d1216a9..e5a3cc0 100644 --- a/plugin_math.c +++ b/plugin_math.c @@ -1,4 +1,4 @@ -/* $Id: plugin_math.c,v 1.7 2005/01/18 06:30:23 reinelt Exp $ +/* $Id: plugin_math.c,v 1.8 2005/04/05 04:46:06 reinelt Exp $ * * math plugin * @@ -23,6 +23,9 @@ * * * $Log: plugin_math.c,v $ + * Revision 1.8 2005/04/05 04:46:06 reinelt + * ceil/floor patch from Maxime + * * Revision 1.7 2005/01/18 06:30:23 reinelt * added (C) to all copyright statements * @@ -135,6 +138,18 @@ static void my_max (RESULT *result, RESULT *arg1, RESULT *arg2) SetResult(&result, R_NUMBER, &value); } +static void my_floor (RESULT *result, RESULT *arg) +{ + double value = floor(R2N(arg)); + SetResult(&result, R_NUMBER, &value); +} + +static void my_ceil (RESULT *result, RESULT *arg) +{ + double value = ceil(R2N(arg)); + SetResult(&result, R_NUMBER, &value); +} + int plugin_init_math (void) { @@ -155,6 +170,10 @@ int plugin_init_math (void) AddFunction ("min", 2, my_min); AddFunction ("max", 2, my_max); + /* floor, ceil */ + AddFunction ("floor", 1, my_floor); + AddFunction ("ceil", 1, my_ceil); + return 0; } |