Bash – How to tell if floating point arithmetic is performed in hardware or software

bashfloating pointsystem-information

How can I tell if floating point arithmetic is performed in hardware or software?

I could find the processor's name and Google it, but is there a way to do it in a BASH script? For instance, is there something saved in a system file that I could read?

UPDATE:
output of /proc/cpuinfo on Intel:

processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 69
model name      : Intel(R) Core(TM) i3-4010U CPU @ 1.70GHz
stepping        : 1
microcode       : 0x17
cpu MHz         : 782.000
cache size      : 3072 KB
physical id     : 0
siblings        : 4
core id         : 0
cpu cores       : 2
apicid          : 0
initial apicid  : 0
fpu             : yes  <-- !!!
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid
bogomips        : 3392.25
clflush size    : 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:

output of /proc/cpuinfo on RPi (using Raspian v7):

processor       : 0
model name      : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS        : 2.00
Features        : swp half thumb fastmult vfp edsp java tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xb76
CPU revision    : 7

Hardware        : BCM2708
Revision        : 000e
Serial          : 000000007b455c14

Best Answer

Well, you can tell if your CPU has FPU capabilities with the data stored in /proc/cpuinfo and filter it with grep fpu

$ grep "fpu" /proc/cpuinfo

fpu     : yes
fpu_exception   : yes
flags       : fpu vme de pse ...

And for info, what type of CPU are you playing with? :)

EDIT for ARM proc, look for vector floating point unit (vfp), some info here.

Ex:

# cat /proc/cpuinfo
Processor       : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS        : 697.95
Features        : ... vfp ...
Related Question