Re: [m-users.] Best way to implement constants ?

Julien Fischer <[email protected]>
Newsgroups gmane.comp.lang.mercury.general
Message-ID <[email protected]>
On Fri, 18 Aug 2023, Volker Wysk wrote:

> Am Freitag, dem 18.08.2023 um 10:45 +0200 schrieb Volker Wysk:
>> Hi, Sean
>>
>> Why don't you just use the "/" operator from the float library?
>
> I mean, constants like "1 / 2.75" will sure be evaluated at compile time.

1 / 2.75 is a type error in Mercury, it will evaluate to an error at
compile time. ;-)

At -O3 and above the Mercury compiler will (generally) evaluate a
variety of operations (see compiler/const_prop.m for details).
Float division is included in those operations

> And even if not, it's just a division, nothing expensive.

Relatively speaking, division *is* expensive.

Julien.
_______________________________________________
users mailing list
[email protected]
https://lists.mercurylang.org/listinfo/users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.