It is definitely something to do with large numbers being passed into sin everything is the same until I pass Val into the sin function, then all hell breaks loose
UE4
X: 2450.000000, Y: 2440.000000, Z: -40.000000, pow(10, 6) = 1000000.000000, pow(10, 2) = 100.000000
Density: 0.157030
Star amount: 12 GG: 7450744010.000000 A: 1000100010.000000
Val: 100000007450744016.000000
ValSin: 0.393407
ValFloor: 3934.000000
StellaCharacteristicsSeed: 0.074625
CPP
X: 2450.000000, Y: 2440.000000, Z: -40.000000, pow(10, 6) = 1000000.000000, pow(10, 2) = 100.000000
Density: 0.157030
Star amount: 12 GG: 7450744010.000000 A: 1000100010.000000
Val: 100000007450744016.000000
ValSin: 0.393289
ValFloor: 3932.000000
StellaCharacteristicsSeed: 0.890989
double a = (pow(10, 9) + pow(10, 5) + 10);
double gg = 5 * a + X * pow(10, 6) + Y * pow(10, 2) + Z;
Seed *seed = new Seed(gg, false);
int StarAmount = (int)round(78 * Density * (1 + 2.2 * (pow(seed->GetValue() - 0.5, 3))));
double Val = gg + pow(10, 17);
for (auto i = 1; i < StarAmount; i++) {
FStar* Star = new FStar();
Seed *StellaCharacteristicsSeed = new Seed(t * i, true);
double s = StellaCharacteristicsSeed->GetValue();
UE_LOG(LogTemp, Warning, TEXT("StellaCharacteristicsSeed: %f
"), s);
}
Seed::Seed(double value, bool debug)
{
this->value = value;
this->debug = debug;
}
float Seed::GetValue() {
if (debug) {
UE_LOG(LogTemp, Warning, TEXT("Val: %f"), this->value);
UE_LOG(LogTemp, Warning, TEXT("ValSin: %f"), sin(this->value));
UE_LOG(LogTemp, Warning, TEXT("ValFloor: %f"), floor(sin(this->value) * 10000));
}
this->value = sin(this->value) * 10000;
return this->value - floor(this->value);
}