franco
1
Godot Version
4.4.1
Question
I have this simple script in a blank godot project:
extends Node2D
func _ready() -> void:
print(PI)
print(Vector2(PI, 0).x)
print(PI == Vector2(PI, 0).x)
Which returns:
3.14159265358979
3.14159274101257
false
Why PI has two values. I understand floating point errors but, here I just testing PI as a component from a vector. Why I should change value?
float (PI) is double-precision, in C/C++ it would be double, Vector2 is single-precision.
2 Likes
franco
3
Well that make sense, thank you
franco
4
For posterity this part of the docs explain it clearly:
1 Like
system
Closed
5
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.