꧁✧Ɲ_44✧꧂
꧁✧Ɲ_44✧꧂
Explore posts from servers
MModular
Created by ꧁✧Ɲ_44✧꧂ on 1/21/2024 in #questions
Segmentation Fault, Got Object when returning a Float
Ws; 2
16 replies
MModular
Created by ꧁✧Ɲ_44✧꧂ on 1/21/2024 in #questions
Segmentation Fault, Got Object when returning a Float
Maybe thats why?
16 replies
MModular
Created by ꧁✧Ɲ_44✧꧂ on 1/21/2024 in #questions
Segmentation Fault, Got Object when returning a Float
I am using windows, wsl
16 replies
MModular
Created by ꧁✧Ɲ_44✧꧂ on 1/21/2024 in #questions
Segmentation Fault, Got Object when returning a Float
Oh
16 replies
MModular
Created by ꧁✧Ɲ_44✧꧂ on 1/21/2024 in #questions
Segmentation Fault, Got Object when returning a Float
Now i just ran it instead
16 replies
MModular
Created by ꧁✧Ɲ_44✧꧂ on 1/21/2024 in #questions
Segmentation Fault, Got Object when returning a Float
I used to build it previously
16 replies
MModular
Created by ꧁✧Ɲ_44✧꧂ on 1/21/2024 in #questions
Segmentation Fault, Got Object when returning a Float
Oh wait a new one
16 replies
MModular
Created by ꧁✧Ɲ_44✧꧂ on 1/21/2024 in #questions
Segmentation Fault, Got Object when returning a Float
[1980:1980:20240121,114858.370016:ERROR file_io_posix.cc:144] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2)
[1980:1980:20240121,114858.370119:ERROR file_io_posix.cc:144] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq: No such file or directory (2)
Please submit a bug report to https://github.com/modularml/mojo/issues and include the crash backtrace along with all the relevant source codes.
Stack dump:
0. Program arguments: mojo test.\360\237\224\245
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0 mojo 0x0000556fa6fb7ee7
1 mojo 0x0000556fa6fb5abe
2 mojo 0x0000556fa6fb85bf
3 libpthread.so.0 0x00007f2c8ec10420
[1] 1978 segmentation fault mojo test.🔥
[1980:1980:20240121,114858.370016:ERROR file_io_posix.cc:144] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2)
[1980:1980:20240121,114858.370119:ERROR file_io_posix.cc:144] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq: No such file or directory (2)
Please submit a bug report to https://github.com/modularml/mojo/issues and include the crash backtrace along with all the relevant source codes.
Stack dump:
0. Program arguments: mojo test.\360\237\224\245
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0 mojo 0x0000556fa6fb7ee7
1 mojo 0x0000556fa6fb5abe
2 mojo 0x0000556fa6fb85bf
3 libpthread.so.0 0x00007f2c8ec10420
[1] 1978 segmentation fault mojo test.🔥
16 replies
MModular
Created by ꧁✧Ɲ_44✧꧂ on 1/21/2024 in #questions
Segmentation Fault, Got Object when returning a Float
Ok but the segmentation fault?
16 replies
MModular
Created by ꧁✧Ɲ_44✧꧂ on 1/21/2024 in #questions
Segmentation Fault, Got Object when returning a Float
I am new to mojo, started yesterday so i dont know much
16 replies
MModular
Created by ꧁✧Ɲ_44✧꧂ on 1/21/2024 in #questions
Segmentation Fault, Got Object when returning a Float
This resulted in
mojo test.🔥
/mnt/d/Projects/QUk.YW5k.TUw/Cartoonify/test.🔥:18:32: error: cannot implicitly convert 'object' value to 'FloatLiteral' in assignment
pi = monte_carlo_simulation(10)
~~~~~~~~~~~~~~~~~~~~~~^~~~
mojo: error: failed to parse the provided Mojo
mojo test.🔥
/mnt/d/Projects/QUk.YW5k.TUw/Cartoonify/test.🔥:18:32: error: cannot implicitly convert 'object' value to 'FloatLiteral' in assignment
pi = monte_carlo_simulation(10)
~~~~~~~~~~~~~~~~~~~~~~^~~~
mojo: error: failed to parse the provided Mojo
16 replies
MModular
Created by ꧁✧Ɲ_44✧꧂ on 1/21/2024 in #questions
Segmentation Fault, Got Object when returning a Float
from python import Python

def monte_carlo_simulation(n: Int):
let random = Python.import_module("random")
var count = 0
for i in range(n):
let x = random.random()
let y = random.random()
let sum = x * x + y * y
if sum <= 1:
count += 1
return 4 * (count / n)

fn main() raises:
let py = Python.import_module("builtins")
let n = int(py.input("Enter the number of iterations: "))
var pi = 0.0
pi = monte_carlo_simulation(10)
print(pi)

return None
from python import Python

def monte_carlo_simulation(n: Int):
let random = Python.import_module("random")
var count = 0
for i in range(n):
let x = random.random()
let y = random.random()
let sum = x * x + y * y
if sum <= 1:
count += 1
return 4 * (count / n)

fn main() raises:
let py = Python.import_module("builtins")
let n = int(py.input("Enter the number of iterations: "))
var pi = 0.0
pi = monte_carlo_simulation(10)
print(pi)

return None
16 replies