問題タブ [ceil]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
python - ceil() 関数が期待値を返さない
ceil() 関数を使用して、浮動小数点計算の結果を最も近い整数に丸めています。あらゆる種類の異なる入力が経験されています...
問題を説明するためのいくつかの例を次に示します。
これは、実行中の浮動小数点計算に関係していることに気づきました...
このバグを確実にトラップする方法がわかりません
以下に概説するような「大まかな」方法がいくつかありますが、これが十分に堅牢なソリューションであるとは考えていません
java - Math.ceil が切り上げられないのはなぜですか?
次のコードがあります。
どの出力1.0
.
の結果が2.0
なので、出力するべきだと思いました。total/perPage
1.2
に切り上げられないのはなぜ2.0
ですか?
swift - Swift で CGFloat を切り上げる
SwiftでCGFloatを切り上げるにはどうすればよいですか? 試してみましceil(CDouble(myCGFloat))
たが、iPad Air と iPhone 5S でしか動作しません。
別のシミュレートされたデバイスで実行すると、次のエラーが表示されます'NSNumber' is not a subtype of 'CGFloat'
php - Count to 80, skipping every 5th number in a range of 100 numbers
I'm working on a quiz with 80 numbered questions. After every 4 questions there will be an unnumbered 5th bonusquestion. These 100 questions have index-numbers (1-100) in a database table. Maybe it'd have been more logical to use a separate table for the bonusquestions, but the client wants the questions in one table in that order.
I don't want to display the bonusquestion index-numbers in the interface of the quiz, therefore i need to skip every 5th index-number from the range of 100 questions.
I did manage to make a simple calculation which works well when i check it in a loop, but somehow i feel it's a rather dirty solution (ceil). Is there any way of writing this code in a neater or more logical way?
ActionScript:
PHP:
Edit: Let me try to visualize this
java - math.pow が int をネイティブに処理できないのはなぜですか? (床・天井も)
Java (およびおそらく他の言語) では、Math.pow が double で定義され、double を返すことを知っています。Java を書いた人々がなぜ int を返す pow(int, int) メソッドも書かなかったのか不思議に思っています。 )省略。私が知らないCSの複雑さに基づいた舞台裏の理由があると思わずにはいられません。
同様のトピックで、定義によりceil と floor は整数を返すのに、どうして int を返さないのでしょうか?
これを理解するのを手伝ってくれてありがとう。それは完全にマイナーですが、何年も私を悩ませてきました。
sql - CEILING は FLOOR の結果を返します - SQL SERVER 2008 R2
5 ではなく 4 として返されます。なぜですか?
編集:商が整数でない場合、次に小さい整数を取得したいと思います。
datetime - Java 8 を使用して分を上限に丸める
幸運にも Java 8 と新しい Time APi を使用できましたが、丸め関数は表示されません...
基本的に時間があれば...
これでよさそうですが、これでよろしいでしょうか?
python - 高精度のceil関数
数値を次の整数に高精度で切り上げるにはどうすればよいですか?
この操作をエレガントに行うにはどうすればよいですか?
c++ - C++は倍精度浮動小数点数を小数点以下2桁まで丸めます
GPA double を小数点以下 2 桁に四捨五入するのに問題があります。(四捨五入が必要な GPA の例: 3.67924) 現在、切り上げに ceil を使用していますが、現在は整数 (368) として出力されます。
ここに私が今持っているものがあります
上記のコードを 3.67924 で使用すると、368 が出力されます (これは私が望むものですが、整数と小数の間にピリオドがないだけです)。どうすればこれを修正できますか?