Skip to main content
ubuntuask.com

Back to all posts

How to Get Digits Past Decimal In Elixir?

Published on
2 min read
How to Get Digits Past Decimal In Elixir? image

Best Decimal Precision Tools to Buy in December 2025

1 SE Stainless Steel SAE Metric Ruler Set - Stainless Steel Precision Ruler Measuring Tool - Detachable Clips - Set of 2 Pcs - 925PSR-2

SE Stainless Steel SAE Metric Ruler Set - Stainless Steel Precision Ruler Measuring Tool - Detachable Clips - Set of 2 Pcs - 925PSR-2

  • PRECISION MEASUREMENT: DUAL SAE & METRIC RULERS FOR ACCURACY IN TASKS.

  • QUICK CONVERSIONS: BUILT-IN TABLES FOR EASY FRACTIONAL AND METRIC CONVERSIONS.

  • DURABLE & VERSATILE: STURDY STAINLESS STEEL WITH DETACHABLE CLIPS FOR CONVENIENCE.

BUY & SAVE
$6.49 $7.00
Save 7%
SE Stainless Steel SAE Metric Ruler Set - Stainless Steel Precision Ruler Measuring Tool - Detachable Clips - Set of 2 Pcs - 925PSR-2
2 PEC Tools 6“ Rigid Steel Ruler, Precision Stainless Steel Ruler, 1/32” and 1/64" Graduations on Front, Decimal Equivalent Chart on Back. Made in USA.

PEC Tools 6“ Rigid Steel Ruler, Precision Stainless Steel Ruler, 1/32” and 1/64" Graduations on Front, Decimal Equivalent Chart on Back. Made in USA.

  • UNMATCHED PRECISION: 1/64TH INCH INCREMENTS FOR EXACT MEASUREMENTS.
  • BUILT TO LAST: HIGH-QUALITY TEMPERED STEEL WITHSTANDS TOUGH USE.
  • LASER-ENGRAVED CLARITY: SHARP, CLEAR MARKINGS FOR DURABLE ACCURACY.
BUY & SAVE
$9.99
PEC Tools 6“ Rigid Steel Ruler, Precision Stainless Steel Ruler, 1/32” and 1/64" Graduations on Front, Decimal Equivalent Chart on Back. Made in USA.
3 NEIKO 01407A Electronic Digital Caliper Measuring Tool, 0 - 6 Inches Stainless Steel Construction with Large LCD Screen Quick Change Button for Inch Fraction Millimeter Conversions, Digital Caliper Measuring Tool

NEIKO 01407A Electronic Digital Caliper Measuring Tool, 0 - 6 Inches Stainless Steel Construction with Large LCD Screen Quick Change Button for Inch Fraction Millimeter Conversions, Digital Caliper Measuring Tool

  • QUICK MODE SWITCHING: INSTANTLY TOGGLE BETWEEN INCH, FRACTION, AND MM FOR EASE.

  • PRECISION ACCURACY: ACHIEVE PRECISE MEASUREMENTS WITH 0.0005” RESOLUTION.

  • DURABLE DESIGN: SPLASH AND DUST RESISTANT WITH A STRONG STAINLESS STEEL BODY.

BUY & SAVE
$23.79 $27.99
Save 15%
NEIKO 01407A Electronic Digital Caliper Measuring Tool, 0 - 6 Inches Stainless Steel Construction with Large LCD Screen Quick Change Button for Inch Fraction Millimeter Conversions, Digital Caliper Measuring Tool
4 ENGINEER Compact Precision Compact Long Nose Pliers (Needle tip),Professional Grade, ESD Safe with Carbon Steel Jaws. Made in Japan. ps-03,Black,141mm

ENGINEER Compact Precision Compact Long Nose Pliers (Needle tip),Professional Grade, ESD Safe with Carbon Steel Jaws. Made in Japan. ps-03,Black,141mm

  • PRECISION DESIGN FOR PCB, ELECTRONICS, AND CRAFTS WORK.
  • ESD SAFE COMFORT GRIPS PREVENT FATIGUE DURING EXTENDED USE.
  • SPRING-LOADED HANDLES ENHANCE EFFICIENCY AND REDUCE HAND STRAIN.
BUY & SAVE
$17.24 $18.31
Save 6%
ENGINEER Compact Precision Compact Long Nose Pliers (Needle tip),Professional Grade, ESD Safe with Carbon Steel Jaws. Made in Japan. ps-03,Black,141mm
5 PEC Tools 6" x 150mm Steel Rule, Decimal/Metric Machinist Ruler with Markings 1/10", 1/50", 1/2mm, 1mm, 1/25" Thick X 3/4" Wide, High-Carbon Steel, Satin Chrome Finish, Made in USA

PEC Tools 6" x 150mm Steel Rule, Decimal/Metric Machinist Ruler with Markings 1/10", 1/50", 1/2mm, 1mm, 1/25" Thick X 3/4" Wide, High-Carbon Steel, Satin Chrome Finish, Made in USA

  • ULTIMATE PRECISION: MACHINIST-LEVEL ACCURACY WITH 4 MEASUREMENT SCALES.
  • BUILT TO LAST: DURABLE, TEMPER-RESISTANT STEEL FOR LIFELONG USE.
  • CLEAR VISIBILITY: ENGRAVED MARKINGS ENSURE LONG-LASTING READABILITY.
BUY & SAVE
$10.99 $14.99
Save 27%
PEC Tools 6" x 150mm Steel Rule, Decimal/Metric Machinist Ruler with Markings 1/10", 1/50", 1/2mm, 1mm, 1/25" Thick X 3/4" Wide, High-Carbon Steel, Satin Chrome Finish, Made in USA
6 HARDELL Dial Caliper, Dual Reading Precision Caliper with Accuracy ±0.02", Durable Caliper Measuring Tool 6 Inch with Plastic Case, Lightweight Vernier Caliper for DIY/Household/Woodworking

HARDELL Dial Caliper, Dual Reading Precision Caliper with Accuracy ±0.02", Durable Caliper Measuring Tool 6 Inch with Plastic Case, Lightweight Vernier Caliper for DIY/Household/Woodworking

  • BATTERY-FREE PRECISION: ENJOY ACCURATE ±0.02 MEASUREMENTS HASSLE-FREE.

  • QUICK DUAL SCALE: READ DECIMALS & FRACTIONS SIDE-BY-SIDE-NO CONVERSIONS NEEDED.

  • LIGHT & PORTABLE: WEIGHING JUST 3.5OZ, PERFECT FOR ON-THE-GO PRECISION WORK.

BUY & SAVE
$9.99
HARDELL Dial Caliper, Dual Reading Precision Caliper with Accuracy ±0.02", Durable Caliper Measuring Tool 6 Inch with Plastic Case, Lightweight Vernier Caliper for DIY/Household/Woodworking
7 KAGYIFLY Router Table Setup Bars, 7pcs Aluminum Precision Setup Blocks Height Gauge Set for Router Table Saw Accessories and Angle Woodworking Set Up(Each Block has Different Thickness)

KAGYIFLY Router Table Setup Bars, 7pcs Aluminum Precision Setup Blocks Height Gauge Set for Router Table Saw Accessories and Angle Woodworking Set Up(Each Block has Different Thickness)

  • VERSATILE 4-IN-1 GAUGE SET FOR HEIGHT, DEPTH, ANGLE, AND STACKING.
  • DURABLE ALUMINUM DESIGN WITH LASER-ETCHED LABELS FOR EASY READING.
  • FLEXIBLE THICKNESS OPTIONS FOR CUSTOMIZABLE MEASUREMENTS AND SETUPS.
BUY & SAVE
$36.77
KAGYIFLY Router Table Setup Bars, 7pcs Aluminum Precision Setup Blocks Height Gauge Set for Router Table Saw Accessories and Angle Woodworking Set Up(Each Block has Different Thickness)
8 Performance Tool W131C Precision Feeler Gauge Set with 3-Inch Steel Rule - Decimal and Metric Sizes - SAE Sizes 002-025-Inch and Metric Sizes 05- 63 mm

Performance Tool W131C Precision Feeler Gauge Set with 3-Inch Steel Rule - Decimal and Metric Sizes - SAE Sizes 002-025-Inch and Metric Sizes 05- 63 mm

  • PRECISION MEASUREMENTS IN DECIMAL & METRIC FOR ADJUSTMENTS!

  • DURABLE 3-INCH STEEL RULE FOR LONG-LASTING TOOLBOX RELIABILITY!

  • VERSATILE FOR CARS, MOTORCYCLES & SMALL ENGINES - ALL SIZES COVERED!

BUY & SAVE
$7.49
Performance Tool W131C Precision Feeler Gauge Set with 3-Inch Steel Rule - Decimal and Metric Sizes - SAE Sizes 002-025-Inch and Metric Sizes 05- 63 mm
9 HOPLEX 2PCS Precision Tweezers, Model Hobby Making Tools, Upgraded Bent and Straight Flat Tip Stainless Steel Tweezers for Gundam, Scale Military Model, 3D Resin Parts, Electronics, Sodlering, DIY

HOPLEX 2PCS Precision Tweezers, Model Hobby Making Tools, Upgraded Bent and Straight Flat Tip Stainless Steel Tweezers for Gundam, Scale Military Model, 3D Resin Parts, Electronics, Sodlering, DIY

  • PERFECT FOR HOBBIES: IDEAL FOR MODELS, MINIATURES, AND 3D PARTS.
  • DURABLE STAINLESS STEEL: RESISTS ACIDS FOR LONG-LASTING USE.
  • ERGONOMIC DESIGN: COMFORTABLE GRIP REDUCES FATIGUE DURING USE.
BUY & SAVE
$9.99
HOPLEX 2PCS Precision Tweezers, Model Hobby Making Tools, Upgraded Bent and Straight Flat Tip Stainless Steel Tweezers for Gundam, Scale Military Model, 3D Resin Parts, Electronics, Sodlering, DIY
+
ONE MORE?

To get digits past the decimal in Elixir, you can use the Float.round/2 function along with the :precision option. This function rounds a float to a specified number of decimal places.

For example, if you have a float number and you want to get the digits up to 2 decimal places, you can use the following code:

rounded_number = Float.round(number, 2)

This will round the number to 2 decimal places and store it in the rounded_number variable. You can adjust the precision value as needed to get the desired number of decimal places.

How to get the integer part of a decimal number in Elixir?

You can get the integer part of a decimal number in Elixir by using the div function. Here's an example:

decimal_number = 5.67 integer_part = div(decimal_number, 1)

IO.puts integer_part # Output: 5

In this example, the div function is used to divide the decimal number by 1, which effectively removes the decimal part and leaves only the integer part.

How to convert decimal numbers to binary in Elixir?

Here's a simple implementation that converts a decimal number to binary in Elixir:

defmodule Converter do def decimal_to_binary(decimal) when is_integer(decimal) do decimal |> Integer.to_string(2) |> String.to_integer() end end

Converter.decimal_to_binary(10) # Output: 1010

You can use the Integer.to_string/2 function to convert the decimal number to a binary string representation, and then use String.to_integer/1 to convert the binary string back to an integer.

You can then call the decimal_to_binary function with the decimal number you want to convert to binary.

How to multiply decimal numbers in Elixir?

To multiply decimal numbers in Elixir, you can use the Kernel.* function. Here is an example:

num1 = Decimal.new("2.5") num2 = Decimal.new("1.5")

result = Kernel.*(num1, num2) IO.puts(result) # Output: 3.75

In this example, we are using the Decimal.new/1 function to create decimal numbers from strings, and then using the Kernel.* function to multiply the two decimal numbers together.

How to convert decimal numbers to integers in Elixir?

To convert decimal numbers to integers in Elixir, you can use the trunc/1, round/1, or floor/1 functions from the Float module. Here's an example using trunc/1:

decimal_number = 5.6 integer_number = trunc(decimal_number) IO.inspect(integer_number) # Output: 5

You can also use round/1 to round the decimal number to the nearest integer, or floor/1 to round down to the nearest integer.