gpt4 book ai didi

math - 如何确定 Ada 95 中 Float 的模数

转载 作者:行者123 更新时间:2023-12-02 07:53:12 25 4
gpt4 key购买 nike

我需要确定一个时间周期的剩余量。要在 C 中做到这一点,我会使用 fmod。但是在 ada 中我找不到类似功能的引用。它需要准确,并且需要返回一个 float 以确保精度。

那么我如何确定 Ada 95 中 Float 的模数?

 elapsed := time_taken mod 10.348;
left := 10.348 - elapsed;
delay Duration(left);

最佳答案

使用 float 'Remainder属性。

Elapsed, Time_Taken : Float;

...

Elapsed := Float'Remainder(Time_Taken, 10.348);

关于math - 如何确定 Ada 95 中 Float 的模数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2474517/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com