Skip to main content

malachite_base/
platform.rs

1// Copyright © 2026 Mikhail Hogrefe
2//
3// This file is part of Malachite.
4//
5// Malachite is free software: you can redistribute it and/or modify it under the terms of the GNU
6// Lesser General Public License (LGPL) as published by the Free Software Foundation; either version
7// 3 of the License, or (at your option) any later version. See <https://www.gnu.org/licenses/>.
8
9#[cfg(not(feature = "std"))]
10#[macro_export]
11macro_rules! fma {
12    ($a: expr, $b: expr, $c: expr) => {{ libm::fma($a, $b, $c) }};
13}
14
15#[cfg(feature = "std")]
16#[macro_export]
17macro_rules! fma {
18    ($a: expr, $b: expr, $c: expr) => {{ $a.mul_add($b, $c) }};
19}
20
21pub use fma;
22
23#[cfg(not(feature = "std"))]
24#[macro_export]
25macro_rules! round_even {
26    ($a: expr) => {{ libm::roundeven($a) }};
27}
28
29#[cfg(feature = "std")]
30#[macro_export]
31macro_rules! round_even {
32    ($a: expr) => {{ $a.round_ties_even() }};
33}
34
35pub use round_even;