v / examples / call_v_from_c / v_test_math.v
14 lines · 11 sloc · 343 bytes · a80bc2331450fc28c900097f8afafe173f161d27
Raw
1// vtest build: false // Check the README.md for detailed information; this file needs special compilation options
2module test_math
3
4import math
5
6@[export: 'square']
7fn calculate_square(i int) int {
8 return i * i
9}
10
11@[export: 'sqrt_of_sum_of_squares']
12fn calculate_sqrt_of_sum_of_squares(x f64, y f64) f64 {
13 return math.sqrt(x * x + y * y)
14}
15