Re: integer division

new topic     » goto parent     » topic index » view thread      » older message » newer message

Andrew Nagy asked:
> Does Euphoria have a version of the Qbasic "\" operator?

To perform integer division in Euphoria use something like:

       z = floor(x/y)

This will give you a result that is rounded down to an integer.
I don't know if it's exactly compatible with QBasic for negative
numbers. It looks like it would be slower than a normal divide,
but actually floor(x/y) is faster than x/y.

> Also, one thing
> that I've never found in any language, even Euphoria, is a way to create a
> user-defined operator.

You can do it in C++, but I think it leads to unreadable code.
e.g. you might extend the meaning of the "+" or "-" symbols.

Regards,
  Rob Craig
  Rapid Deployment Software

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu