How do I perform an integer division (e.g. 11 / 3 = 4) in OpenOffice Basic?
--
Dipl.-Phys. Felix E. Klee
Email: [EMAIL PROTECTED] (work), [EMAIL PROTECTED] (home)
Tel: +49 721 8307937, Fax: +49 721 8307936
Linuxburg, Goethestr. 15A, 76135 Karlsruhe, Germany
Am Mittwoch, 14. Dezember 2005 11:39 schrieb Eric MOREL:
http://www.richhillsoftware.com/blog/archives/2005/06/xnumbers_011_no.html
Do I really need an extra package just to do integer division? This operation
is built into almost every programming language!
--
Dipl.-Phys. Felix E. Klee
No I don't think so but perhaps you can see the macro code behind Xdivint().
Eric
Felix E. Klee a crit:
Am Mittwoch, 14. Dezember 2005 11:39 schrieb Eric MOREL:
http://www.richhillsoftware.com/blog/archives/2005/06/xnumbers_011_no.html
Do I really need an extra
Hi Felix,
How do I perform an integer division (e.g. 11 / 3 = 4) in OpenOffice Basic?
try this
11 \ 3 = 3
or fix(11/3)
the rounding depends of what you need
for me 11/3 is rounded to 3
Laurent
--
Laurent Godard [EMAIL PROTECTED] - Ingénierie OpenOffice.org
Indesko http://www.indesko.com
Hi Felix,
http://www.richhillsoftware.com/blog/archives/2005/06/xnumbers_011_no.html
Do I really need an extra package just to do integer division? This operation
is built into almost every programming language!
does
print cint(11/3)
do what you want ?
Regards
Stephan
--
Hi,
How do I perform an integer division (e.g. 11 / 3 = 4) in OpenOffice
Basic?
Huh? IME the integer division operator (in languages where it exists)
would produce 11 div 3 = 3, to match the modulus produced by the 'mod'
operator (which does exist in StarBasic).
That said, you can get
Am Mittwoch, 14. Dezember 2005 12:11 schrieb Laurent Godard:
11 \ 3 = 3
I couldn't find documentation for this operator in the online help (1.1.3).
How come?
or fix(11/3)
Well this probably uses a floating point number as an intermediary, which
could introduce numerical errors. This is
Hi Felix,
does
Dim iResult as integer
iResult = 11 \ 3
fit your needs?
The \ operator would do the division with a whole number result.
BTW, 11 / 3 would never result as 4. ;-)
Best wishes
Dieter
Felix E. Klee wrote On 12/14/05 11:26,:
How do I perform an integer division (e.g. 11 /
Felix E. Klee wrote:
Am Mittwoch, 14. Dezember 2005 12:11 schrieb Laurent Godard:
11 \ 3 = 3
I couldn't find documentation for this operator in the online help (1.1.3).
How come?
or fix(11/3)
Well this probably uses a floating point number as an intermediary, which