Skip to content

Commit 2df13cd

Browse files
michalharakalclaude
andcommitted
fix: replace JVM-only Math.PI with kotlin.math.PI in VoxtralFlowMatching
Math.PI is not available on non-JVM targets (iOS, JS, WASM). Use kotlin.math.PI which is multiplatform. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent b3646e0 commit 2df13cd

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

llm-inference/voxtral/src/commonMain/kotlin/sk/ainet/models/voxtral/VoxtralFlowMatching.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,15 +200,15 @@ public class VoxtralFlowMatching(
200200
val u1 = random.nextFloat().coerceIn(1e-7f, 1.0f)
201201
val u2 = random.nextFloat()
202202
val mag = kotlin.math.sqrt(-2.0f * kotlin.math.ln(u1))
203-
val angle = (2.0 * Math.PI * u2).toFloat()
203+
val angle = (2.0 * kotlin.math.PI * u2).toFloat()
204204
values[i] = mag * kotlin.math.cos(angle)
205205
values[i + 1] = mag * kotlin.math.sin(angle)
206206
i += 2
207207
}
208208
if (i < n) {
209209
val u1 = random.nextFloat().coerceIn(1e-7f, 1.0f)
210210
val u2 = random.nextFloat()
211-
values[i] = kotlin.math.sqrt(-2.0f * kotlin.math.ln(u1)) * kotlin.math.cos((2.0 * Math.PI * u2).toFloat())
211+
values[i] = kotlin.math.sqrt(-2.0f * kotlin.math.ln(u1)) * kotlin.math.cos((2.0 * kotlin.math.PI * u2).toFloat())
212212
}
213213
@Suppress("UNCHECKED_CAST")
214214
val result = ctx.fromFloatArray<T, Float>(shape, dtype, values)

0 commit comments

Comments
 (0)