From e34f4cc99bf7f04d49db015e0c7d6b40811de4eb Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sat, 4 Dec 2021 20:13:00 +0800 Subject: [PATCH] language: add floor64 and ceil64 --- artiq/language/core.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/artiq/language/core.py b/artiq/language/core.py index 0cd28a8ff..f2e9bc988 100644 --- a/artiq/language/core.py +++ b/artiq/language/core.py @@ -6,12 +6,14 @@ from typing import Generic, TypeVar from functools import wraps from inspect import getfullargspec, getmodule from types import SimpleNamespace +from math import floor, ceil from artiq.language import import_cache __all__ = [ - "KernelInvariant", "virtual", "round64", + "KernelInvariant", "virtual", + "round64", "floor64", "ceil64", "extern", "kernel", "portable", "nac3", "rpc", "parallel", "sequential", "set_watchdog_factory", "watchdog", "TerminationRequested" @@ -30,6 +32,12 @@ class virtual(Generic[T]): def round64(x): return round(x) +def floor64(x): + return floor(x) + +def ceil64(x): + return ceil(x) + _allow_registration = True # Delay NAC3 analysis until all referenced variables are supposed to exist on the CPython side.