sqrt

    0熱度

    2回答

    我已經給出了下面的代碼,它傳遞一個數字來檢查它是否是素數。我不明白什麼floor(sqrt(toCheck)) +1做什麼或prb變量做什麼。我認爲它運行while循環,而bool noFactorFound爲true,prb小於searchLimit。如果我知道searchLimit是如何初始化的,那麼一切都會落空。 #include<cmath> //for floor() & sqrt()

    2熱度

    1回答

    this.promien = Math.sqrt(Math.abs((this.x * this.x) + (this.y * this.y))); 並且x = 0.965(...)y = -15.285(...)。當我試圖解決這個問題時,後面加了這個abs。 this.promien總是0,我不知道爲什麼。我重新啓動Android Studio,沒有幫助。有什麼我看不到的? public c

    2熱度

    4回答

    是什麼導致了這個問題? from math import sqrt print "a : " a = float(raw_input()) print "b : " b = float(raw_input()) print "c : " c = float(raw_input()) d = (a + b + c)/2 s = sqrt(d*(d-a)*(d-b)*(d-c)) p

    1熱度

    2回答

    #include <stdio.h> #include <math.h> double hypotenuse(double side1, double side2); int main(void) { double a, b; printf("Enter the values of the two sides: "); scanf("%f %f", &a

    2熱度

    1回答

    所以我試着編寫一個簡單的平方根函數。我做了,我想將它與Python的原始版本進行比較。這是我的代碼: from math import sqrt import timeit def sqrt2(number): i=1 while i**2<number: i+=1 left=float(i-1) right=float(i) t

    -3熱度

    3回答

    所以我試圖做一個程序來計算二次公式,但是當我嘗試編譯代碼時,我得到以下:「未定義的對sqrt的引用」 但我試着通過數學來定義sqrt .h和其他2個代碼。 我重視我的代碼 任何幫助,將不勝感激 #include <stdio.h> #include <math.h> #include <stdlib.h> double sqrt(double); int main (void) {

    -2熱度

    3回答

    int Asum,temp4; temp4=Math.sqrt(Asum); 這是我寫的代碼的一部分。我已經將Asum和temp4聲明爲整數。我試圖獲得Asum的sqrt並將其分配給temp4。但由於某種原因,Java給了我錯誤:可能會失去精度。 REQD = INT。找到=雙倍。 我需要temp4和Asum是一個整數。並沒有必要得到精確的小數值,我只需要四捨五入的整數。

    -3熱度

    1回答

    我無法解決的問題是我如何找到0和1之間的數字的sqrt。之後,我認爲所有的作品。導致此程序崩潰的唯一輸入數字是0(不包括)和1(不包括)之間的數字 任何幫助? #include <iostream> #include <cmath> #include <cassert> #include <stdlib.h> #include <cmath> using namespace std;

    0熱度

    1回答

    我使用Geany for C編程。當我嘗試建立的文件時,它給了我 error:undefined reference to sqrt. 編譯:gcc -Wall -c "%f" 體形:gcc -Wall -o "%e" "%f" 執行:./%e 我嘗試添加-lm到構建命令,但隨後給我 gcc error:no such file or directory.Compilation Failed.

    -1熱度

    1回答

    我正在努力嘗試一下。我讀過它可能會影響性能,但不如此代碼塊對我的機器有影響。 foreach (Crew CurrentBall in CrewList) { if (CurrentBall != WhiteBall) { double distance = 0; try {