1. Maths Functions
- Posted by Structural D-zine <structuraldzine at hotmail.com> Jul 20, 2001
- 333 views
I have been looking for maths functions equivalent to the Basic Round(x,no of places) RoundUp RoundDown I didn't see them on the web site. Did I miss them or will I write my own? Regards, Chris structuraldzine at aol.com
2. Re: Maths Functions
- Posted by Derek Parnell <ddparnell at bigpond.com> Jul 20, 2001
- 342 views
Hi Chris, try these.... function RoundDown(atom a) return floor(a) end function function RoundUp(atom a) if integer(a) then return a else return floor(a + 1) end if end function function Round(atom a, integer places) return floor(a * power(10, places) + 0.5) * power(10, -places) end function ----- Original Message ----- From: "Structural D-zine" <structuraldzine at hotmail.com> To: "EUforum" <EUforum at topica.com> Sent: Friday, July 20, 2001 7:51 PM Subject: Maths Functions > I have been looking for maths functions equivalent to the Basic > Round(x,no of places) > RoundUp > RoundDown >
3. Re: Maths Functions
- Posted by rforno at tutopia.com Jul 20, 2001
- 348 views
Derek: A generalization and a slight improvement for your routines: function RoundDown(object a) return floor(a) end function function RoundUp(object a) return -floor(-a) end function function Round(object a,integer places) return floor(a*power(10,places)+0.5)*power(10,-places) end function Anyway, for routine Round, the results might not be accurate to 'places' decimals, due to a small fuzz caused by binary versus decimal arithmetic, so that if many figures are used for accounting purposes and added up, a difference of a few cents might crop up. The only solution I know for this problem is to work internally with cents instead of dollars and show the results scaled. ----- Original Message ----- From: "Derek Parnell" <ddparnell at bigpond.com> To: "EUforum" <EUforum at topica.com> Sent: Friday, July 20, 2001 8:10 AM Subject: Re: Maths Functions > > > Hi Chris, > > try these.... > > function RoundDown(atom a) > return floor(a) > end function > > function RoundUp(atom a) > if integer(a) then > return a > else > return floor(a + 1) > end if > end function > > function Round(atom a, integer places) > return floor(a * power(10, places) + 0.5) * power(10, -places) > end function > > ----- Original Message ----- > From: "Structural D-zine" <structuraldzine at hotmail.com> > To: "EUforum" <EUforum at topica.com> > Sent: Friday, July 20, 2001 7:51 PM > Subject: Maths Functions > > > I have been looking for maths functions equivalent to the Basic > > Round(x,no of places) > > RoundUp > > RoundDown > > > > > > > >
4. Re: Maths Functions
- Posted by irvm at ellijay.com Jul 25, 2001
- 335 views
On Wednesday 25 July 2001 07:23, Structural D-zine wrote: > I couldn't find "!=" documented anywhere but found it appears to work as > "not equal to". Is this correct? See Refman2.html. Regards, Irv