tests/testthat/test-numeric_eval.R

test_that("smoke", {
  skip_if_no_sympy()
  
  n_2 <- as_sym("2")
  n_pi <- as_sym("pi", declare_symbols = FALSE)
  x <- sqrt(n_2) * n_pi
  
  expect_equal(as.character(N(x)), "4.44288293815837")
  expect_equal(as.character(N(x, 5)), "4.4429")
  expect_equal(as.character(N(x, 50)), "4.4428829381583662470158809900606936986146216893757")
})

Try the caracas package in your browser

Any scripts or data that you put into this service are public.

caracas documentation built on Oct. 17, 2023, 5:08 p.m.