works with errors around 1e-3