mirror of https://github.com/Nonannet/copapy.git
get_42 test function updated
This commit is contained in:
parent
705421ebb1
commit
cd36adeb35
|
|
@ -1,7 +1,7 @@
|
||||||
from ._target import Target
|
from ._target import Target
|
||||||
from ._basic_types import NumLike, variable, generic_sdb, iif
|
from ._basic_types import NumLike, variable, generic_sdb, iif
|
||||||
from ._vectors import vector
|
from ._vectors import vector
|
||||||
from ._math import sqrt, abs, sin, cos, tan, asin, acos, atan, atan2, log, exp, pow
|
from ._math import sqrt, abs, sin, cos, tan, asin, acos, atan, atan2, log, exp, pow, get_42
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"Target",
|
"Target",
|
||||||
|
|
@ -21,5 +21,6 @@ __all__ = [
|
||||||
"atan2",
|
"atan2",
|
||||||
"log",
|
"log",
|
||||||
"exp",
|
"exp",
|
||||||
"pow"
|
"pow",
|
||||||
|
"get_42"
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -215,9 +215,15 @@ def acos(x: NumLike) -> variable[float] | float:
|
||||||
return math.pi / 2 - asin(x)
|
return math.pi / 2 - asin(x)
|
||||||
|
|
||||||
|
|
||||||
def get_42() -> variable[float]:
|
@overload
|
||||||
|
def get_42(x: float | int) -> float: ...
|
||||||
|
@overload
|
||||||
|
def get_42(x: variable[Any]) -> variable[float]: ...
|
||||||
|
def get_42(x: NumLike) -> variable[float] | float:
|
||||||
"""Returns the variable representing the constant 42"""
|
"""Returns the variable representing the constant 42"""
|
||||||
return add_op('get_42', [0.0, 0.0])
|
if isinstance(x, variable):
|
||||||
|
return add_op('get_42', [x, x])
|
||||||
|
return float((int(x) * 3.0 + 42.0) * 5.0 + 21.0)
|
||||||
|
|
||||||
|
|
||||||
def abs(x: T) -> T:
|
def abs(x: T) -> T:
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,10 @@ int floor_div(float arg1, float arg2) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
float aux_get_42(float n) {
|
NOINLINE float auxsub_get_42(int n) {
|
||||||
return n + 42.0;
|
return n * 5.0f + 21.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NOINLINE float aux_get_42(float n) {
|
||||||
|
return auxsub_get_42(n * 3.0f + 42.0f);
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue