generated from admin/template
Обновить works/pr2/3fast_inverse_square_root_quacklll/main3.cpp
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
int Q_rsqrt(float number){
|
float Q_rsqrt(float number){
|
||||||
long i;
|
int32_t i;
|
||||||
float x2, y;
|
float x2, y;
|
||||||
const float threehalfs = 1.5f;
|
const float threehalfs = 1.5f;
|
||||||
x2 = number * 0.5f;
|
x2 = number * 0.5f;
|
||||||
@@ -15,7 +15,7 @@ int Q_rsqrt(float number){
|
|||||||
return y;
|
return y;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
int main(void) {
|
||||||
for (float x = 0.5f; x <= 4.0f; x += 0.5f){
|
for (float x = 0.5f; x <= 4.0f; x += 0.5f){
|
||||||
printf("x=%.1f 1/sqrt(x) ~= %.6f\n", x, Q_rsqrt(x));
|
printf("x=%.1f 1/sqrt(x) ~= %.6f\n", x, Q_rsqrt(x));
|
||||||
}
|
}
|
||||||
@@ -23,4 +23,3 @@ int main() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user