1
0
Fork 0
forked from AbleOS/ableos

skill issue fix

This commit is contained in:
koniifer 2024-11-10 20:04:49 +00:00
parent b21c05e924
commit bae58ade61

View file

@ -40,7 +40,7 @@ $TABLE_SIZE := @as(i32, 256)
sin := fn(theta: f32): f32 { sin := fn(theta: f32): f32 {
si := @fti(theta * 0.5 * @itf(TABLE_SIZE) / PI) si := @fti(theta * 0.5 * @itf(TABLE_SIZE) / PI)
d := theta - @floatcast(@itf(si)) * 2.0 * PI / @itf(TABLE_SIZE) d := theta - @itf(si) * 2.0 * PI / @itf(TABLE_SIZE)
ci := si + TABLE_SIZE / 4 & TABLE_SIZE - 1 ci := si + TABLE_SIZE / 4 & TABLE_SIZE - 1
si &= TABLE_SIZE - 1 si &= TABLE_SIZE - 1
return SIN_TABLE[@bitcast(si)] + (SIN_TABLE[@bitcast(ci)] - 0.5 * SIN_TABLE[@bitcast(si)] * d) * d return SIN_TABLE[@bitcast(si)] + (SIN_TABLE[@bitcast(ci)] - 0.5 * SIN_TABLE[@bitcast(si)] * d) * d
@ -48,10 +48,10 @@ sin := fn(theta: f32): f32 {
cos := fn(theta: f32): f32 { cos := fn(theta: f32): f32 {
ci := @fti(theta * 0.5 * @itf(TABLE_SIZE) / PI) ci := @fti(theta * 0.5 * @itf(TABLE_SIZE) / PI)
d := theta - @floatcast(@itf(ci)) * 2.0 * PI / @itf(TABLE_SIZE) d := theta - @itf(ci) * 2.0 * PI / @itf(TABLE_SIZE)
si := ci + TABLE_SIZE / 4 & TABLE_SIZE - 1 si := ci + TABLE_SIZE / 4 & TABLE_SIZE - 1
ci &= TABLE_SIZE - 1 ci &= TABLE_SIZE - 1
return SIN_TABLE[@bitcast(si)] + (SIN_TABLE[@bitcast(ci)] - 0.5 * SIN_TABLE[@bitcast(si)] * d) * d return SIN_TABLE[@bitcast(si)] - (SIN_TABLE[@bitcast(ci)] + 0.5 * SIN_TABLE[@bitcast(si)] * d) * d
} }
tan := fn(theta: f32): f32 { tan := fn(theta: f32): f32 {