Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Julia 0.53 KB | None | 0 0
  1. #Kacper Augustynowicz 22 X 2017
  2. function density(a::Float64, b::Float64)
  3.     d::Float64 = (nextfloat(a) - a)
  4.  
  5.     println("min space between numbers in [$a,$b] is $d\n\nFirst 4 numbers :\n")
  6.     x::Float64 = a
  7.    
  8.     for i in 1:4
  9.         println(x, "\t\t", bits(x))
  10.         x += d
  11.     end
  12.     println("\nLast 4 numbers :\n")
  13.  
  14.     y::Float64 = b - (3*d)
  15.     for i in (4,3,2,1)
  16.         println(y, "\t\t", bits(y))
  17.         y += d
  18.     end
  19. end
  20.  
  21. density(1.0, 2.0)
  22. println()
  23. density(0.5, 1.0)
  24. println()
  25. density(2.0, 4.0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement